mirror of
https://github.com/HybridDog/nether-pack.git
synced 2025-07-08 19:10:44 +02: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:
@ -41,6 +41,7 @@ NETHER['is_player_in_nether'] = function (player)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local is_player_in_nether = NETHER['is_player_in_nether']
|
||||||
|
|
||||||
local function save_nether_players()
|
local function save_nether_players()
|
||||||
local playernames,n = {},1
|
local playernames,n = {},1
|
||||||
@ -92,11 +93,13 @@ end
|
|||||||
|
|
||||||
-- used for obsidian portal
|
-- used for obsidian portal
|
||||||
local function obsidian_teleport(player, pname, target)
|
local function obsidian_teleport(player, pname, target)
|
||||||
minetest.chat_send_player(pname, "For any reason you arrived here. Type " ..
|
if nether.trap_players then
|
||||||
"/nether_help to find out things like craft recipes.")
|
minetest.chat_send_player(pname, "For any reason you arrived here. Type " ..
|
||||||
players_in_nether[pname] = true
|
"/nether_help to find out things like craft recipes.")
|
||||||
save_nether_players()
|
players_in_nether[pname] = true
|
||||||
update_background(player, true)
|
save_nether_players()
|
||||||
|
update_background(player, true)
|
||||||
|
end
|
||||||
if target then
|
if target then
|
||||||
player:set_pos(target)
|
player:set_pos(target)
|
||||||
else
|
else
|
||||||
@ -189,6 +192,34 @@ minetest.register_chatcommand("from_hell", {
|
|||||||
end
|
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
|
-- Disallow teleportation and change spawn positions if the nether traps players
|
||||||
if nether.trap_players then
|
if nether.trap_players then
|
||||||
|
Reference in New Issue
Block a user