Revert "Update away from deprecated functions for 5.x use, if 0.4.x use old commit"

Due to breakage and nil errors
This reverts commit 5a8bcc493d4d11d0598319737f1d2f50f51cb945.
This commit is contained in:
MistUnky 2021-03-27 12:02:02 -04:00
parent 5a8bcc493d
commit 66f01ec5cb
3 changed files with 17 additions and 17 deletions

View File

@ -7,7 +7,7 @@ creative_inventory.creative_inventory_size = 0
minetest.after(0, function() minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", { local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.settings:get_bool("creative_mode") then if minetest.setting_getbool("creative_mode") then
return count return count
else else
return 0 return 0
@ -17,7 +17,7 @@ minetest.after(0, function()
return 0 return 0
end, end,
allow_take = function(inv, listname, index, stack, player) allow_take = function(inv, listname, index, stack, player)
if minetest.settings:get_bool("creative_mode") then if minetest.setting_getbool("creative_mode") then
return -1 return -1
else else
return 0 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() -- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack -- This allows the creative inventory to restore the stack
allow_put = function(inv, listname, index, stack, player) allow_put = function(inv, listname, index, stack, player)
if minetest.settings:get_bool("creative_mode") then if minetest.setting_getbool("creative_mode") then
return stack:get_count() return stack:get_count()
else else
return 0 return 0
@ -85,13 +85,13 @@ creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
end end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms -- If in creative mode, modify player's inventory forms
if not minetest.settings:get_bool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
return return
end end
creative_inventory.set_creative_formspec(player, 0, 1) creative_inventory.set_creative_formspec(player, 0, 1)
end) end)
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.settings:get_bool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
return return
end end
-- Figure out current page from formspec -- 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) creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
end) end)
if minetest.settings:get_bool("creative_mode") then if minetest.setting_getbool("creative_mode") then
minetest.register_item(":", { minetest.register_item(":", {
type = "none", type = "none",

View File

@ -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_webe = nobj_webe or minetest.get_perlin_map(np_webe, chulens)
nobj_biome = nobj_biome or minetest.get_perlin_map(np_biome, chulens) nobj_biome = nobj_biome or minetest.get_perlin_map(np_biome, chulens)
local nvals_weba = nobj_weba:get_3d_map_flat(minposxyz) local nvals_weba = nobj_weba:get3dMap_flat(minposxyz)
local nvals_webb = nobj_webb:get_3d_map_flat(minposxyz) local nvals_webb = nobj_webb:get3dMap_flat(minposxyz)
local nvals_webc = nobj_webc:get_3d_map_flat(minposxyz) local nvals_webc = nobj_webc:get3dMap_flat(minposxyz)
local nvals_webd = nobj_webd:get_3d_map_flat(minposxyz) local nvals_webd = nobj_webd:get3dMap_flat(minposxyz)
local nvals_webe = nobj_webe:get_3d_map_flat(minposxyz) local nvals_webe = nobj_webe:get3dMap_flat(minposxyz)
local nvals_biome = nobj_biome:get_3d_map_flat(minposxyz) local nvals_biome = nobj_biome:get3dMap_flat(minposxyz)
local cavbel = {} local cavbel = {}
--local stobel = {} --local stobel = {}

View File

@ -72,7 +72,7 @@ end
-- where the player appears after dying -- where the player appears after dying
local function get_player_died_target(player) local function get_player_died_target(player)
local target = vector.add(player:get_pos(), local target = vector.add(player:getpos(),
{x=math.random(-100,100), y=0, z=math.random(-100,100)}) {x=math.random(-100,100), y=0, z=math.random(-100,100)})
target.y = portal_target + math.random(4) target.y = portal_target + math.random(4)
return target return target
@ -172,7 +172,7 @@ minetest.register_chatcommand("from_hell", {
return false, "Something went wrong." return false, "Something went wrong."
end end
minetest.chat_send_player(pname, "You are free now") minetest.chat_send_player(pname, "You are free now")
local pos = player:get_pos() local pos = player:getpos()
player_from_nether(player, {x=pos.x, y=100, z=pos.z}) player_from_nether(player, {x=pos.x, y=100, z=pos.z})
return true, pname.." is now out of the nether." return true, pname.." is now out of the nether."
end end
@ -246,7 +246,7 @@ if nether_prisons then
local metatable_overridden local metatable_overridden
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
-- set the background when the player joins -- set the background when the player joins
if player:get_pos().y < nether.start then if player:getpos().y < nether.start then
update_background(player, true) update_background(player, true)
end end
@ -270,7 +270,7 @@ else
-- test if player is in nether when he/she joins -- test if player is in nether when he/she joins
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
players_in_nether[player:get_player_name()] = players_in_nether[player:get_player_name()] =
player:get_pos().y < nether.start or nil player:getpos().y < nether.start or nil
end) end)
end end
@ -310,7 +310,7 @@ local function obsi_teleport_player(player, pos, target)
return return
end end
local objpos = player:get_pos() local objpos = player:getpos()
objpos.y = objpos.y+0.1 -- Fix some glitches at -8000 objpos.y = objpos.y+0.1 -- Fix some glitches at -8000
if minetest.get_node(vector.round(objpos)).name ~= "nether:portal" then if minetest.get_node(vector.round(objpos)).name ~= "nether:portal" then
return return