Compare commits

...

5 Commits

Author SHA1 Message Date
Buckaroo Banzai 4513e2de54
add same plane mesecon rules 2020-11-23 20:38:54 +01:00
BuckarooBanzay 7574e266a1 add mesecons rules 2020-10-22 10:49:08 +02:00
BuckarooBanzay db8a801d37 remove *_scanning node 2020-03-12 13:05:20 +01:00
BuckarooBanzay 8aadde26d7 github workflow 2020-03-12 13:03:28 +01:00
BuckarooBanzay 914a42cc01 internalize textures and sounds 2020-03-12 13:02:29 +01:00
11 changed files with 59 additions and 44 deletions

17
.github/workflows/luacheck.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: luacheck
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: apt
run: sudo apt-get install -y luarocks
- name: luacheck install
run: luarocks install --local luacheck
- name: luacheck run
run: $HOME/.luarocks/bin/luacheck ./

View File

@ -13,6 +13,5 @@ read_globals = {
"vector", "ItemStack",
"dump", "VoxelArea",
"unifieddyes", "mesecon", "default",
"scifi_nodes"
"unifieddyes", "mesecon", "default"
}

View File

@ -1,12 +0,0 @@
language: generic
sudo: false
addons:
apt:
packages:
- luarocks
before_install:
- luarocks install --local luacheck
script:
- $HOME/.luarocks/bin/luacheck --no-color .
notifications:
email: false

View File

@ -1,5 +1,33 @@
-- stolen and adapted from https://github.com/D00Med/scifi_nodes/blob/master/palm_scanner.lua
local get_switch_rules = function(param2)
-- param2 = 2
local rules = {
-- lower plane
{x=1, y=-1, z=-1},
{x=1, y=-1, z=1},
{x=0, y=-1, z=-1},
{x=0, y=-1, z=1},
-- same plane
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=0, z=1},
{x=0, y=0, z=-1},
}
-- Left and right when looking to +y ?
if param2 == 3 then
rules = mesecon.rotate_rules_right(mesecon.rotate_rules_right (rules))
elseif param2 == 4 then
rules = mesecon.rotate_rules_right(rules)
elseif param2 == 5 then
rules = mesecon.rotate_rules_left(rules)
end
return rules
end
local function starts_with(str, start)
return str:sub(1, #start) == start
end
@ -23,7 +51,7 @@ local function activate_palm_scanner(pos, node, player)
if meta:get_int("configured") ~= 1 then
if key_name then
minetest.sound_play("scifi_nodes_palm_scanner", {max_hear_distance = 8, pos = pos, gain = 1.0})
minetest.sound_play("access_cards_scanning", {max_hear_distance = 8, pos = pos, gain = 1.0})
meta:set_string("key", key_name)
meta:set_int("configured", 1)
minetest.chat_send_player(name, "Scanner-key set to '" .. key_name .. "'")
@ -41,20 +69,21 @@ local function activate_palm_scanner(pos, node, player)
minetest.swap_node(pos, node)
minetest.chat_send_player(name, "Access denied !")
minetest.sound_play("scifi_nodes_scanner_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
minetest.sound_play("access_cards_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
else
node.name = "access_cards:palm_scanner_on"
minetest.swap_node(pos, node)
minetest.chat_send_player(name, "Access granted !")
mesecon.receptor_on(pos)
minetest.sound_play("access_cards_granted", {max_hear_distance = 8, pos = pos, gain = 1.0})
mesecon.receptor_on(pos, get_switch_rules(node.param2))
-- reset state
minetest.after(2, function()
node.name = "access_cards:palm_scanner_off"
minetest.swap_node(pos, node)
mesecon.receptor_off(pos)
mesecon.receptor_off(pos, get_switch_rules(node.param2))
end)
end
@ -62,9 +91,9 @@ end
minetest.register_node("access_cards:palm_scanner_off", {
description = "Palm scanner",
tiles = {"scifi_nodes_palm_scanner_off.png",},
inventory_image = "scifi_nodes_palm_scanner_off.png",
wield_image = "scifi_nodes_palm_scanner_on.png",
tiles = {"access_cards_scanner_off.png",},
inventory_image = "access_cards_scanner_off.png",
wield_image = "access_cards_scanner_on.png",
drawtype = "signlike",
sunlight_propagates = true,
buildable_to = false,
@ -82,31 +111,13 @@ minetest.register_node("access_cards:palm_scanner_off", {
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("access_cards:palm_scanner_checking", {
description = "Palm scanner",
tiles = {{
name = "scifi_nodes_palm_scanner_checking.png",
animation = {type = "vertical_frames",aspect_w = 16,aspect_h = 16,length = 1.5}
}},
drawtype = "signlike",
sunlight_propagates = true,
buildable_to = false,
node_box = {type = "wallmounted",},
selection_box = {type = "wallmounted",},
paramtype = "light",
paramtype2 = "wallmounted",
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
drop = "access_cards:palm_scanner_off",
sounds = default.node_sound_glass_defaults()
})
minetest.register_node("access_cards:palm_scanner_on", {
description = "Palm scanner",
sunlight_propagates = true,
buildable_to = false,
tiles = {"scifi_nodes_palm_scanner_on.png",},
inventory_image = "scifi_nodes_palm_scanner_on.png",
wield_image = "scifi_nodes_palm_scanner_on.png",
tiles = {"access_cards_scanner_on.png",},
inventory_image = "access_cards_scanner_on.png",
wield_image = "access_cards_scanner_on.png",
drawtype = "signlike",
node_box = {type = "wallmounted",},
selection_box = {type = "wallmounted",},

View File

@ -5,7 +5,7 @@ access_cards = {}
dofile(MP.."/form.accesscard.lua")
dofile(MP.."/cards.lua")
if minetest.get_modpath("scifi_nodes") and minetest.get_modpath("mesecons") then
if minetest.get_modpath("mesecons") then
dofile(MP.."/card_scanner.lua")
end

View File

@ -1,3 +1,3 @@
name = access_cards
depends = unifieddyes
optional_depends = scifi_nodes, mesecons
optional_depends = mesecons

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B