diff options
author | Anthony Zhang <azhang9@gmail.com> | 2013-07-31 22:15:08 -0400 |
---|---|---|
committer | Anthony Zhang <azhang9@gmail.com> | 2013-07-31 22:15:08 -0400 |
commit | b0bf52e9b688713853b1ab3740d8b6522a1ba5ae (patch) | |
tree | a8a29a991a6c6457c276ef0902e2e91f6d29161b /worldedit_commands | |
parent | 3c51ec8c4a347a6714472c423215243fc538f5f5 (diff) |
Rewrite spirals from scratch and fix upside-down pyramids. Use voxelmanip for markers to ensure area is emerged.
Diffstat (limited to 'worldedit_commands')
-rw-r--r-- | worldedit_commands/init.lua | 8 | ||||
-rw-r--r-- | worldedit_commands/mark.lua | 28 |
2 files changed, 27 insertions, 9 deletions
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 1a57849..b6c1e79 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -536,8 +536,8 @@ minetest.register_chatcommand("/pyramid", { })
minetest.register_chatcommand("/spiral", {
- params = "<width> <height> <space> <node>",
- description = "Add spiral centered at WorldEdit position 1 with width <width>, height <height>, space between walls <space>, composed of <node>",
+ params = "<length> <height> <space> <node>",
+ description = "Add spiral centered at WorldEdit position 1 with side length <length>, height <height>, space between walls <space>, composed of <node>",
privs = {worldedit=true},
func = function(name, param)
local pos = worldedit.pos1[name]
@@ -546,7 +546,7 @@ minetest.register_chatcommand("/spiral", { return
end
- local found, _, width, height, space, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$")
+ local found, _, length, height, space, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$")
if found == nil then
worldedit.player_notify(name, "invalid usage: " .. param)
return
@@ -557,7 +557,7 @@ minetest.register_chatcommand("/spiral", { return
end
- local count = worldedit.spiral(pos, tonumber(width), tonumber(height), tonumber(space), node)
+ local count = worldedit.spiral(pos, tonumber(length), tonumber(height), tonumber(space), node)
worldedit.player_notify(name, count .. " nodes added")
end,
})
diff --git a/worldedit_commands/mark.lua b/worldedit_commands/mark.lua index c241acb..3295d74 100644 --- a/worldedit_commands/mark.lua +++ b/worldedit_commands/mark.lua @@ -21,16 +21,21 @@ minetest.register_entity(":worldedit:region_cube", { end,
})
---wip: use voxelmanip to put the entity in the correct spot
-
--marks worldedit region position 1
worldedit.mark_pos1 = function(name)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
+
+ if pos1 ~= nil then
+ --make area stay loaded
+ local manip = minetest.get_voxel_manip()
+ manip:read_from_map(pos1, pos1) --wip: see if this even works
+ end
if worldedit.marker1[name] ~= nil then --marker already exists
worldedit.marker1[name]:remove() --remove marker
worldedit.marker1[name] = nil
end
- if pos1 ~= nil then --add marker
+ 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
@@ -42,11 +47,18 @@ end --marks worldedit region position 2
worldedit.mark_pos2 = function(name)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
+
+ if pos2 ~= nil then
+ --make area stay loaded
+ local manip = minetest.get_voxel_manip()
+ manip:read_from_map(pos2, pos2) --wip: see if this even works
+ end
if worldedit.marker2[name] ~= nil then --marker already exists
worldedit.marker2[name]:remove() --remove marker
worldedit.marker2[name] = nil
end
- if pos2 ~= nil then --add marker
+ 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
@@ -56,10 +68,16 @@ worldedit.mark_pos2 = function(name) end
worldedit.mark_region = function(pos1, pos2)
+ --make area stay loaded
+ local manip = minetest.get_voxel_manip()
+ manip:read_from_map(pos1, pos2)
+
if worldedit.marker[name] ~= nil then --marker already exists
--wip: remove markers
end
-
+ if pos1 ~= nil and pos2 ~= nil then
+ --wip: place markers
+ end
end
minetest.register_entity(":worldedit:pos1", {
|