mirror of
https://github.com/D00Med/scifi_nodes.git
synced 2024-12-23 00:20:17 +01:00
Palm scanner added
This commit is contained in:
parent
e0e04587fa
commit
6aaf2fa665
@ -1,9 +1,10 @@
|
|||||||
![Scifi nodes][screenshot.png]
|
![Scifi nodes](screenshot.png)
|
||||||
|
|
||||||
# scifi_nodes
|
# scifi_nodes
|
||||||
|
|
||||||
Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
||||||
|
|
||||||
|
* 05/05/2019 : added palm_scanner, which emmits mesecon signal when rightclicked by owner
|
||||||
* 05/01/2019 : create aliases to deal with old namming policy un doors.lua
|
* 05/01/2019 : create aliases to deal with old namming policy un doors.lua
|
||||||
* 04/26/2019 :
|
* 04/26/2019 :
|
||||||
* sliding doors now open with mesecon signal
|
* sliding doors now open with mesecon signal
|
||||||
|
@ -276,7 +276,7 @@ for _, current_door in ipairs(doors) do
|
|||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand = 1},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
@ -1359,9 +1359,7 @@ minetest.register_node("scifi_nodes:digicode_off", {
|
|||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "scifi_nodes:digicode_off 2",
|
output = "scifi_nodes:digicode_off 2",
|
||||||
recipe = {
|
recipe = {{"mesecons_switch:mesecon_switch_off", "scifi_nodes:grey", ""}}
|
||||||
{"mesecons_switch:mesecon_switch_off", "scifi_nodes:grey", ""}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
@ -1376,15 +1374,9 @@ minetest.register_craft({
|
|||||||
local function toggle_palm_scanner(pos)
|
local function toggle_palm_scanner(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local name = node.name
|
local name = node.name
|
||||||
if name == "scifi_nodes:palm_scanner_off" then
|
|
||||||
minetest.swap_node(pos, {name="scifi_nodes:palm_scanner_on", param2=node.param2})
|
|
||||||
mesecon.receptor_on(pos, get_switch_rules(node.param2))
|
|
||||||
minetest.get_node_timer(pos):start(2)
|
|
||||||
elseif name == "scifi_nodes:palm_scanner_on" then
|
|
||||||
minetest.swap_node(pos, {name="scifi_nodes:palm_scanner_off", param2=node.param2})
|
minetest.swap_node(pos, {name="scifi_nodes:palm_scanner_off", param2=node.param2})
|
||||||
mesecon.receptor_off(pos, get_switch_rules(node.param2))
|
mesecon.receptor_off(pos, get_switch_rules(node.param2))
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
-- after_place_node
|
-- after_place_node
|
||||||
-- placer is a player object
|
-- placer is a player object
|
||||||
@ -1398,21 +1390,25 @@ end
|
|||||||
local function check_owner(pos, node, player, itemstack, pointed_thing)
|
local function check_owner(pos, node, player, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
local player = player:get_player_name()
|
local tested_player = player:get_player_name()
|
||||||
print(dump(owner)..dump(player))
|
minetest.swap_node(pos, {name = "scifi_nodes:palm_scanner_checking", param2 = node.param2})
|
||||||
minetest.sound_play("scifi_nodes_palm_scanner", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
minetest.sound_play("scifi_nodes_palm_scanner", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
-- wait a minute please !
|
minetest.chat_send_player(tested_player, "Checking : please wait.")
|
||||||
local clock = os.clock
|
|
||||||
local t0 = clock()
|
-- wait for a bit please !
|
||||||
while clock() - t0 <= 1.5 do end
|
minetest.after(1.5, function(pos, node, tested_player, owner)
|
||||||
if owner == player then
|
if tested_player == owner then
|
||||||
minetest.sound_play("scifi_nodes_access_granted", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
minetest.sound_play("scifi_nodes_access_granted", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
minetest.chat_send_player(player, "Access granted !")
|
minetest.chat_send_player(tested_player, "Access granted !")
|
||||||
toggle_palm_scanner(pos)
|
minetest.swap_node(pos, {name = "scifi_nodes:palm_scanner_on", param2 = node.param2})
|
||||||
|
mesecon.receptor_on(pos, get_switch_rules(node.param2))
|
||||||
|
minetest.get_node_timer(pos):start(2)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player, "Access refused !")
|
minetest.chat_send_player(tested_player, "Access refused !")
|
||||||
minetest.sound_play("scifi_nodes_access_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
minetest.sound_play("scifi_nodes_access_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
|
minetest.swap_node(pos, {name = "scifi_nodes:palm_scanner_off", param2 = node.param2})
|
||||||
end
|
end
|
||||||
|
end, pos, node, tested_player, owner) -- end of anonymous function
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:palm_scanner_on", {
|
minetest.register_node("scifi_nodes:palm_scanner_on", {
|
||||||
@ -1435,7 +1431,7 @@ minetest.register_node("scifi_nodes:palm_scanner_on", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:palm_scanner_off", {
|
minetest.register_node("scifi_nodes:palm_scanner_off", {
|
||||||
description = "Palm scannner",
|
description = "Palm scanner",
|
||||||
tiles = {"scifi_nodes_palm_scanner_off.png",},
|
tiles = {"scifi_nodes_palm_scanner_off.png",},
|
||||||
inventory_image = "scifi_nodes_palm_scanner_on.png",
|
inventory_image = "scifi_nodes_palm_scanner_on.png",
|
||||||
wield_image = "scifi_nodes_palm_scanner_on.png",
|
wield_image = "scifi_nodes_palm_scanner_on.png",
|
||||||
@ -1453,6 +1449,24 @@ minetest.register_node("scifi_nodes:palm_scanner_off", {
|
|||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("scifi_nodes: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}
|
||||||
|
}},
|
||||||
|
wield_image = "scifi_nodes_palm_scanner_on.png",
|
||||||
|
inventory_image = "scifi_nodes_palm_scanner_on.png",
|
||||||
|
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},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "scifi_nodes:palm_scanner_off 2",
|
output = "scifi_nodes:palm_scanner_off 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
Loading…
Reference in New Issue
Block a user