Fixes Issue #14
Fixes: "Needs a global table so other mods can be nether aware. #14"
This commit is contained in:
parent
02d14a8970
commit
17cf0ff5a3
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue