5 Add excessive checks for player when setting skybox attributes
This commit is contained in:
parent
8431d0d53e
commit
e401db74a3
57
skybox.lua
57
skybox.lua
|
@ -738,8 +738,10 @@ minetest.register_globalstep(function(dtime)
|
||||||
sun_params.texture = sun_params.texture .. '^[transformFY'
|
sun_params.texture = sun_params.texture .. '^[transformFY'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if player then
|
||||||
player:set_sun(sun_params)
|
player:set_sun(sun_params)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- if skybox_defs[biome_name].moon_parameters then
|
-- if skybox_defs[biome_name].moon_parameters then
|
||||||
-- player:set_moon(skybox_defs[biome_name].moon_parameters)
|
-- player:set_moon(skybox_defs[biome_name].moon_parameters)
|
||||||
|
@ -761,78 +763,119 @@ minetest.register_globalstep(function(dtime)
|
||||||
sun_params.texture = sun_params.texture .. '^[transformFY'
|
sun_params.texture = sun_params.texture .. '^[transformFY'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if player then
|
||||||
player:set_sun(sun_params)
|
player:set_sun(sun_params)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if player then
|
||||||
player:set_sun()
|
player:set_sun()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if skybox_defs[biome_name].moon_parameters then
|
if skybox_defs[biome_name].moon_parameters then
|
||||||
|
if player then
|
||||||
player:set_moon(skybox_defs[biome_name].moon_parameters)
|
player:set_moon(skybox_defs[biome_name].moon_parameters)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if player then
|
||||||
player:set_moon()
|
player:set_moon()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if skybox_defs[biome_name].sky_parameters then
|
if skybox_defs[biome_name].sky_parameters then
|
||||||
|
if player then
|
||||||
player:set_sky(skybox_defs[biome_name].sky_parameters)
|
player:set_sky(skybox_defs[biome_name].sky_parameters)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if player then
|
||||||
player:set_sky()
|
player:set_sky()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if skybox_defs[biome_name].cloud_parameters then
|
if skybox_defs[biome_name].cloud_parameters then
|
||||||
|
if player then
|
||||||
player:set_clouds(skybox_defs[biome_name].cloud_parameters)
|
player:set_clouds(skybox_defs[biome_name].cloud_parameters)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if player then
|
||||||
player:set_clouds()
|
player:set_clouds()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if skybox_defs[biome_name].star_parameters then
|
if skybox_defs[biome_name].star_parameters then
|
||||||
|
if player then
|
||||||
player:set_stars(skybox_defs[biome_name].star_parameters)
|
player:set_stars(skybox_defs[biome_name].star_parameters)
|
||||||
else
|
|
||||||
player:set_stars()
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
player:set_moon()
|
if player then
|
||||||
player:set_sun()
|
|
||||||
player:set_sky()
|
|
||||||
player:set_clouds()
|
|
||||||
player:set_stars()
|
player:set_stars()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
if player then
|
||||||
|
player:set_moon()
|
||||||
|
end
|
||||||
|
if player then
|
||||||
|
player:set_sun()
|
||||||
|
end
|
||||||
|
if player then
|
||||||
|
player:set_sky()
|
||||||
|
end
|
||||||
|
if player then
|
||||||
|
player:set_clouds()
|
||||||
|
end
|
||||||
|
if player then
|
||||||
|
player:set_stars()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if player_pos.y <= -256 and is_underground == 0 or (is_underground ~= 0 and player_biome_name ~= biome_name) then
|
if player_pos.y <= -256 and is_underground == 0 or (is_underground ~= 0 and player_biome_name ~= biome_name) then
|
||||||
-- hide sun, moon, stars ... underground
|
-- hide sun, moon, stars ... underground
|
||||||
player_meta:set_int('everness_is_underground', 1)
|
player_meta:set_int('everness_is_underground', 1)
|
||||||
|
|
||||||
|
if player then
|
||||||
player:set_sun({
|
player:set_sun({
|
||||||
visible = false,
|
visible = false,
|
||||||
sunrise_visible = false
|
sunrise_visible = false
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if player then
|
||||||
player:set_moon({
|
player:set_moon({
|
||||||
visible = false
|
visible = false
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if player then
|
||||||
player:set_stars({
|
player:set_stars({
|
||||||
visible = false
|
visible = false
|
||||||
})
|
})
|
||||||
|
end
|
||||||
elseif player_pos.y > -256 and is_underground ~= 0 or (is_underground == 0 and player_biome_name ~= biome_name) then
|
elseif player_pos.y > -256 and is_underground ~= 0 or (is_underground == 0 and player_biome_name ~= biome_name) then
|
||||||
-- show sun, moon, stars ... underground
|
-- show sun, moon, stars ... underground
|
||||||
player_meta:set_int('everness_is_underground', 0)
|
player_meta:set_int('everness_is_underground', 0)
|
||||||
|
|
||||||
|
if player then
|
||||||
player:set_sun({
|
player:set_sun({
|
||||||
visible = true
|
visible = true
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if player then
|
||||||
player:set_moon({
|
player:set_moon({
|
||||||
visible = true
|
visible = true
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if player then
|
||||||
player:set_stars({
|
player:set_stars({
|
||||||
visible = true,
|
visible = true,
|
||||||
sunrise_visible = true
|
sunrise_visible = true
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
timer = 0
|
timer = 0
|
||||||
end
|
end
|
||||||
|
|
Ŝarĝante…
Reference in New Issue