From 17cf0ff5a3e4c769d56053a26f37ac291bd51b98 Mon Sep 17 00:00:00 2001 From: Deathwing777 <160651137+Deathwing777@users.noreply.github.com> Date: Tue, 20 Feb 2024 12:03:32 -0800 Subject: [PATCH] Fixes Issue #14 Fixes: "Needs a global table so other mods can be nether aware. #14" --- nether/portal.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nether/portal.lua b/nether/portal.lua index 7f08a85..c4e5f5d 100644 --- a/nether/portal.lua +++ b/nether/portal.lua @@ -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