forked from MineClone5/MineClone5
Resolve the void / weather sky color conflict
This commit is contained in:
parent
edde01d582
commit
5a6fd4f39f
|
@ -1 +1,2 @@
|
|||
mcl_init
|
||||
lightning?
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue