forked from VoxeLibre/VoxeLibre
Add debug daytime sky and fog colours, remove biome specific dawn/dusk and night colours
This commit is contained in:
parent
1257ff25d3
commit
49e420e1e8
|
@ -1,34 +1,35 @@
|
||||||
local mods_loaded = false
|
local mods_loaded = false
|
||||||
local NIGHT_VISION_RATIO = 0.45
|
local NIGHT_VISION_RATIO = 0.45
|
||||||
|
|
||||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
local water_color = "#0b4880"
|
||||||
|
|
||||||
function mcl_weather.set_sky_box_clear(player,sky,fog)
|
function mcl_weather.set_sky_box_clear(player)
|
||||||
local sc = {
|
local pos = player:get_pos()
|
||||||
day_sky = "#92B9FF",
|
if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then return end
|
||||||
day_horizon = "#C0D8FF",
|
|
||||||
dawn_sky = "#B4BAFA",
|
|
||||||
dawn_horizon = "#BAC1F0",
|
|
||||||
night_sky = "#006AFF",
|
|
||||||
night_horizon = "#4090FF",
|
|
||||||
}
|
|
||||||
if sky then
|
|
||||||
sc.day_sky = sky
|
|
||||||
sc.dawn_sky = sky
|
|
||||||
sc.night_sky = sky
|
|
||||||
end
|
|
||||||
if fog then
|
|
||||||
sc.day_horizon = fog
|
|
||||||
sc.dawn_horizon = fog
|
|
||||||
sc.night_horizon = fog
|
|
||||||
end
|
|
||||||
player:set_sky({
|
player:set_sky({
|
||||||
type = "regular",
|
type = "regular",
|
||||||
sky_color = sc,
|
sky_color = {
|
||||||
|
day_sky = "#92B9FF",
|
||||||
|
day_horizon = "#B4D0FF",
|
||||||
|
dawn_sky = "#B4BAFA",
|
||||||
|
dawn_horizon = "#BAC1F0",
|
||||||
|
night_sky = "#000000",
|
||||||
|
night_horizon = "#4A6790",
|
||||||
|
},
|
||||||
clouds = true,
|
clouds = true,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function mcl_weather.set_sky_color(player, def)
|
||||||
|
local pos = player:get_pos()
|
||||||
|
if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then return end
|
||||||
|
player:set_sky({
|
||||||
|
type = def.type,
|
||||||
|
sky_color = def.sky_color,
|
||||||
|
clouds = def.clouds,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
mcl_weather.skycolor = {
|
mcl_weather.skycolor = {
|
||||||
-- Should be activated before do any effect.
|
-- Should be activated before do any effect.
|
||||||
active = true,
|
active = true,
|
||||||
|
@ -109,18 +110,23 @@ mcl_weather.skycolor = {
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
local dim = mcl_worlds.pos_to_dimension(pos)
|
local dim = mcl_worlds.pos_to_dimension(pos)
|
||||||
local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos))
|
local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos))
|
||||||
if dim == "overworld" then
|
if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then
|
||||||
local biomesky
|
player:set_sky({ type = "regular",
|
||||||
local biomefog
|
sky_color = {
|
||||||
if mg_name ~= "v6" and mg_name ~= "singlenode" then
|
day_sky = water_color,
|
||||||
local biome = minetest.get_biome_name(minetest.get_biome_data(player:get_pos()).biome)
|
day_horizon = water_color,
|
||||||
biomesky = minetest.registered_biomes[biome]._mcl_skycolor
|
dawn_sky = water_color,
|
||||||
biomefog = minetest.registered_biomes[biome]._mcl_fogcolor
|
dawn_horizon = water_color,
|
||||||
|
night_sky = water_color,
|
||||||
|
night_horizon = water_color,
|
||||||
|
},
|
||||||
|
clouds = true,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
if dim == "overworld" then
|
||||||
if (mcl_weather.state == "none") then
|
if (mcl_weather.state == "none") then
|
||||||
-- Clear weather
|
-- Clear weather
|
||||||
mcl_weather.set_sky_box_clear(player,biomesky,biomefog)
|
mcl_weather.set_sky_box_clear(player)
|
||||||
player:set_sun({visible = true, sunrise_visible = true})
|
player:set_sun({visible = true, sunrise_visible = true})
|
||||||
player:set_moon({visible = true})
|
player:set_moon({visible = true})
|
||||||
player:set_stars({visible = true})
|
player:set_stars({visible = true})
|
||||||
|
@ -129,7 +135,8 @@ mcl_weather.skycolor = {
|
||||||
local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15)
|
local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15)
|
||||||
local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27)
|
local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27)
|
||||||
local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1)
|
local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1)
|
||||||
player:set_sky({ type = "regular",
|
mcl_weather.set_sky_color(player, {
|
||||||
|
type = "regular",
|
||||||
sky_color = {
|
sky_color = {
|
||||||
day_sky = day_color,
|
day_sky = day_color,
|
||||||
day_horizon = day_color,
|
day_horizon = day_color,
|
||||||
|
@ -148,7 +155,8 @@ mcl_weather.skycolor = {
|
||||||
local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5)
|
local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5)
|
||||||
local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75)
|
local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75)
|
||||||
local night_color = mcl_weather.skycolor.get_sky_layer_color(0)
|
local night_color = mcl_weather.skycolor.get_sky_layer_color(0)
|
||||||
player:set_sky({ type = "regular",
|
mcl_weather.set_sky_color(player, {
|
||||||
|
type = "regular",
|
||||||
sky_color = {
|
sky_color = {
|
||||||
day_sky = day_color,
|
day_sky = day_color,
|
||||||
day_horizon = day_color,
|
day_horizon = day_color,
|
||||||
|
@ -199,7 +207,7 @@ mcl_weather.skycolor = {
|
||||||
}
|
}
|
||||||
local biometint = nether_sky[minetest.get_biome_name(minetest.get_biome_data(player:get_pos()).biome)]
|
local biometint = nether_sky[minetest.get_biome_name(minetest.get_biome_data(player:get_pos()).biome)]
|
||||||
|
|
||||||
player:set_sky({
|
mcl_weather.set_sky_color(player, {
|
||||||
type = "regular",
|
type = "regular",
|
||||||
sky_color = {
|
sky_color = {
|
||||||
day_sky = "#300808",
|
day_sky = "#300808",
|
||||||
|
|
Loading…
Reference in New Issue