1
0
mirror of https://github.com/HybridDog/nether-pack.git synced 2025-07-15 14:20:35 +02:00

Implemented HybridDog's change requests.

This should now be ready to merge.
This commit is contained in:
Deathwing777
2024-02-24 11:49:58 -08:00
committed by GitHub
parent 9af94a8bc6
commit 242a32e1ad

View File

@ -29,27 +29,6 @@ do
end end
end end
-- Nether aware mods will need to know if a player is in the nether.
nether['is_player_in_nether'] = function (player)
local pname = player:get_player_name()
if players_in_nether[pname] == nil then
return false
else
return true
end
end
-- Nether aware mods may have other means of moving players between the Nether and Overworld, and if so, they should tell us about it so we can keep track of the player state.
nether['external_nether_teleport'] = function (player)
local pos = player:get_pos()
local pname = player:get_player_name()
if (pos.y < nether.start) and (pos.y >= nether.bottom) then
players_in_nether[pname] = true
else
players_in_nether[pname] = nil
end
end
local function save_nether_players() local function save_nether_players()
local playernames,n = {},1 local playernames,n = {},1
for name in pairs(players_in_nether) do for name in pairs(players_in_nether) do
@ -62,6 +41,24 @@ local function save_nether_players()
io.close(f) io.close(f)
end end
-- Nether aware mods will need to know if a player is in the nether.
function nether.is_player_in_nether(player)
return players_in_nether[player:get_player_name()]
end
-- Nether aware mods may have other means of moving players between the Nether
-- and Overworld, and if so, they should tell us about it so we can keep track
-- of the player state.
function nether.external_nether_teleport(player)
local pos = player:get_pos()
local pname = player:get_player_name()
if (pos.y < nether.start) and (pos.y >= nether.bottom) then
players_in_nether[pname] = true
else
players_in_nether[pname] = nil
end
end
local update_background local update_background
if nether.trap_players then if nether.trap_players then
function update_background(player, down) function update_background(player, down)
@ -100,13 +97,12 @@ end
-- used for obsidian portal -- used for obsidian portal
local function obsidian_teleport(player, pname, target) local function obsidian_teleport(player, pname, target)
if nether.trap_players then minetest.chat_send_player(pname, "For any reason you arrived here. Type " ..
minetest.chat_send_player(pname, "For any reason you arrived here. Type " .. "/nether_help to find out things like craft recipes.")
"/nether_help to find out things like craft recipes.") players_in_nether[pname] = true
players_in_nether[pname] = true save_nether_players()
save_nether_players() update_background(player, true)
update_background(player, true)
end
if target then if target then
player:set_pos(target) player:set_pos(target)
else else
@ -215,14 +211,14 @@ minetest.register_chatcommand("in_hell", {
if not player then if not player then
return false, "Something went wrong." return false, "Something went wrong."
end end
status = pname.." is in the " local status = pname.." is in the "
if nether.is_player_in_nether(player) then if nether.is_player_in_nether(player) then
status = status.."NETHER!" status = status.."NETHER!"
else else
status = status.."OVERWORLD!" status = status.."OVERWORLD!"
end end
return true, status return true, status
end end
}) })
@ -242,15 +238,15 @@ minetest.register_chatcommand("update_hells_registry", {
if not player then if not player then
return false, "Something went wrong." return false, "Something went wrong."
end end
nether.external_nether_teleport(player) nether.external_nether_teleport(player)
status = pname.." is in the " local status = pname.." is in the "
if nether.is_player_in_nether(player) then if nether.is_player_in_nether(player) then
status = status.."NETHER!" status = status.."NETHER!"
else else
status = status.."OVERWORLD!" status = status.."OVERWORLD!"
end end
return true, status return true, status
end end
}) })
@ -389,7 +385,7 @@ local function obsi_teleport_player(player, pos, target)
end end
local has_teleported local has_teleported
if damage_enabled then if (damage_enabled and nether.trap_players) then
obsidian_teleport(player, pname) obsidian_teleport(player, pname)
has_teleported = true has_teleported = true
elseif not mclike_portal then elseif not mclike_portal then