forked from VoxeLibre/VoxeLibre
Resolve the void / weather sky color conflict
This commit is contained in:
parent
edde01d582
commit
5a6fd4f39f
|
@ -1 +1,2 @@
|
||||||
lightning?
|
mcl_init
|
||||||
|
lightning?
|
||||||
|
|
|
@ -74,7 +74,10 @@ skycolor = {
|
||||||
|
|
||||||
players = skycolor.utils.get_players(players)
|
players = skycolor.utils.get_players(players)
|
||||||
for _, player in ipairs(players) do
|
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
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -110,7 +113,10 @@ skycolor = {
|
||||||
|
|
||||||
local players = skycolor.utils.get_players(nil)
|
local players = skycolor.utils.get_players(nil)
|
||||||
for _, player in ipairs(players) do
|
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
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -120,7 +126,10 @@ skycolor = {
|
||||||
set_default_sky = function(players)
|
set_default_sky = function(players)
|
||||||
local players = skycolor.utils.get_players(players)
|
local players = skycolor.utils.get_players(players)
|
||||||
for _, player in ipairs(players) do
|
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
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -205,8 +214,11 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
local initsky = function(player)
|
||||||
if (skycolor.active) then
|
if (skycolor.active) then
|
||||||
skycolor.update_sky_color({player})
|
skycolor.update_sky_color({player})
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(initsky)
|
||||||
|
minetest.register_on_respawnplayer(initsky)
|
||||||
|
|
|
@ -122,15 +122,13 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Apply black sky in the Void and deal Void damage
|
-- 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
|
if pos.y < mcl_vars.bedrock_overworld_max then
|
||||||
-- Player reached the void, set black sky box
|
-- Player reached the void, set black sky box
|
||||||
player:set_sky("#000000", "plain")
|
player:set_sky("#000000", "plain")
|
||||||
else
|
-- FIXME: Sky handling in MCL2 is held together with lots of duct tape.
|
||||||
player:set_sky(nil, "regular")
|
-- 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
|
end
|
||||||
]]
|
|
||||||
if pos.y < mcl_vars.bedrock_overworld_min - 65 then
|
if pos.y < mcl_vars.bedrock_overworld_min - 65 then
|
||||||
-- Player is deep into the void, deal void damage
|
-- Player is deep into the void, deal void damage
|
||||||
if player:get_hp() > 0 then
|
if player:get_hp() > 0 then
|
||||||
|
|
Loading…
Reference in New Issue