mirror of
https://github.com/t-affeldt/climate_api.git
synced 2025-07-19 20:44:53 -04:00
Add hud overlay effect, increase global tick cycle, improve skybox and sound effects
This commit is contained in:
parent
f42f8481da
commit
7f8f1a77f2
11 changed files with 110 additions and 73 deletions
|
@ -1,15 +1,27 @@
|
|||
if not climate_mod.settings.skybox then return end
|
||||
if not minetest.get_modpath("skylayer") then return end
|
||||
|
||||
local SKYBOX_NAME = "climate_api:skybox"
|
||||
local EFFECT_NAME = "climate_api:skybox"
|
||||
|
||||
local function set_skybox(player, sky)
|
||||
sky.name = SKYBOX_NAME
|
||||
skylayer.add_layer(player:get_player_name(), sky)
|
||||
if sky.sky_data ~= nil then
|
||||
player:set_sky(sky.sky_data)
|
||||
end
|
||||
if sky.cloud_data ~= nil then
|
||||
player:set_clouds(sky.cloud_data)
|
||||
end
|
||||
if sky.moon_data ~= nil then
|
||||
player:set_moon(sky.moon_data)
|
||||
end
|
||||
if sky.sun_data ~= nil then
|
||||
player:set_sun(sky.sun_data)
|
||||
end
|
||||
if sky.stars_data ~= nil then
|
||||
player:set_sun(sky.stars_data)
|
||||
end
|
||||
end
|
||||
|
||||
local function remove_skybox(player)
|
||||
skylayer.remove_layer(player:get_player_name(), SKYBOX_NAME)
|
||||
player:set_sky({ type = "regular", clouds = true})
|
||||
end
|
||||
|
||||
local function handle_effect(player_data)
|
||||
|
@ -24,12 +36,12 @@ local function handle_effect(player_data)
|
|||
end
|
||||
|
||||
local function remove_effect(player_data)
|
||||
for playername, data in ipairs(player_data) do
|
||||
for playername, data in pairs(player_data) do
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
remove_skybox(player)
|
||||
end
|
||||
end
|
||||
|
||||
climate_api.register_effect("climate_api:skybox", handle_effect, "tick")
|
||||
climate_api.register_effect("climate_api:skybox", remove_effect, "stop")
|
||||
climate_api.set_effect_cycle("climate_api:skybox", climate_api.LONG_CYCLE)
|
||||
climate_api.register_effect(EFFECT_NAME, handle_effect, "tick")
|
||||
climate_api.register_effect(EFFECT_NAME, remove_effect, "stop")
|
||||
--climate_api.set_effect_cycle("climate_api:skybox", climate_api.LONG_CYCLE)
|
Loading…
Add table
Add a link
Reference in a new issue