1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2025-07-04 09:00:36 +02:00

Fix many, many warnings

This commit is contained in:
Panquesito7
2020-02-06 19:42:52 -06:00
parent 69bb0e4185
commit 08879e9c28
6 changed files with 37 additions and 47 deletions

View File

@ -54,7 +54,6 @@ worldedit.cuboid_linear_expand = function(name, axis, direction, amount)
return true return true
end end
-- Shifts the cuboid by '+-amount' in axis 'axis' -- Shifts the cuboid by '+-amount' in axis 'axis'
worldedit.cuboid_shift = function(name, axis, amount) worldedit.cuboid_shift = function(name, axis, amount)
local pos1 = worldedit.pos1[name] local pos1 = worldedit.pos1[name]
@ -113,7 +112,6 @@ worldedit.marker_update = function(name, marker)
end end
end end
-- Returns two vectors with the directions for volumetric expansion -- Returns two vectors with the directions for volumetric expansion
worldedit.get_expansion_directions = function(mark1, mark2) worldedit.get_expansion_directions = function(mark1, mark2)
if mark1 == nil or mark2 == nil then if mark1 == nil or mark2 == nil then
@ -146,7 +144,6 @@ worldedit.get_expansion_directions = function(mark1, mark2)
return dir1, dir2 return dir1, dir2
end end
-- Return the marker that is closest to the player -- Return the marker that is closest to the player
worldedit.marker_get_closest_to_player = function(name) worldedit.marker_get_closest_to_player = function(name)
local playerpos = minetest.get_player_by_name(name):get_pos() local playerpos = minetest.get_player_by_name(name):get_pos()
@ -160,7 +157,6 @@ worldedit.marker_get_closest_to_player = function(name)
end end
end end
-- Returns the closest marker to the specified axis and direction -- Returns the closest marker to the specified axis and direction
worldedit.marker_get_closest_to_axis = function(name, axis, direction) worldedit.marker_get_closest_to_axis = function(name, axis, direction)
local pos1 = vector.new() local pos1 = vector.new()
@ -199,7 +195,6 @@ worldedit.marker_get_closest_to_axis = function(name, axis, direction)
end end
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 -- directions according to faced direction
worldedit.translate_direction = function(name, direction) worldedit.translate_direction = function(name, direction)

View File

@ -15,8 +15,6 @@ local ver = {major=1, minor=2}
worldedit.version = ver worldedit.version = ver
worldedit.version_string = string.format("%d.%d", ver.major, ver.minor) 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 function load_module(path)
local file = io.open(path, "r") local file = io.open(path, "r")
if not file then return end if not file then return end
@ -24,6 +22,8 @@ local function load_module(path)
return dofile(path) return dofile(path)
end end
local path = minetest.get_modpath(minetest.get_current_modname())
dofile(path .. "/common.lua") dofile(path .. "/common.lua")
load_module(path .. "/manipulations.lua") load_module(path .. "/manipulations.lua")
load_module(path .. "/primitives.lua") load_module(path .. "/primitives.lua")

View File

@ -217,8 +217,6 @@ function worldedit.copy2(pos1, pos2, off, meta_backwards)
dst_manip:set_param2_data(dst_data) dst_manip:set_param2_data(dst_data)
mh.finish(dst_manip) mh.finish(dst_manip)
src_data = nil
dst_data = nil
-- Copy metadata -- Copy metadata
local get_meta = minetest.get_meta local get_meta = minetest.get_meta

View File

@ -299,7 +299,6 @@ function worldedit.spiral(pos, length, height, spacer, node_name)
for index = 1, segment_length do for index = 1, segment_length do
-- Move along the direction of the segment -- Move along the direction of the segment
i = i + stride_axis * sign i = i + stride_axis * sign
local column = i
-- Add column -- Add column
for y = 1, height do for y = 1, height do
data[column] = node_id data[column] = node_id
@ -314,7 +313,6 @@ function worldedit.spiral(pos, length, height, spacer, node_name)
sign = -sign sign = -sign
for index = 1, segment_length do for index = 1, segment_length do
i = i + stride_axis * sign i = i + stride_axis * sign
local column = i
-- Add column -- Add column
for y = 1, height do for y = 1, height do
data[column] = node_id data[column] = node_id

View File

@ -45,14 +45,14 @@ local function chatcommand_handler(cmd_name, name, param)
if def.nodes_needed then if def.nodes_needed then
local count = def.nodes_needed(name, unpack(parsed)) local count = def.nodes_needed(name, unpack(parsed))
safe_region(name, count, function() safe_region(name, count, function()
local success, msg = def.func(name, unpack(parsed)) local msg = def.func(name, unpack(parsed))
if msg then if msg then
minetest.chat_send_player(name, msg) minetest.chat_send_player(name, msg)
end end
end) end)
else else
-- no "safe region" check -- no "safe region" check
local success, msg = def.func(name, unpack(parsed)) local msg = def.func(name, unpack(parsed))
if msg then if msg then
minetest.chat_send_player(name, msg) minetest.chat_send_player(name, msg)
end end
@ -243,7 +243,6 @@ worldedit.register_command("help", {
return false, "You are not allowed to use any WorldEdit commands." return false, "You are not allowed to use any WorldEdit commands."
end end
if param == "" then if param == "" then
local msg = ""
local cmds = {} local cmds = {}
for cmd, def in pairs(worldedit.registered_commands) do for cmd, def in pairs(worldedit.registered_commands) do
if minetest.check_player_privs(name, def.privs) then if minetest.check_player_privs(name, def.privs) then

View File

@ -4,11 +4,11 @@ worldedit = worldedit or {}
Example: Example:
worldedit.register_gui_function("worldedit_gui_hollow_cylinder", { worldedit.register_gui_function("worldedit_gui_hollow_cylinder", {
name = "Make Hollow Cylinder", name = "Make Hollow Cylinder",
privs = {worldedit=true}, privs = {worldedit=true},
get_formspec = function(name) return "some formspec here" end, get_formspec = function(name) return "some formspec here" end,
on_select = function(name) print(name .. " clicked the button!") 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. Use `nil` for the `options` parameter to unregister the function associated with the given identifier.
@ -35,7 +35,7 @@ end
Example: Example:
worldedit.register_gui_handler("worldedit_gui_hollow_cylinder", function(name, fields) worldedit.register_gui_handler("worldedit_gui_hollow_cylinder", function(name, fields)
print(minetest.serialize(fields)) print(minetest.serialize(fields))
end) end)
]] ]]
@ -88,7 +88,7 @@ if minetest.global_exists("unified_inventory") then -- unified inventory install
worldedit.show_page(name, "worldedit_gui") worldedit.show_page(name, "worldedit_gui")
return true return true
elseif fields.worldedit_gui_exit then --return to original page 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 if player then
unified_inventory.set_inventory_formspec(player, "craft") unified_inventory.set_inventory_formspec(player, "craft")
end end