Replace deprecated function names (e.g. moveto -> move_to) and make stairs optional

This commit is contained in:
HybridDog 2022-08-20 19:57:09 +02:00
parent 435cef6f81
commit f12d33c743
5 changed files with 25 additions and 20 deletions

View File

@ -4,7 +4,7 @@ read_globals = {
"string", "string",
-- Mods -- Mods
"default", "stairs", "creative" "default", "stairs"
} }
globals = {"nether"} globals = {"nether"}
ignore = { ignore = {

View File

@ -4,20 +4,27 @@ local nether_sound = default.node_sound_stone_defaults({
footstep = {name="nether_footstep", gain=0.4} footstep = {name="nether_footstep", gain=0.4}
}) })
-- The fence registration function from fence_registration
local add_fence = minetest.register_fence local add_fence = minetest.register_fence
local stairs_exist = minetest.global_exists("stairs")
-- A function which registers a fence and stairs nodes for a nether node if the
-- mods for these node registrations are available
local function add_more_nodes(name) local function add_more_nodes(name)
local nd = "nether:"..name local nd = "nether:"..name
if not string.find(name, "nether") then if not string.find(name, "nether") then
name = "nether_"..name name = "nether_"..name
end end
local data = minetest.registered_nodes[nd] local data = minetest.registered_nodes[nd]
stairs.register_stair_and_slab(name, nd, if stairs_exist then
data.groups, stairs.register_stair_and_slab(name, nd,
data.tiles, data.groups,
data.description.." Stair", data.tiles,
data.description.." Slab", data.description.." Stair",
data.sounds data.description.." Slab",
) data.sounds
)
end
if add_fence then if add_fence then
add_fence({fence_of = nd}) add_fence({fence_of = nd})
end end
@ -35,14 +42,11 @@ local function add_fence(name)
end end
--]] --]]
local creative_installed = minetest.global_exists("creative")
local function digging_allowed(player, v) local function digging_allowed(player, v)
if not player then if not player then
return false return false
end end
if creative_installed if minetest.is_creative_enabled(player:get_player_name()) then
and creative.is_enabled_for(player:get_player_name()) then
return true return true
end end
local tool = player:get_wielded_item():get_name() local tool = player:get_wielded_item():get_name()

View File

@ -1,3 +1,3 @@
name = nether name = nether
depends = default,glow,riesenpilz,stairs depends = default,glow,riesenpilz
optional_depends = creative,fence_registration,function_delayer,watershed optional_depends = creative,fence_registration,function_delayer,stairs,watershed

View File

@ -4,8 +4,8 @@ local function throw_pearl(item, player)
playerpos.y = playerpos.y+1.625 playerpos.y = playerpos.y+1.625
local obj = minetest.add_entity(playerpos, "nether:pearl_entity") local obj = minetest.add_entity(playerpos, "nether:pearl_entity")
local dir = player:get_look_dir() local dir = player:get_look_dir()
obj:setvelocity(vector.multiply(dir, 30)) obj:set_velocity(vector.multiply(dir, 30))
obj:setacceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3}) obj:set_acceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3})
local pname = player:get_player_name() local pname = player:get_player_name()
obj:get_luaentity().player = pname obj:get_luaentity().player = pname
if not minetest.is_creative_enabled(pname) then if not minetest.is_creative_enabled(pname) then
@ -56,7 +56,7 @@ local function teleport_player(pos, player)
return false return false
end end
pos.y = pos.y+0.05 pos.y = pos.y+0.05
player:moveto(pos) player:move_to(pos)
return true return true
end end

View File

@ -191,7 +191,7 @@ if nether.trap_players then
-- fixes respawn bug -- fixes respawn bug
local player = minetest.get_player_by_name(pname) local player = minetest.get_player_by_name(pname)
if player then if player then
player:moveto(target) player:move_to(target)
end end
end, pname, target) end, pname, target)
return true return true
@ -558,10 +558,11 @@ minetest.after(0.1, function()
and minetest.get_node(pt.under).name == "default:obsidian" then and minetest.get_node(pt.under).name == "default:obsidian" then
local done = make_portal(pt.under) local done = make_portal(pt.under)
if done then if done then
minetest.chat_send_player(player:get_player_name(), local pname = player:get_player_name()
minetest.chat_send_player(pname,
"Warning: If you are in the nether you may not be " .. "Warning: If you are in the nether you may not be " ..
"able to find the way out!") "able to find the way out!")
if not minetest.settings:get_bool("creative_mode") then if not minetest.is_creative_enabled(pname) then
stack:take_item() stack:take_item()
end end
end end