Fix many, many warnings
This commit is contained in:
parent
69bb0e4185
commit
08879e9c28
|
@ -2,16 +2,16 @@
|
|||
worldedit.cuboid_volumetric_expand = function(name, amount)
|
||||
local pos1 = worldedit.pos1[name]
|
||||
local pos2 = worldedit.pos2[name]
|
||||
|
||||
|
||||
if pos1 == nil or pos2 == nil then
|
||||
return false, "Undefined cuboid"
|
||||
end
|
||||
|
||||
|
||||
local delta1 = vector.new()
|
||||
local delta2 = vector.new()
|
||||
local delta_dir1
|
||||
local delta_dir2
|
||||
|
||||
|
||||
delta1 = vector.add(delta1, amount)
|
||||
delta2 = vector.add(delta2, amount)
|
||||
delta_dir1, delta_dir2 = worldedit.get_expansion_directions(pos1, pos2)
|
||||
|
@ -19,7 +19,7 @@ worldedit.cuboid_volumetric_expand = function(name, amount)
|
|||
delta2 = vector.multiply(delta2, delta_dir2)
|
||||
worldedit.pos1[name] = vector.add(pos1, delta1)
|
||||
worldedit.pos2[name] = vector.add(pos2, delta2)
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -28,18 +28,18 @@ end
|
|||
worldedit.cuboid_linear_expand = function(name, axis, direction, amount)
|
||||
local pos1 = worldedit.pos1[name]
|
||||
local pos2 = worldedit.pos2[name]
|
||||
|
||||
|
||||
if pos1 == nil or pos2 == nil then
|
||||
return false, "undefined cuboid"
|
||||
end
|
||||
|
||||
|
||||
if direction ~= 1 and direction ~= -1 then
|
||||
return false, "invalid marker"
|
||||
end
|
||||
|
||||
|
||||
local marker = worldedit.marker_get_closest_to_axis(name, axis, direction)
|
||||
local deltavect = vector.new()
|
||||
|
||||
|
||||
if axis == 'x' then
|
||||
deltavect.x = amount * direction
|
||||
elseif axis == 'y' then
|
||||
|
@ -49,21 +49,20 @@ worldedit.cuboid_linear_expand = function(name, axis, direction, amount)
|
|||
else
|
||||
return false, "invalid axis"
|
||||
end
|
||||
|
||||
|
||||
worldedit.marker_move(name, marker, deltavect)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
-- Shifts the cuboid by '+-amount' in axis 'axis'
|
||||
worldedit.cuboid_shift = function(name, axis, amount)
|
||||
local pos1 = worldedit.pos1[name]
|
||||
local pos2 = worldedit.pos2[name]
|
||||
|
||||
|
||||
if pos1 == nil or pos2 == nil then
|
||||
return false, "undefined cuboid"
|
||||
end
|
||||
|
||||
|
||||
if axis == 'x' then
|
||||
worldedit.pos1[name].x = pos1.x + amount
|
||||
worldedit.pos2[name].x = pos2.x + amount
|
||||
|
@ -76,7 +75,7 @@ worldedit.cuboid_shift = function(name, axis, amount)
|
|||
else
|
||||
return false, "invalid axis"
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -86,7 +85,7 @@ worldedit.marker_move = function(name, marker, deltavector)
|
|||
if marker ~= 1 and marker ~= 2 then
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
if marker == 1 then
|
||||
local pos = worldedit.pos1[name]
|
||||
worldedit.pos1[name] = vector.add(deltavector, pos)
|
||||
|
@ -94,7 +93,7 @@ worldedit.marker_move = function(name, marker, deltavector)
|
|||
local pos = worldedit.pos2[name]
|
||||
worldedit.pos2[name] = vector.add(deltavector, pos)
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -113,7 +112,6 @@ worldedit.marker_update = function(name, marker)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
-- Returns two vectors with the directions for volumetric expansion
|
||||
worldedit.get_expansion_directions = function(mark1, mark2)
|
||||
if mark1 == nil or mark2 == nil then
|
||||
|
@ -146,13 +144,12 @@ worldedit.get_expansion_directions = function(mark1, mark2)
|
|||
return dir1, dir2
|
||||
end
|
||||
|
||||
|
||||
-- Return the marker that is closest to the player
|
||||
worldedit.marker_get_closest_to_player = function(name)
|
||||
local playerpos = minetest.get_player_by_name(name):get_pos()
|
||||
local dist1 = vector.distance(playerpos, worldedit.pos1[name])
|
||||
local dist2 = vector.distance(playerpos, worldedit.pos2[name])
|
||||
|
||||
|
||||
if dist1 < dist2 then
|
||||
return 1
|
||||
else
|
||||
|
@ -160,12 +157,11 @@ worldedit.marker_get_closest_to_player = function(name)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
-- Returns the closest marker to the specified axis and direction
|
||||
worldedit.marker_get_closest_to_axis = function(name, axis, direction)
|
||||
local pos1 = vector.new()
|
||||
local pos2 = vector.new()
|
||||
|
||||
|
||||
if direction ~= 1 and direction ~= -1 then
|
||||
return nil
|
||||
end
|
||||
|
@ -199,21 +195,20 @@ worldedit.marker_get_closest_to_axis = function(name, axis, direction)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
-- Translates up, down, left, right, front, back to their corresponding axes and
|
||||
-- Translates up, down, left, right, front, back to their corresponding axes and
|
||||
-- directions according to faced direction
|
||||
worldedit.translate_direction = function(name, direction)
|
||||
local axis, dir = worldedit.player_axis(name)
|
||||
local resaxis, resdir
|
||||
|
||||
|
||||
if direction == "up" then
|
||||
return 'y', 1
|
||||
end
|
||||
|
||||
|
||||
if direction == "down" then
|
||||
return 'y', -1
|
||||
end
|
||||
|
||||
|
||||
if direction == "front" then
|
||||
if axis == "y" then
|
||||
resaxis = nil
|
||||
|
@ -223,7 +218,7 @@ worldedit.translate_direction = function(name, direction)
|
|||
resdir = dir
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if direction == "back" then
|
||||
if axis == "y" then
|
||||
resaxis = nil
|
||||
|
@ -233,7 +228,7 @@ worldedit.translate_direction = function(name, direction)
|
|||
resdir = -dir
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if direction == "left" then
|
||||
if axis == 'x' then
|
||||
resaxis = 'z'
|
||||
|
@ -243,7 +238,7 @@ worldedit.translate_direction = function(name, direction)
|
|||
resdir = -dir
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if direction == "right" then
|
||||
if axis == 'x' then
|
||||
resaxis = 'z'
|
||||
|
@ -253,6 +248,6 @@ worldedit.translate_direction = function(name, direction)
|
|||
resdir = dir
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return resaxis, resdir
|
||||
end
|
||||
|
|
|
@ -15,8 +15,6 @@ local ver = {major=1, minor=2}
|
|||
worldedit.version = ver
|
||||
worldedit.version_string = string.format("%d.%d", ver.major, ver.minor)
|
||||
|
||||
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
local function load_module(path)
|
||||
local file = io.open(path, "r")
|
||||
if not file then return end
|
||||
|
@ -24,6 +22,8 @@ local function load_module(path)
|
|||
return dofile(path)
|
||||
end
|
||||
|
||||
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
dofile(path .. "/common.lua")
|
||||
load_module(path .. "/manipulations.lua")
|
||||
load_module(path .. "/primitives.lua")
|
||||
|
|
|
@ -217,8 +217,6 @@ function worldedit.copy2(pos1, pos2, off, meta_backwards)
|
|||
dst_manip:set_param2_data(dst_data)
|
||||
|
||||
mh.finish(dst_manip)
|
||||
src_data = nil
|
||||
dst_data = nil
|
||||
|
||||
-- Copy metadata
|
||||
local get_meta = minetest.get_meta
|
||||
|
|
|
@ -299,7 +299,6 @@ function worldedit.spiral(pos, length, height, spacer, node_name)
|
|||
for index = 1, segment_length do
|
||||
-- Move along the direction of the segment
|
||||
i = i + stride_axis * sign
|
||||
local column = i
|
||||
-- Add column
|
||||
for y = 1, height do
|
||||
data[column] = node_id
|
||||
|
@ -314,7 +313,6 @@ function worldedit.spiral(pos, length, height, spacer, node_name)
|
|||
sign = -sign
|
||||
for index = 1, segment_length do
|
||||
i = i + stride_axis * sign
|
||||
local column = i
|
||||
-- Add column
|
||||
for y = 1, height do
|
||||
data[column] = node_id
|
||||
|
|
|
@ -45,14 +45,14 @@ local function chatcommand_handler(cmd_name, name, param)
|
|||
if def.nodes_needed then
|
||||
local count = def.nodes_needed(name, unpack(parsed))
|
||||
safe_region(name, count, function()
|
||||
local success, msg = def.func(name, unpack(parsed))
|
||||
local msg = def.func(name, unpack(parsed))
|
||||
if msg then
|
||||
minetest.chat_send_player(name, msg)
|
||||
end
|
||||
end)
|
||||
else
|
||||
-- no "safe region" check
|
||||
local success, msg = def.func(name, unpack(parsed))
|
||||
local msg = def.func(name, unpack(parsed))
|
||||
if msg then
|
||||
minetest.chat_send_player(name, msg)
|
||||
end
|
||||
|
@ -64,7 +64,7 @@ end
|
|||
-- def = {
|
||||
-- privs = {}, -- Privileges needed
|
||||
-- params = "", -- Human readable parameter list (optional)
|
||||
-- -- setting params = "" will automatically provide a parse() if not given
|
||||
-- -- setting params = "" will automatically provide a parse() if not given
|
||||
-- description = "", -- Description
|
||||
-- require_pos = 0, -- Number of positions required to be set (optional)
|
||||
-- parse = function(param)
|
||||
|
@ -243,7 +243,6 @@ worldedit.register_command("help", {
|
|||
return false, "You are not allowed to use any WorldEdit commands."
|
||||
end
|
||||
if param == "" then
|
||||
local msg = ""
|
||||
local cmds = {}
|
||||
for cmd, def in pairs(worldedit.registered_commands) do
|
||||
if minetest.check_player_privs(name, def.privs) then
|
||||
|
@ -824,7 +823,7 @@ local check_pyramid = function(param)
|
|||
end
|
||||
return true, axis, tonumber(height), node
|
||||
end
|
||||
|
||||
|
||||
worldedit.register_command("hollowpyramid", {
|
||||
params = "x/y/z/? <height> <node>",
|
||||
description = "Add hollow pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height <height>, composed of <node>",
|
||||
|
|
|
@ -4,11 +4,11 @@ worldedit = worldedit or {}
|
|||
Example:
|
||||
|
||||
worldedit.register_gui_function("worldedit_gui_hollow_cylinder", {
|
||||
name = "Make Hollow Cylinder",
|
||||
privs = {worldedit=true},
|
||||
get_formspec = function(name) return "some formspec here" end,
|
||||
on_select = function(name) print(name .. " clicked the button!") end,
|
||||
})
|
||||
name = "Make Hollow Cylinder",
|
||||
privs = {worldedit=true},
|
||||
get_formspec = function(name) return "some formspec here" end,
|
||||
on_select = function(name) print(name .. " clicked the button!") end,
|
||||
})
|
||||
|
||||
Use `nil` for the `options` parameter to unregister the function associated with the given identifier.
|
||||
|
||||
|
@ -35,7 +35,7 @@ end
|
|||
Example:
|
||||
|
||||
worldedit.register_gui_handler("worldedit_gui_hollow_cylinder", function(name, fields)
|
||||
print(minetest.serialize(fields))
|
||||
print(minetest.serialize(fields))
|
||||
end)
|
||||
]]
|
||||
|
||||
|
@ -88,7 +88,7 @@ if minetest.global_exists("unified_inventory") then -- unified inventory install
|
|||
worldedit.show_page(name, "worldedit_gui")
|
||||
return true
|
||||
elseif fields.worldedit_gui_exit then --return to original page
|
||||
local player = minetest.get_player_by_name(name)
|
||||
player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
unified_inventory.set_inventory_formspec(player, "craft")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue