From 092ade96deb6a6f6cd0e1a596089c0c985a02d39 Mon Sep 17 00:00:00 2001 From: auouymous Date: Mon, 3 Jan 2022 02:13:23 -0700 Subject: [PATCH] Restore sky from skybox mod when returning to surface. --- init.lua | 14 ++++++++++---- mod.conf | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 3152a8c..df15a5f 100644 --- a/init.lua +++ b/init.lua @@ -5,6 +5,8 @@ local player_list = {} local timer = 0 +local skybox_restore = (minetest.get_modpath("skybox") ~= nil and skybox.restore ~= nil) + local function node_ok(pos, fallback) fallback = fallback or "air" local node = minetest.get_node_or_nil(pos) @@ -61,10 +63,14 @@ minetest.register_globalstep(function(dtime) -- Surface elseif pos.y > sky_start and current ~= "surface" then - player:set_sky({ type = "regular", clouds = true }) - player:set_sun({ visible = true, sunrise_visible = true }) - player:set_moon({ visible = true }) - player:set_stars({ visible = true }) + if skybox_restore then + skybox.restore(player) + else + player:set_sky({ type = "regular", clouds = true }) + player:set_sun({ visible = true, sunrise_visible = true }) + player:set_moon({ visible = true }) + player:set_stars({ visible = true }) + end player_list[name] = "surface" -- Everything else (blackness) diff --git a/mod.conf b/mod.conf index bb2b97a..61d70f8 100644 --- a/mod.conf +++ b/mod.conf @@ -2,3 +2,4 @@ name = under_sky title = Under Sky author = Shara description = Adds a black skybox to prevent default skybox showing through the walls of caves. +optional_depends = skybox -- 2.34.1