From 5a8bcc493d4d11d0598319737f1d2f50f51cb945 Mon Sep 17 00:00:00 2001 From: MistUnky Date: Sat, 27 Mar 2021 09:08:12 -0400 Subject: [PATCH] Update away from deprecated functions for 5.x use, if 0.4.x use old commit --- mods/creative/init.lua | 12 ++++++------ mods/intersecting/init.lua | 12 ++++++------ mods/nethermp/nether/portal.lua | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mods/creative/init.lua b/mods/creative/init.lua index 45b7a22..4687f4c 100644 --- a/mods/creative/init.lua +++ b/mods/creative/init.lua @@ -7,7 +7,7 @@ creative_inventory.creative_inventory_size = 0 minetest.after(0, function() local inv = minetest.create_detached_inventory("creative", { allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - if minetest.setting_getbool("creative_mode") then + if minetest.settings:get_bool("creative_mode") then return count else return 0 @@ -17,7 +17,7 @@ minetest.after(0, function() return 0 end, allow_take = function(inv, listname, index, stack, player) - if minetest.setting_getbool("creative_mode") then + if minetest.settings:get_bool("creative_mode") then return -1 else return 0 @@ -55,7 +55,7 @@ local trash = minetest.create_detached_inventory("creative_trash", { -- Allow the stack to be placed and remove it in on_put() -- This allows the creative inventory to restore the stack allow_put = function(inv, listname, index, stack, player) - if minetest.setting_getbool("creative_mode") then + if minetest.settings:get_bool("creative_mode") then return stack:get_count() else return 0 @@ -85,13 +85,13 @@ creative_inventory.set_creative_formspec = function(player, start_i, pagenum) end minetest.register_on_joinplayer(function(player) -- If in creative mode, modify player's inventory forms - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then return end creative_inventory.set_creative_formspec(player, 0, 1) end) minetest.register_on_player_receive_fields(function(player, formname, fields) - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then return end -- Figure out current page from formspec @@ -121,7 +121,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1) end) -if minetest.setting_getbool("creative_mode") then +if minetest.settings:get_bool("creative_mode") then minetest.register_item(":", { type = "none", diff --git a/mods/intersecting/init.lua b/mods/intersecting/init.lua index 2489353..31ddd07 100644 --- a/mods/intersecting/init.lua +++ b/mods/intersecting/init.lua @@ -165,12 +165,12 @@ minetest.register_on_generated(function(minp, maxp, seed) nobj_webe = nobj_webe or minetest.get_perlin_map(np_webe, chulens) nobj_biome = nobj_biome or minetest.get_perlin_map(np_biome, chulens) - local nvals_weba = nobj_weba:get3dMap_flat(minposxyz) - local nvals_webb = nobj_webb:get3dMap_flat(minposxyz) - local nvals_webc = nobj_webc:get3dMap_flat(minposxyz) - local nvals_webd = nobj_webd:get3dMap_flat(minposxyz) - local nvals_webe = nobj_webe:get3dMap_flat(minposxyz) - local nvals_biome = nobj_biome:get3dMap_flat(minposxyz) + local nvals_weba = nobj_weba:get_3d_map_flat(minposxyz) + local nvals_webb = nobj_webb:get_3d_map_flat(minposxyz) + local nvals_webc = nobj_webc:get_3d_map_flat(minposxyz) + local nvals_webd = nobj_webd:get_3d_map_flat(minposxyz) + local nvals_webe = nobj_webe:get_3d_map_flat(minposxyz) + local nvals_biome = nobj_biome:get_3d_map_flat(minposxyz) local cavbel = {} --local stobel = {} diff --git a/mods/nethermp/nether/portal.lua b/mods/nethermp/nether/portal.lua index 79e059f..4dfcc45 100644 --- a/mods/nethermp/nether/portal.lua +++ b/mods/nethermp/nether/portal.lua @@ -72,7 +72,7 @@ end -- where the player appears after dying local function get_player_died_target(player) - local target = vector.add(player:getpos(), + local target = vector.add(player:get_pos(), {x=math.random(-100,100), y=0, z=math.random(-100,100)}) target.y = portal_target + math.random(4) return target @@ -172,7 +172,7 @@ minetest.register_chatcommand("from_hell", { return false, "Something went wrong." end minetest.chat_send_player(pname, "You are free now") - local pos = player:getpos() + local pos = player:get_pos() player_from_nether(player, {x=pos.x, y=100, z=pos.z}) return true, pname.." is now out of the nether." end @@ -246,7 +246,7 @@ if nether_prisons then local metatable_overridden minetest.register_on_joinplayer(function(player) -- set the background when the player joins - if player:getpos().y < nether.start then + if player:get_pos().y < nether.start then update_background(player, true) end @@ -270,7 +270,7 @@ else -- test if player is in nether when he/she joins minetest.register_on_joinplayer(function(player) players_in_nether[player:get_player_name()] = - player:getpos().y < nether.start or nil + player:get_pos().y < nether.start or nil end) end @@ -310,7 +310,7 @@ local function obsi_teleport_player(player, pos, target) return end - local objpos = player:getpos() + local objpos = player:get_pos() objpos.y = objpos.y+0.1 -- Fix some glitches at -8000 if minetest.get_node(vector.round(objpos)).name ~= "nether:portal" then return