This commit is contained in:
rnd 2015-05-06 19:57:03 +02:00
parent d6c6b3e6da
commit 0e51130bfb
2 changed files with 8 additions and 4 deletions

View File

@ -5,6 +5,7 @@ machines = {}; machines.pos1 = {}; machines.pos2 = {};
machines.marker1 = {}
machines.marker2 = {}
machines.marker_region = {}
machines.timer = 10;
@ -65,13 +66,16 @@ minetest.register_entity(":machines:pos1", {
physical = false,
},
on_step = function(self, dtime)
if machines.marker1[self.name] == nil then
machines[self.name].timer = machines[self.name].timer - dtime
if machines[self.name].timer<=0 or machines.marker1[self.name] == nil then
self.object:remove()
machines[self.name].timer = 10
end
end,
on_punch = function(self, hitter)
self.object:remove()
machines.marker1[self.name] = nil
machines[self.name].timer = 10
end,
})

View File

@ -491,16 +491,16 @@ minetest.register_abm({
if not table.mesecons then return end -- error
if not table.mesecons.effector then return end -- error
local effector=table.mesecons.effector;
if trigger then -- activate target node if succesful
meta:set_string("infotext", "detector: on");
if not effector.action_on then return end
effector.action_on({x=x1,y=y1,z=z1},node); -- run
meta:set_string("infotext", "detector: on");
else
meta:set_string("infotext", "detector: idle");
if not effector.action_off then return end
effector.action_off({x=x1,y=y1,z=z1},node); -- run
meta:set_string("infotext", "detector: idle");
end
end,