Compare commits
5 Commits
375b763a07
...
4513e2de54
Author | SHA1 | Date |
---|---|---|
Buckaroo Banzai | 4513e2de54 | |
BuckarooBanzay | 7574e266a1 | |
BuckarooBanzay | db8a801d37 | |
BuckarooBanzay | 8aadde26d7 | |
BuckarooBanzay | 914a42cc01 |
|
@ -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 ./
|
|
@ -13,6 +13,5 @@ read_globals = {
|
|||
"vector", "ItemStack",
|
||||
"dump", "VoxelArea",
|
||||
|
||||
"unifieddyes", "mesecon", "default",
|
||||
"scifi_nodes"
|
||||
"unifieddyes", "mesecon", "default"
|
||||
}
|
||||
|
|
12
.travis.yml
12
.travis.yml
|
@ -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
|
|
@ -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",},
|
||||
|
|
2
init.lua
2
init.lua
|
@ -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
|
||||
|
||||
|
|
2
mod.conf
2
mod.conf
|
@ -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 |
Loading…
Reference in New Issue