mirror of
https://github.com/D00Med/scifi_nodes.git
synced 2024-12-23 00:20:17 +01:00
Exit minetest.after callback if node no longer exists
This commit is contained in:
parent
79ba8cabc3
commit
53d9659051
@ -22,6 +22,8 @@ local function activate_palm_scanner(pos, node, player)
|
|||||||
|
|
||||||
-- check protection
|
-- check protection
|
||||||
minetest.after(2, function()
|
minetest.after(2, function()
|
||||||
|
if minetest.get_node(pos).name ~= node.name then return end
|
||||||
|
|
||||||
if minetest.is_protected(pos, name or "") then
|
if minetest.is_protected(pos, name or "") then
|
||||||
-- clicker has no access to area
|
-- clicker has no access to area
|
||||||
minetest.chat_send_player(name, "Access denied !")
|
minetest.chat_send_player(name, "Access denied !")
|
||||||
@ -36,6 +38,7 @@ local function activate_palm_scanner(pos, node, player)
|
|||||||
|
|
||||||
-- reset state
|
-- reset state
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
|
if minetest.get_node(pos).name ~= node.name then return end
|
||||||
node.name = "scifi_nodes:palm_scanner_off"
|
node.name = "scifi_nodes:palm_scanner_off"
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
mesecon.receptor_off(pos, scifi_nodes.get_switch_rules(node.param2))
|
mesecon.receptor_off(pos, scifi_nodes.get_switch_rules(node.param2))
|
||||||
|
Loading…
Reference in New Issue
Block a user