1
0
mirror of https://github.com/HybridDog/nether-pack.git synced 2024-11-16 07:20:20 +01:00

Fixes HybridDog#16

Added new chat function `in_hell [<player_name>]` and used it to find the bug. The issue was that `local function obsidian_teleport(player, pname, target)` failed to test `nether.trap_players` before modifying `players_in_nether`.
This commit is contained in:
Deathwing777 2024-02-20 13:24:29 -08:00 committed by GitHub
parent 17cf0ff5a3
commit 9c98786ff7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,6 +41,7 @@ NETHER['is_player_in_nether'] = function (player)
return true
end
end
local is_player_in_nether = NETHER['is_player_in_nether']
local function save_nether_players()
local playernames,n = {},1
@ -92,11 +93,13 @@ end
-- used for obsidian portal
local function obsidian_teleport(player, pname, target)
if nether.trap_players then
minetest.chat_send_player(pname, "For any reason you arrived here. Type " ..
"/nether_help to find out things like craft recipes.")
players_in_nether[pname] = true
save_nether_players()
update_background(player, true)
end
if target then
player:set_pos(target)
else
@ -189,6 +192,34 @@ minetest.register_chatcommand("from_hell", {
end
})
-- Useful for debugging Nether player state tracking. Written by Deathwing777
minetest.register_chatcommand("in_hell", {
params = "[<player_name>]",
description = "Is the player in hell?",
func = function(name, pname)
if not minetest.check_player_privs(name, {nether=true}) then
return false,
"You need the nether priv to execute this chatcommand."
end
if not player_exists(pname) then
pname = name
end
local player = minetest.get_player_by_name(pname)
if not player then
return false, "Something went wrong."
end
status = pname.." is in the "
if is_player_in_nether(player) then
status = status.."NETHER!"
else
status = status.."OVERWORLD!"
end
return true, status
end
})
-- Disallow teleportation and change spawn positions if the nether traps players
if nether.trap_players then