Resolve the void / weather sky color conflict

This commit is contained in:
Wuzzy 2017-02-21 13:48:20 +01:00
parent edde01d582
commit 5a6fd4f39f
3 changed files with 22 additions and 11 deletions

View File

@ -1 +1,2 @@
mcl_init
lightning?

View File

@ -74,8 +74,11 @@ skycolor = {
players = skycolor.utils.get_players(players)
for _, player in ipairs(players) do
local pos = player:getpos()
if pos.y >= mcl_vars.bedrock_overworld_max then
player:set_sky(color, "plain", nil)
end
end
end,
-- Returns current layer color in {r, g, b} format
@ -110,8 +113,11 @@ skycolor = {
local players = skycolor.utils.get_players(nil)
for _, player in ipairs(players) do
local pos = player:getpos()
if pos.y >= mcl_vars.bedrock_overworld_max then
player:set_sky(color, "plain", nil)
end
end
end,
-- Reset sky color to game default. If players not specified update sky for all players.
@ -120,8 +126,11 @@ skycolor = {
set_default_sky = function(players)
local players = skycolor.utils.get_players(players)
for _, player in ipairs(players) do
local pos = player:getpos()
if pos.y >= mcl_vars.bedrock_overworld_max then
player:set_sky(nil, "regular", nil)
end
end
end,
init_transition = function()
@ -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)
end
minetest.register_on_joinplayer(initsky)
minetest.register_on_respawnplayer(initsky)

View File

@ -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