summaryrefslogtreecommitdiff
path: root/worldedit_commands/mark.lua
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2013-07-31 00:02:37 -0400
committerAnthony Zhang <azhang9@gmail.com>2013-07-31 00:02:37 -0400
commit3c51ec8c4a347a6714472c423215243fc538f5f5 (patch)
tree8e135060cff98b685a26f96682f0a1919822abe6 /worldedit_commands/mark.lua
parent49b683f27f54bcdc636c018c7e6c1c4b4462b0bf (diff)
//pyramid works along any axis and backwards. Working //clearobjects and //cylinder command, begin implementing super marker. Remove EnvRef usages and the block queue (the block queue does not work with VoxelManips). More block emergers.
Diffstat (limited to 'worldedit_commands/mark.lua')
-rw-r--r--worldedit_commands/mark.lua49
1 files changed, 43 insertions, 6 deletions
diff --git a/worldedit_commands/mark.lua b/worldedit_commands/mark.lua
index d2568ed..c241acb 100644
--- a/worldedit_commands/mark.lua
+++ b/worldedit_commands/mark.lua
@@ -1,30 +1,65 @@
worldedit.marker1 = {}
worldedit.marker2 = {}
+worldedit.marker = {}
+
+--wip: use this as a huge entity to make a full worldedit region box
+minetest.register_entity(":worldedit:region_cube", {
+ initial_properties = {
+ visual = "upright_sprite",
+ visual_size = {x=1.1, y=1.1},
+ textures = {"worldedit_pos1.png"},
+ visual_size = {x=10, y=10},
+ physical = false,
+ },
+ on_step = function(self, dtime)
+ if self.active == nil then
+ self.object:remove()
+ end
+ end,
+ on_punch = function(self, hitter)
+ --wip: remove the entire region marker
+ end,
+})
+
+--wip: use voxelmanip to put the entity in the correct spot
--marks worldedit region position 1
worldedit.mark_pos1 = function(name)
- local pos = worldedit.pos1[name]
+ local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if worldedit.marker1[name] ~= nil then --marker already exists
worldedit.marker1[name]:remove() --remove marker
worldedit.marker1[name] = nil
end
- if pos ~= nil then --add marker
- worldedit.marker1[name] = minetest.env:add_entity(pos, "worldedit:pos1")
+ if pos1 ~= nil then --add marker
+ worldedit.marker1[name] = minetest.add_entity(pos1, "worldedit:pos1")
worldedit.marker1[name]:get_luaentity().active = true
+ if pos2 ~= nil then --region defined
+ worldedit.mark_region(pos1, pos2)
+ end
end
end
--marks worldedit region position 2
worldedit.mark_pos2 = function(name)
- local pos = worldedit.pos2[name]
+ local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if worldedit.marker2[name] ~= nil then --marker already exists
worldedit.marker2[name]:remove() --remove marker
worldedit.marker2[name] = nil
end
- if pos ~= nil then --add marker
- worldedit.marker2[name] = minetest.env:add_entity(pos, "worldedit:pos2")
+ if pos2 ~= nil then --add marker
+ worldedit.marker2[name] = minetest.add_entity(pos2, "worldedit:pos2")
worldedit.marker2[name]:get_luaentity().active = true
+ if pos1 ~= nil then --region defined
+ worldedit.mark_region(pos1, pos2)
+ end
+ end
+end
+
+worldedit.mark_region = function(pos1, pos2)
+ if worldedit.marker[name] ~= nil then --marker already exists
+ --wip: remove markers
end
+
end
minetest.register_entity(":worldedit:pos1", {
@@ -35,6 +70,7 @@ minetest.register_entity(":worldedit:pos1", {
"worldedit_pos1.png", "worldedit_pos1.png",
"worldedit_pos1.png", "worldedit_pos1.png"},
collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
+ physical = false,
},
on_step = function(self, dtime)
if self.active == nil then
@@ -56,6 +92,7 @@ minetest.register_entity(":worldedit:pos2", {
"worldedit_pos2.png", "worldedit_pos2.png",
"worldedit_pos2.png", "worldedit_pos2.png"},
collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
+ physical = false,
},
on_step = function(self, dtime)
if self.active == nil then