From 5a6fd4f39fc8ecd95dcbf4e98f64ad6b8d0ddc8d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 21 Feb 2017 13:48:20 +0100 Subject: [PATCH] Resolve the void / weather sky color conflict --- mods/ENVIRONMENT/weather_pack/depends.txt | 3 ++- mods/ENVIRONMENT/weather_pack/skycolor.lua | 22 +++++++++++++++++----- mods/PLAYER/playerplus/init.lua | 8 +++----- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/mods/ENVIRONMENT/weather_pack/depends.txt b/mods/ENVIRONMENT/weather_pack/depends.txt index b12962596b..cdd7ddcc1e 100644 --- a/mods/ENVIRONMENT/weather_pack/depends.txt +++ b/mods/ENVIRONMENT/weather_pack/depends.txt @@ -1 +1,2 @@ -lightning? \ No newline at end of file +mcl_init +lightning? diff --git a/mods/ENVIRONMENT/weather_pack/skycolor.lua b/mods/ENVIRONMENT/weather_pack/skycolor.lua index b5005ba319..67d338c891 100644 --- a/mods/ENVIRONMENT/weather_pack/skycolor.lua +++ b/mods/ENVIRONMENT/weather_pack/skycolor.lua @@ -74,7 +74,10 @@ skycolor = { players = skycolor.utils.get_players(players) for _, player in ipairs(players) do - player:set_sky(color, "plain", nil) + local pos = player:getpos() + if pos.y >= mcl_vars.bedrock_overworld_max then + player:set_sky(color, "plain", nil) + end end end, @@ -110,7 +113,10 @@ skycolor = { local players = skycolor.utils.get_players(nil) for _, player in ipairs(players) do - player:set_sky(color, "plain", nil) + local pos = player:getpos() + if pos.y >= mcl_vars.bedrock_overworld_max then + player:set_sky(color, "plain", nil) + end end end, @@ -120,7 +126,10 @@ skycolor = { set_default_sky = function(players) local players = skycolor.utils.get_players(players) for _, player in ipairs(players) do - player:set_sky(nil, "regular", nil) + local pos = player:getpos() + if pos.y >= mcl_vars.bedrock_overworld_max then + player:set_sky(nil, "regular", nil) + end end end, @@ -205,8 +214,11 @@ minetest.register_globalstep(function(dtime) end) -minetest.register_on_joinplayer(function(player) +local initsky = function(player) if (skycolor.active) then skycolor.update_sky_color({player}) end -end) \ No newline at end of file +end + +minetest.register_on_joinplayer(initsky) +minetest.register_on_respawnplayer(initsky) diff --git a/mods/PLAYER/playerplus/init.lua b/mods/PLAYER/playerplus/init.lua index 1de8ee45b3..37f47bd058 100644 --- a/mods/PLAYER/playerplus/init.lua +++ b/mods/PLAYER/playerplus/init.lua @@ -122,15 +122,13 @@ minetest.register_globalstep(function(dtime) end -- Apply black sky in the Void and deal Void damage - --[[ DISABLED because of conflicts with weater_pack. - TODO: The sky color handling needs a major rework. if pos.y < mcl_vars.bedrock_overworld_max then -- Player reached the void, set black sky box player:set_sky("#000000", "plain") - else - player:set_sky(nil, "regular") + -- FIXME: Sky handling in MCL2 is held together with lots of duct tape. + -- This only works beause weather_pack currently does not touch the sky for players below the height used for this check. + -- There should be a real skybox API. end - ]] if pos.y < mcl_vars.bedrock_overworld_min - 65 then -- Player is deep into the void, deal void damage if player:get_hp() > 0 then