..
This commit is contained in:
parent
6828d63d1e
commit
9ea097790e
15
mark.lua
15
mark.lua
@ -5,7 +5,6 @@ machines = {}; machines.pos1 = {}; machines.pos2 = {};
|
||||
machines.marker1 = {}
|
||||
machines.marker2 = {}
|
||||
machines.marker_region = {}
|
||||
machines.timer = 10;
|
||||
|
||||
|
||||
|
||||
@ -18,6 +17,9 @@ machines.mark_pos1 = function(name)
|
||||
local manip = minetest.get_voxel_manip()
|
||||
manip:read_from_map(pos1, pos1)
|
||||
end
|
||||
|
||||
if not machines[name] then machines[name]={} end
|
||||
machines[name].timer = 10;
|
||||
if machines.marker1[name] ~= nil then --marker already exists
|
||||
machines.marker1[name]:remove() --remove marker
|
||||
machines.marker1[name] = nil
|
||||
@ -40,6 +42,9 @@ machines.mark_pos2 = function(name)
|
||||
local manip = minetest.get_voxel_manip()
|
||||
manip:read_from_map(pos2, pos2)
|
||||
end
|
||||
|
||||
if not machines[name] then machines[name]={} end
|
||||
machines[name].timer = 10;
|
||||
if machines.marker2[name] ~= nil then --marker already exists
|
||||
machines.marker2[name]:remove() --remove marker
|
||||
machines.marker2[name] = nil
|
||||
@ -70,7 +75,6 @@ minetest.register_entity(":machines:pos1", {
|
||||
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)
|
||||
@ -91,12 +95,9 @@ minetest.register_entity(":machines:pos2", {
|
||||
physical = false,
|
||||
},
|
||||
on_step = function(self, dtime)
|
||||
if machines.marker2[self.name] == nil then
|
||||
if not machines[self.name] then machines[self.name]={}; machines[self.name].timer = 10 end
|
||||
if machines[self.name].timer<=0 or machines.marker2[self.name] == nil then
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
on_punch = function(self, hitter)
|
||||
self.object:remove()
|
||||
machines.marker2[self.name] = nil
|
||||
end,
|
||||
})
|
||||
|
@ -47,8 +47,11 @@ minetest.register_node("basic_machines:mover", {
|
||||
x0=meta:get_int("x0");y0=meta:get_int("y0");z0=meta:get_int("z0");
|
||||
x1=meta:get_int("x1");y1=meta:get_int("y1");z1=meta:get_int("z1");
|
||||
x2=meta:get_int("x2");y2=meta:get_int("y2");z2=meta:get_int("z2");
|
||||
machines.pos1[player:get_player_name()] = {x=pos.x+x1,y=pos.y+y1,z=pos.z+z1};machines.mark_pos1(player:get_player_name()) -- mark pos1
|
||||
machines.pos2[player:get_player_name()] = {x=pos.x+x2,y=pos.y+y2,z=pos.z+z2};machines.mark_pos2(player:get_player_name()) -- mark pos2
|
||||
|
||||
machines.pos1[player:get_player_name()] = {x=pos.x+x1,y=pos.y+y1,z=pos.z+z1};
|
||||
machines.mark_pos1(player:get_player_name()) -- mark pos1
|
||||
machines.pos2[player:get_player_name()] = {x=pos.x+x2,y=pos.y+y2,z=pos.z+z2};
|
||||
machines.mark_pos2(player:get_player_name()) -- mark pos2
|
||||
|
||||
prefer = meta:get_string("prefer");mode = meta:get_string("mode");
|
||||
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
|
||||
@ -358,6 +361,7 @@ minetest.register_node("basic_machines:keypad", {
|
||||
local x0,y0,z0,pass,iter,mode;
|
||||
x0=meta:get_int("x0");y0=meta:get_int("y0");z0=meta:get_int("z0");iter=meta:get_int("iter") or 1;
|
||||
mode = meta:get_int("mode") or 1;
|
||||
|
||||
machines.pos1[player:get_player_name()] = {x=pos.x+x0,y=pos.y+y0,z=pos.z+z0};machines.mark_pos1(player:get_player_name()) -- mark pos1
|
||||
|
||||
pass = meta:get_string("pass");
|
||||
|
Loading…
x
Reference in New Issue
Block a user