1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2025-07-01 07:30:39 +02:00

Move worldedit.marker_update

Markers are part of the UI (`worldedit_chatcommands`) and do not belong in `worldedit`.
This commit is contained in:
sfan5
2020-04-07 00:14:31 +02:00
parent 963a9f6b96
commit 9b26034aea
4 changed files with 24 additions and 36 deletions

View File

@ -3,7 +3,7 @@ worldedit.marker2 = {}
worldedit.marker_region = {}
--marks worldedit region position 1
worldedit.mark_pos1 = function(name)
worldedit.mark_pos1 = function(name, region_too)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 ~= nil then
@ -22,11 +22,13 @@ worldedit.mark_pos1 = function(name)
worldedit.marker1[name]:get_luaentity().player_name = name
end
end
worldedit.mark_region(name)
if region_too == nil or region_too then
worldedit.mark_region(name)
end
end
--marks worldedit region position 2
worldedit.mark_pos2 = function(name)
worldedit.mark_pos2 = function(name, region_too)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos2 ~= nil then
@ -45,7 +47,9 @@ worldedit.mark_pos2 = function(name)
worldedit.marker2[name]:get_luaentity().player_name = name
end
end
worldedit.mark_region(name)
if region_too == nil or region_too then
worldedit.mark_region(name)
end
end
worldedit.mark_region = function(name)
@ -111,6 +115,13 @@ worldedit.mark_region = function(name)
end
end
--convenience function that calls everything
worldedit.marker_update = function(name)
worldedit.mark_pos1(name, false)
worldedit.mark_pos2(name, false)
worldedit.mark_region(name)
end
minetest.register_entity(":worldedit:pos1", {
initial_properties = {
visual = "cube",