mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-07-01 15:40:39 +02:00
Remove or rename unused arguments and loop variables
This commit is contained in:
@ -239,7 +239,7 @@ worldedit.register_command("cubeapply", {
|
||||
end
|
||||
return true, sidex, sidey, sidez, cmd, parsed
|
||||
end,
|
||||
nodes_needed = function(name, sidex, sidey, sidez, cmd, parsed)
|
||||
nodes_needed = function(_, sidex, sidey, sidez)
|
||||
-- its not possible to defer to the target command at this point
|
||||
return sidex * sidey * sidez
|
||||
end,
|
||||
|
@ -88,7 +88,7 @@ function worldedit.register_command(name, def)
|
||||
def.require_pos = def.require_pos or 0
|
||||
assert(def.require_pos >= 0 and def.require_pos < 3)
|
||||
if def.params == "" and not def.parse then
|
||||
def.parse = function(param) return true end
|
||||
def.parse = function() return true end
|
||||
else
|
||||
assert(def.parse)
|
||||
end
|
||||
@ -470,7 +470,7 @@ worldedit.register_command("fixedpos", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||
minetest.register_on_punchnode(function(pos, _, puncher)
|
||||
local name = puncher:get_player_name()
|
||||
if name ~= "" and worldedit.set_pos[name] ~= nil then --currently setting position
|
||||
if worldedit.set_pos[name] == "pos1" then --setting position 1
|
||||
@ -579,7 +579,7 @@ worldedit.register_command("mix", {
|
||||
for nodename in param:gmatch("[^%s]+") do
|
||||
if tonumber(nodename) ~= nil and #nodes > 0 then
|
||||
local last_node = nodes[#nodes]
|
||||
for i = 1, tonumber(nodename) do
|
||||
for _ = 1, tonumber(nodename) do
|
||||
nodes[#nodes + 1] = last_node
|
||||
end
|
||||
else
|
||||
@ -665,7 +665,7 @@ worldedit.register_command("hollowcube", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_cube,
|
||||
nodes_needed = function(name, w, h, l, node)
|
||||
nodes_needed = function(_, w, h, l)
|
||||
return w * h * l
|
||||
end,
|
||||
func = function(name, w, h, l, node)
|
||||
@ -680,7 +680,7 @@ worldedit.register_command("cube", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_cube,
|
||||
nodes_needed = function(name, w, h, l, node)
|
||||
nodes_needed = function(_, w, h, l)
|
||||
return w * h * l
|
||||
end,
|
||||
func = function(name, w, h, l, node)
|
||||
@ -707,7 +707,7 @@ worldedit.register_command("hollowsphere", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_sphere,
|
||||
nodes_needed = function(name, radius, node)
|
||||
nodes_needed = function(_, radius)
|
||||
return math.ceil((4 * math.pi * (radius ^ 3)) / 3) --volume of sphere
|
||||
end,
|
||||
func = function(name, radius, node)
|
||||
@ -722,7 +722,7 @@ worldedit.register_command("sphere", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_sphere,
|
||||
nodes_needed = function(name, radius, node)
|
||||
nodes_needed = function(_, radius)
|
||||
return math.ceil((4 * math.pi * (radius ^ 3)) / 3) --volume of sphere
|
||||
end,
|
||||
func = function(name, radius, node)
|
||||
@ -749,7 +749,7 @@ worldedit.register_command("hollowdome", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_dome,
|
||||
nodes_needed = function(name, radius, node)
|
||||
nodes_needed = function(_, radius)
|
||||
return math.ceil((2 * math.pi * (radius ^ 3)) / 3) --volume of dome
|
||||
end,
|
||||
func = function(name, radius, node)
|
||||
@ -764,7 +764,7 @@ worldedit.register_command("dome", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_dome,
|
||||
nodes_needed = function(name, radius, node)
|
||||
nodes_needed = function(_, radius)
|
||||
return math.ceil((2 * math.pi * (radius ^ 3)) / 3) --volume of dome
|
||||
end,
|
||||
func = function(name, radius, node)
|
||||
@ -797,7 +797,7 @@ worldedit.register_command("hollowcylinder", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_cylinder,
|
||||
nodes_needed = function(name, axis, length, radius1, radius2, node)
|
||||
nodes_needed = function(_, _, length, radius1, radius2)
|
||||
local radius = math.max(radius1, radius2)
|
||||
return math.ceil(math.pi * (radius ^ 2) * length)
|
||||
end,
|
||||
@ -818,7 +818,7 @@ worldedit.register_command("cylinder", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_cylinder,
|
||||
nodes_needed = function(name, axis, length, radius1, radius2, node)
|
||||
nodes_needed = function(_, _, length, radius1, radius2)
|
||||
local radius = math.max(radius1, radius2)
|
||||
return math.ceil(math.pi * (radius ^ 2) * length)
|
||||
end,
|
||||
@ -851,7 +851,7 @@ worldedit.register_command("hollowpyramid", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_pyramid,
|
||||
nodes_needed = function(name, axis, height, node)
|
||||
nodes_needed = function(_, _, height)
|
||||
return math.ceil(((height * 2 + 1) ^ 2) * height / 3)
|
||||
end,
|
||||
func = function(name, axis, height, node)
|
||||
@ -871,7 +871,7 @@ worldedit.register_command("pyramid", {
|
||||
privs = {worldedit=true},
|
||||
require_pos = 1,
|
||||
parse = check_pyramid,
|
||||
nodes_needed = function(name, axis, height, node)
|
||||
nodes_needed = function(_, _, height)
|
||||
return math.ceil(((height * 2 + 1) ^ 2) * height / 3)
|
||||
end,
|
||||
func = function(name, axis, height, node)
|
||||
@ -901,7 +901,7 @@ worldedit.register_command("spiral", {
|
||||
end
|
||||
return true, tonumber(length), tonumber(height), tonumber(space), node
|
||||
end,
|
||||
nodes_needed = function(name, length, height, space, node)
|
||||
nodes_needed = function(_, length, height, space)
|
||||
return (length + space) * height -- TODO: this is not the upper bound
|
||||
end,
|
||||
func = function(name, length, height, space, node)
|
||||
@ -922,7 +922,7 @@ worldedit.register_command("copy", {
|
||||
end
|
||||
return true, axis, tonumber(amount)
|
||||
end,
|
||||
nodes_needed = function(name, axis, amount)
|
||||
nodes_needed = function(name)
|
||||
return check_region(name) * 2
|
||||
end,
|
||||
func = function(name, axis, amount)
|
||||
@ -949,7 +949,7 @@ worldedit.register_command("move", {
|
||||
end
|
||||
return true, axis, tonumber(amount)
|
||||
end,
|
||||
nodes_needed = function(name, axis, amount)
|
||||
nodes_needed = function(name)
|
||||
return check_region(name) * 2
|
||||
end,
|
||||
func = function(name, axis, amount)
|
||||
@ -981,7 +981,7 @@ worldedit.register_command("stack", {
|
||||
end
|
||||
return true, axis, tonumber(repetitions)
|
||||
end,
|
||||
nodes_needed = function(name, axis, repetitions)
|
||||
nodes_needed = function(name, _, repetitions)
|
||||
return check_region(name) * math.abs(repetitions)
|
||||
end,
|
||||
func = function(name, axis, repetitions)
|
||||
@ -1016,7 +1016,7 @@ worldedit.register_command("stack2", {
|
||||
|
||||
return true, tonumber(repetitions), {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
||||
end,
|
||||
nodes_needed = function(name, repetitions, offset)
|
||||
nodes_needed = function(name, repetitions)
|
||||
return check_region(name) * repetitions
|
||||
end,
|
||||
func = function(name, repetitions, offset)
|
||||
@ -1480,7 +1480,7 @@ worldedit.register_command("load", {
|
||||
minetest.get_worldpath() .. "/schems/" .. param .. ".wem",
|
||||
}
|
||||
local file, err
|
||||
for index, path in ipairs(testpaths) do
|
||||
for _, path in ipairs(testpaths) do
|
||||
file, err = io.open(path, "rb")
|
||||
if not err then
|
||||
break
|
||||
@ -1633,7 +1633,7 @@ worldedit.register_command("mtschemprob", {
|
||||
if problist == nil then
|
||||
return
|
||||
end
|
||||
for k,v in pairs(problist) do
|
||||
for _,v in pairs(problist) do
|
||||
local prob = math.floor(((v.prob / 256) * 100) * 100 + 0.5) / 100
|
||||
text = text .. minetest.pos_to_string(v.pos) .. ": " .. prob .. "% | "
|
||||
end
|
||||
|
@ -134,17 +134,17 @@ minetest.register_entity(":worldedit:pos1", {
|
||||
physical = false,
|
||||
static_save = false,
|
||||
},
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
on_activate = function(self, staticdata)
|
||||
if staticdata ~= init_sentinel then
|
||||
-- we were loaded from before static_save = false was added
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
on_punch = function(self, hitter)
|
||||
on_punch = function(self)
|
||||
self.object:remove()
|
||||
worldedit.marker1[self.player_name] = nil
|
||||
end,
|
||||
on_blast = function(self, damage)
|
||||
on_blast = function()
|
||||
return false, false, {} -- don't damage or knockback
|
||||
end,
|
||||
})
|
||||
@ -160,17 +160,17 @@ minetest.register_entity(":worldedit:pos2", {
|
||||
physical = false,
|
||||
static_save = false,
|
||||
},
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
on_activate = function(self, staticdata)
|
||||
if staticdata ~= init_sentinel then
|
||||
-- we were loaded from before static_save = false was added
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
on_punch = function(self, hitter)
|
||||
on_punch = function(self)
|
||||
self.object:remove()
|
||||
worldedit.marker2[self.player_name] = nil
|
||||
end,
|
||||
on_blast = function(self, damage)
|
||||
on_blast = function()
|
||||
return false, false, {} -- don't damage or knockback
|
||||
end,
|
||||
})
|
||||
@ -183,13 +183,13 @@ minetest.register_entity(":worldedit:region_cube", {
|
||||
physical = false,
|
||||
static_save = false,
|
||||
},
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
on_activate = function(self, staticdata)
|
||||
if staticdata ~= init_sentinel then
|
||||
-- we were loaded from before static_save = false was added
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
on_punch = function(self, hitter)
|
||||
on_punch = function(self)
|
||||
local markers = worldedit.marker_region[self.player_name]
|
||||
if not markers then
|
||||
return
|
||||
@ -199,7 +199,7 @@ minetest.register_entity(":worldedit:region_cube", {
|
||||
end
|
||||
worldedit.marker_region[self.player_name] = nil
|
||||
end,
|
||||
on_blast = function(self, damage)
|
||||
on_blast = function()
|
||||
return false, false, {} -- don't damage or knockback
|
||||
end,
|
||||
})
|
||||
|
@ -14,7 +14,7 @@ minetest.register_tool(":worldedit:wand", {
|
||||
stack_max = 1, -- there is no need to have more than one
|
||||
liquids_pointable = true, -- ground with only water on can be selected as well
|
||||
|
||||
on_use = function(itemstack, placer, pointed_thing)
|
||||
on_use = function(_, placer, pointed_thing)
|
||||
if placer == nil or pointed_thing == nil then return end
|
||||
local name = placer:get_player_name()
|
||||
if pointed_thing.type == "node" then
|
||||
|
Reference in New Issue
Block a user