tweak nether skybox

This commit is contained in:
tenplus1 2024-12-11 12:31:56 +00:00
parent 71030b499f
commit 0cee217b6c
2 changed files with 47 additions and 25 deletions

View File

@ -1,5 +1,5 @@
name = other_worlds name = other_worlds
description = Adds asteroid layers and height-based skybox switches to create space environments. description = Adds asteroid layers and height-based skybox switches to create space environments.
depends = default depends = default
optional_depends = pova optional_depends = pova, nether
min_minetest_version = 5.0 min_minetest_version = 5.0

View File

@ -1,16 +1,29 @@
-- Nether check for Xanadu server
local nether_mod = minetest.get_modpath("nether") and minetest.get_modpath("xanadu")
-- Heights for skyboxes -- Heights for skyboxes
local underground_low = nether_mod and -28000 or -31000 local underground_low = -31000
local underground_high = -50 local underground_high = -50
local space_low = 5000 local space_low = 5000
local space_high = 5999 local space_high = 5999
local redsky_low = 6000 local redsky_low = 6000
local redsky_high = 6999 local redsky_high = 6999
local nether_low = -32000
local nether_high = -31000
-- Nether check
local mod_nether = minetest.get_modpath("nether")
if mod_nether then
nether_low = nether.DEPTH_FLOOR or -32000
nether_high = nether.DEPTH_CEILING or -31000
underground_low = nether_high
if minetest.get_modpath("climate_api") then
mod_nether = nil -- remove nether skybox for climate_api version
end
end
-- Holds name of skybox showing for each player -- Holds name of skybox showing for each player
@ -46,7 +59,6 @@ local darkskybox = {
"sky_pos_x.png^[transformR270^[colorize:#00005070", "sky_pos_x.png^[transformR270^[colorize:#00005070",
"sky_neg_x.png^[transformR90^[colorize:#00005070"} "sky_neg_x.png^[transformR90^[colorize:#00005070"}
-- check for active pova mod -- check for active pova mod
local mod_pova = minetest.get_modpath("pova") local mod_pova = minetest.get_modpath("pova")
@ -64,11 +76,13 @@ end
-- globalstep function runs every 2 seconds to show appropriate skybox -- globalstep function runs every 2 seconds to show appropriate skybox
local timer = 0 local timer, timer2 = 0, 0
local first_time = true
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
timer = timer + dtime ; if timer < 2 then return end ; timer = 0 timer = timer + dtime ; if timer < 2 then return end ; timer = 0
timer2 = timer2 + 2
local name, pos, current local name, pos, current
@ -78,25 +92,33 @@ minetest.register_globalstep(function(dtime)
pos = player:get_pos() pos = player:get_pos()
current = player_list[name] or "" current = player_list[name] or ""
-- this just adds nether background for xanadu server -- this just adds nether background outwith climate_api mod
if nether_mod and pos.y < underground_low and current ~= "nether" then if mod_nether and pos.y >= nether_low and pos.y <= nether_high
and (current ~= "nether" or (current == "nether" and timer2 > 8)) then
player:set_sky({ timer2 = 0 -- reset nether layer timer (every 10 seconds)
type = "plain",
base_color = "#1d1118", local base_col = first_time and "#1D0504"
clouds = false, local ps, cn = minetest.find_nodes_in_area(
sky_color = { {x = pos.x - 6, y = pos.y - 4, z = pos.z - 6},
day_horizon = "#9bc1f0", {x = pos.x + 6, y = pos.y + 4, z = pos.z + 6},
dawn_horizon = "#bac1f0", {"nether:rack", "nether:rack_deep", "nether:geode", "nether:geodelite"})
fog_tint_type = "default",
dawn_sky = "#b4bafa", -- easy find nether layer via quick node count
day_sky = "#8cbafa",
night_sky = "#006aff", if (cn["nether:rack"] or 0) > 100 then
indoors = "#646464", base_col = "#1D0504"
night_horizon = "#4090ff" elseif (cn["nether:rack_deep"] or 0) > 100 then
} base_col = "#070916"
}) elseif (cn["nether:geode"] or 0) + (cn["nether:geodelite"] or 0)> 100 then
base_col = "#300530"
end
if base_col then
player:set_sky({type = "plain", base_color = base_col, clouds = false})
first_time = nil
end
player:set_moon({visible = false}) player:set_moon({visible = false})
player:set_stars({visible = false}) player:set_stars({visible = false})