From 2922421f4a88e56a0a1c819f62bf2bc287835388 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Thu, 1 Dec 2016 04:22:40 -0500 Subject: Update several mods: biome_lib, boost_cart, building_blocks, castle, homedecor, glooptest, currency, roads, invsaw, maptools, mesecons, moreblocks, nixie_tubes, pipeworks, signs_lib, technic, unified_inventory, unifiedbricks, worldedit, xban2 --- worldedit_commands/init.lua | 52 ++++++++++++++++++++++++++++++--------------- worldedit_commands/mark.lua | 6 +++++- 2 files changed, 40 insertions(+), 18 deletions(-) (limited to 'worldedit_commands') diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index ca2b9e4..b9313cc 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -517,9 +517,25 @@ minetest.register_chatcommand("/cylinder", { end, check_cylinder), }) -minetest.register_chatcommand("/pyramid", { +local check_pyramid = function(name, param) + if worldedit.pos1[name] == nil then + worldedit.player_notify(name, "no position 1 selected") + return nil + end + local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + local node = get_node(name, nodename) + if not node then return nil end + height = tonumber(height) + return math.ceil(((height * 2 + 1) ^ 2) * height / 3) +end + +minetest.register_chatcommand("/hollowpyramid", { params = "x/y/z/? ", - description = "Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height , composed of ", + description = "Add hollow pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height , composed of ", privs = {worldedit=true}, func = safe_region(function(name, param) local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$") @@ -529,24 +545,26 @@ minetest.register_chatcommand("/pyramid", { height = height * sign end local node = get_node(name, nodename) - local count = worldedit.pyramid(worldedit.pos1[name], axis, height, node) + local count = worldedit.pyramid(worldedit.pos1[name], axis, height, node, true) worldedit.player_notify(name, count .. " nodes added") - end, - function(name, param) - if worldedit.pos1[name] == nil then - worldedit.player_notify(name, "no position 1 selected") - return nil - end + end, check_pyramid), +}) + +minetest.register_chatcommand("/pyramid", { + params = "x/y/z/? ", + description = "Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height , composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$") - if found == nil then - worldedit.player_notify(name, "invalid usage: " .. param) - return nil + height = tonumber(height) + if axis == "?" then + axis, sign = worldedit.player_axis(name) + height = height * sign end local node = get_node(name, nodename) - if not node then return nil end - height = tonumber(height) - return math.ceil(((height * 2 + 1) ^ 2) * height / 3) - end), + local count = worldedit.pyramid(worldedit.pos1[name], axis, height, node) + worldedit.player_notify(name, count .. " nodes added") + end, check_pyramid), }) minetest.register_chatcommand("/spiral", { @@ -571,7 +589,7 @@ minetest.register_chatcommand("/spiral", { end local node = get_node(name, nodename) if not node then return nil end - return check_region(name, param) + return 1 -- TODO: return an useful value end), }) diff --git a/worldedit_commands/mark.lua b/worldedit_commands/mark.lua index 4062cae..7f880ea 100644 --- a/worldedit_commands/mark.lua +++ b/worldedit_commands/mark.lua @@ -153,7 +153,11 @@ minetest.register_entity(":worldedit:region_cube", { end end, on_punch = function(self, hitter) - for _, entity in ipairs(worldedit.marker_region[self.player_name]) do + local markers = worldedit.marker_region[self.player_name] + if not markers then + return + end + for _, entity in ipairs(markers) do entity:remove() end worldedit.marker_region[self.player_name] = nil -- cgit v1.2.3