Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
Replace deprecated function names (e.g. moveto -> move_to) and make s…
Browse files Browse the repository at this point in the history
…tairs optional
  • Loading branch information
HybridDog committed Aug 20, 2022
1 parent 435cef6 commit f12d33c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion nether/.luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ read_globals = {
"string",

-- Mods
"default", "stairs", "creative"
"default", "stairs"
}
globals = {"nether"}
ignore = {
Expand Down
26 changes: 15 additions & 11 deletions nether/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions nether/mod.conf
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions nether/pearl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions nether/portal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f12d33c

Please sign in to comment.