Enable shadow registration, improve indoor check

This commit is contained in:
Till Affeldt 2023-02-22 05:21:52 +01:00
parent 59bf43aa28
commit 710a1d717b
2 changed files with 15 additions and 3 deletions

View File

@ -55,13 +55,15 @@ end)
climate_api.register_influence("daylight", function(pos) climate_api.register_influence("daylight", function(pos)
pos = vector.add(pos, {x = 0, y = 1, z = 0}) pos = vector.add(pos, {x = 0, y = 1, z = 0})
return minetest.get_node_light(pos, 0.5) or 0 return minetest.get_natural_light(pos, 0.5) or 0
end) end)
climate_api.register_influence("indoors", function(pos) climate_api.register_influence("indoors", function(pos)
pos = vector.add(pos, {x = 0, y = 1, z = 0}) pos = vector.add(pos, {x = 0, y = 1, z = 0})
local daylight = minetest.get_node_light(pos, 0.5) or 0 local daylight = minetest.get_natural_light(pos, 0.5) or 0
if daylight < 15 then return true end -- max light is 15 but allow adjacent nodes to still be outdoors
-- to reduce effect switching on and off when walking underneath single nodes
if daylight < 14 then return true end
for i = 1, climate_mod.settings.ceiling_checks do for i = 1, climate_mod.settings.ceiling_checks do
local lpos = vector.add(pos, {x = 0, y = i, z = 0}) local lpos = vector.add(pos, {x = 0, y = i, z = 0})

View File

@ -42,6 +42,10 @@ local default_sky = {
count = 1000, count = 1000,
star_color = "#ebebff69", star_color = "#ebebff69",
scale = 1 scale = 1
},
light_data = {
shadow_intensity = 0.33,
saturation = 1
} }
} }
@ -70,6 +74,12 @@ local function set_skybox(playername, sky)
player:set_moon(sky.moon_data) player:set_moon(sky.moon_data)
player:set_sun(sky.sun_data) player:set_sun(sky.sun_data)
player:set_stars(sky.star_data) player:set_stars(sky.star_data)
if player.set_lighting then
player:set_lighting({
shadows = { intensity = sky.light_data.shadow_intensity },
saturation = sky.light_data.saturation
})
end
end end
function skybox.update(playername) function skybox.update(playername)