Fixes Issue #14

Fixes: "Needs a global table so other mods can be nether aware. #14"
This commit is contained in:
Deathwing777 2024-02-20 12:03:32 -08:00 committed by GitHub
parent 02d14a8970
commit 17cf0ff5a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 0 deletions

View File

@ -13,6 +13,9 @@ end)
local save_path = minetest.get_worldpath() .. "/nether_players"
local players_in_nether = {}
-- Global table to store things that nether aware mods might need to access.
NETHER = {}
-- Load the list of players which are trapped in the nether
-- (or would be trapped if nether.trap_players was true)
do
@ -29,6 +32,16 @@ do
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
local function save_nether_players()
local playernames,n = {},1
for name in pairs(players_in_nether) do