mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-08-20 13:34:05 +02:00
pos_marker_lua: add last_reset to properly clear huge regions
This commit is contained in:
parent
f800d7e3d7
commit
92fd201b42
@ -7,6 +7,8 @@ local anchor
|
||||
local entity_wall_size = 10
|
||||
local collision_thickness = 0.2
|
||||
|
||||
local last_reset = tostring(wea_c.get_ms_time())
|
||||
|
||||
local WEAPositionMarkerWall = {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
@ -28,7 +30,12 @@ local WEAPositionMarkerWall = {
|
||||
},
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
-- noop
|
||||
if staticdata ~= last_reset then
|
||||
print("DEBUG:marker_wall/remove staticdata", staticdata, "last_reset", last_reset)
|
||||
self.object:remove()
|
||||
else
|
||||
print("DEBUG:marker_wall/ok staticdata", staticdata, "type", type(staticdata), "last_reset", last_reset, "type", type(last_reset))
|
||||
end
|
||||
end,
|
||||
on_punch = function(self, _)
|
||||
anchor.delete(self)
|
||||
@ -102,8 +109,8 @@ local function create_single(player_name, pos1, pos2, side)
|
||||
|
||||
|
||||
local pos_centre = ((pos2 - pos1) / 2) + pos1
|
||||
local entity = minetest.add_entity(pos_centre, "worldeditadditions:marker_wall")
|
||||
print("DEBUG:marker_wall create_single --> START player_name", player_name, "pos1", pos1, "pos2", pos2, "side", side, "SPAWN", pos_centre)
|
||||
local entity = minetest.add_entity(pos_centre, "worldeditadditions:marker_wall", last_reset)
|
||||
print("DEBUG:marker_wall create_single --> START player_name", player_name, "pos1", pos1, "pos2", pos2, "side", side, "SPAWN", pos_centre, "last_reset", last_reset)
|
||||
|
||||
entity:get_luaentity().player_name = player_name
|
||||
|
||||
@ -431,9 +438,14 @@ local function delete(entitylist)
|
||||
entity:remove()
|
||||
end
|
||||
|
||||
last_reset = tostring(wea_c.get_ms_time())
|
||||
print("DEBUG:marker_wall delete --> LAST_RESET is now", last_reset, "type", type(last_reset))
|
||||
|
||||
anchor:emit("delete", {
|
||||
player_name = player_name
|
||||
})
|
||||
|
||||
|
||||
end
|
||||
|
||||
anchor = EventEmitter.new({
|
||||
|
Loading…
Reference in New Issue
Block a user