From 67875f9c6e0bcbea6ffc4263ff5a887dae7d7378 Mon Sep 17 00:00:00 2001 From: upsilon Date: Sun, 10 May 2020 10:09:34 +0200 Subject: [PATCH] Fix bug allowing timegate duplication Fixes #13 --- moremesecons_timegate/init.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/moremesecons_timegate/init.lua b/moremesecons_timegate/init.lua index 87bda43..7872bab 100644 --- a/moremesecons_timegate/init.lua +++ b/moremesecons_timegate/init.lua @@ -25,11 +25,14 @@ local function timegate_activate(pos, node) node.name = "moremesecons_timegate:timegate_on" minetest.swap_node(pos, node) mesecon.receptor_on(pos) - minetest.after(time, function(pos, node) - mesecon.receptor_off(pos) - node.name = "moremesecons_timegate:timegate_off" - minetest.swap_node(pos, node) - end, pos, node) + minetest.after(time, function() + local node = minetest.get_node(pos) + if node.name == "moremesecons_timegate:timegate_on" then + mesecon.receptor_off(pos) + node.name = "moremesecons_timegate:timegate_off" + minetest.swap_node(pos, node) + end + end) end boxes = {{ -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 }, -- the main slab