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",
-- Mods
"default", "stairs", "creative"
"default", "stairs"
}
globals = {"nether"}
ignore = {

View File

@ -4,20 +4,27 @@ local nether_sound = default.node_sound_stone_defaults({
footstep = {name="nether_footstep", gain=0.4}
})
-- The fence registration function from fence_registration
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 nd = "nether:"..name
if not string.find(name, "nether") then
name = "nether_"..name
end
local data = minetest.registered_nodes[nd]
stairs.register_stair_and_slab(name, nd,
data.groups,
data.tiles,
data.description.." Stair",
data.description.." Slab",
data.sounds
)
if stairs_exist then
stairs.register_stair_and_slab(name, nd,
data.groups,
data.tiles,
data.description.." Stair",
data.description.." Slab",
data.sounds
)
end
if add_fence then
add_fence({fence_of = nd})
end
@ -35,14 +42,11 @@ local function add_fence(name)
end
--]]
local creative_installed = minetest.global_exists("creative")
local function digging_allowed(player, v)
if not player then
return false
end
if creative_installed
and creative.is_enabled_for(player:get_player_name()) then
if minetest.is_creative_enabled(player:get_player_name()) then
return true
end
local tool = player:get_wielded_item():get_name()

View File

@ -1,3 +1,3 @@
name = nether
depends = default,glow,riesenpilz,stairs
optional_depends = creative,fence_registration,function_delayer,watershed
depends = default,glow,riesenpilz
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
local obj = minetest.add_entity(playerpos, "nether:pearl_entity")
local dir = player:get_look_dir()
obj:setvelocity(vector.multiply(dir, 30))
obj:setacceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3})
obj:set_velocity(vector.multiply(dir, 30))
obj:set_acceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3})
local pname = player:get_player_name()
obj:get_luaentity().player = pname
if not minetest.is_creative_enabled(pname) then
@ -56,7 +56,7 @@ local function teleport_player(pos, player)
return false
end
pos.y = pos.y+0.05
player:moveto(pos)
player:move_to(pos)
return true
end

View File

@ -191,7 +191,7 @@ if nether.trap_players then
-- fixes respawn bug
local player = minetest.get_player_by_name(pname)
if player then
player:moveto(target)
player:move_to(target)
end
end, pname, target)
return true
@ -558,10 +558,11 @@ minetest.after(0.1, function()
and minetest.get_node(pt.under).name == "default:obsidian" then
local done = make_portal(pt.under)
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 " ..
"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()
end
end