diff --git a/nether/init.lua b/nether/init.lua index a40fa07..0e78bb1 100644 --- a/nether/init.lua +++ b/nether/init.lua @@ -53,7 +53,7 @@ nether.start = f_h_max+100 local NETHER_HEIGHT = 30 -- bottom height of the nether. -nether.bottom = nether_middle - NETHER_HEIGHT +nether.bottom = nether_middle - NETHER_HEIGHT - 100 -- Maximum amount of randomness in the map generation local NETHER_RANDOM = 2 diff --git a/nether/portal.lua b/nether/portal.lua index 186c3f8..d8b325b 100644 --- a/nether/portal.lua +++ b/nether/portal.lua @@ -52,6 +52,19 @@ function nether.is_player_trapped_in_nether(player) return players_trapped_in_nether[player:get_player_name()] end +local update_background +if nether.trap_players then + function update_background(player, down) + if down then + player:set_sky({r=15, g=0, b=0}, "plain") + else + player:set_sky(nil, "regular") + end + end +else + function update_background()end +end + -- Nether aware mods may have other means of moving players between the Nether -- and Overworld, and if so, they should tell us about it so we can keep track -- of the player state. @@ -74,7 +87,7 @@ function nether.registry_update(player) local in_nether = (pos.y < nether.start) and (pos.y >= nether.bottom) local pname = player:get_player_name() if nether.trap_players then - players_trapped_in_nether[pname] = in_nether + players_trapped_in_nether[pname] = in_nether or nil update_background(player, in_nether) elseif players_trapped_in_nether[pname] then players_trapped_in_nether[pname] = nil @@ -82,19 +95,6 @@ function nether.registry_update(player) end end -local update_background -if nether.trap_players then - function update_background(player, down) - if down then - player:set_sky({r=15, g=0, b=0}, "plain") - else - player:set_sky(nil, "regular") - end - end -else - function update_background()end -end - -- returns nodename if area is generated, else calls generation function local function generated_or_generate(pos) local node = minetest.get_node_or_nil(pos)