Replace deprecated functions with newer ones

These commits create compatibility with MT/MTG 5.0.0+.
However, these commits may/will break with the 0.4-series.
This commit is contained in:
Panquesito7 2019-06-16 13:30:56 -05:00 committed by sfan5
parent 40b49ee9bc
commit 3ffecdd9c4
9 changed files with 16 additions and 5 deletions

2
modpack.conf Normal file
View File

@ -0,0 +1,2 @@
name = Minetest-WorldEdit
description = WorldEdit is an in-game world editor. Use it to repair griefing, or just create awesome buildings in seconds.

View File

View File

@ -149,7 +149,7 @@ 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):getpos() local playerpos = minetest.get_player_by_name(name):get_pos()
local dist1 = vector.distance(playerpos, worldedit.pos1[name]) local dist1 = vector.distance(playerpos, worldedit.pos1[name])
local dist2 = vector.distance(playerpos, worldedit.pos2[name]) local dist2 = vector.distance(playerpos, worldedit.pos2[name])
@ -255,4 +255,4 @@ worldedit.translate_direction = function(name, direction)
end end
return resaxis, resdir return resaxis, resdir
end end

View File

@ -638,7 +638,7 @@ function worldedit.clear_objects(pos1, pos2)
-- Avoid players and WorldEdit entities -- Avoid players and WorldEdit entities
if not obj:is_player() and (not entity or if not obj:is_player() and (not entity or
not entity.name:find("^worldedit:")) then not entity.name:find("^worldedit:")) then
local pos = obj:getpos() local pos = obj:get_pos()
if pos.x >= pos1x and pos.x <= pos2x and if pos.x >= pos1x and pos.x <= pos2x and
pos.y >= pos1y and pos.y <= pos2y and pos.y >= pos1y and pos.y <= pos2y and
pos.z >= pos1z and pos.z <= pos2z then pos.z >= pos1z and pos.z <= pos2z then

2
worldedit_brush/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = worldedit_brush
depends = worldedit, worldedit_commands

View File

@ -257,7 +257,7 @@ minetest.register_chatcommand("/pos1", {
description = "Set WorldEdit region position 1 to the player's location", description = "Set WorldEdit region position 1 to the player's location",
privs = {worldedit=true}, privs = {worldedit=true},
func = function(name, param) func = function(name, param)
local pos = minetest.get_player_by_name(name):getpos() local pos = minetest.get_player_by_name(name):get_pos()
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5) pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
worldedit.pos1[name] = pos worldedit.pos1[name] = pos
worldedit.mark_pos1(name) worldedit.mark_pos1(name)
@ -270,7 +270,7 @@ minetest.register_chatcommand("/pos2", {
description = "Set WorldEdit region position 2 to the player's location", description = "Set WorldEdit region position 2 to the player's location",
privs = {worldedit=true}, privs = {worldedit=true},
func = function(name, param) func = function(name, param)
local pos = minetest.get_player_by_name(name):getpos() local pos = minetest.get_player_by_name(name):get_pos()
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5) pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
worldedit.pos2[name] = pos worldedit.pos2[name] = pos
worldedit.mark_pos2(name) worldedit.mark_pos2(name)

View File

@ -0,0 +1,2 @@
name = worldedit_commands
depends = worldedit

3
worldedit_gui/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = worldedit_gui
depends = worldedit, worldedit_commands
optional_depends = unified_inventory, inventory_plus, sfinv, creative, smart_inventory

View File

@ -0,0 +1,2 @@
name = worldedit_shortcommands
depends = worldedit_commands