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,5 +1,7 @@
|
|||
if not climate_mod.settings.sound then return end
|
||||
|
||||
local EFFECT_NAME = "climate_api:sound"
|
||||
|
||||
local handles = {}
|
||||
local function start_sound(pname, weather, sound)
|
||||
if handles[pname] == nil then handles[pname] = {} end
|
||||
|
@ -30,7 +32,7 @@ local function handle_effect(player_data, prev_data)
|
|||
for playername, data in pairs(player_data) do
|
||||
for weather, value in pairs(data) do
|
||||
if prev_data[playername][weather] == nil then
|
||||
start_sound(playername, weather, sound)
|
||||
start_sound(playername, weather, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -38,7 +40,7 @@ local function handle_effect(player_data, prev_data)
|
|||
for playername, data in pairs(prev_data) do
|
||||
for weather, value in pairs(data) do
|
||||
if player_data[playername][weather] == nil then
|
||||
stop_sound(playername, weather, sound)
|
||||
stop_sound(playername, weather, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -53,7 +55,7 @@ local function stop_effect(prev_data)
|
|||
end
|
||||
end
|
||||
|
||||
climate_api.register_effect("climate_api:sound", start_effect, "start")
|
||||
climate_api.register_effect("climate_api:sound", handle_effect, "tick")
|
||||
climate_api.register_effect("climate_api:sound", stop_effect, "stop")
|
||||
climate_api.set_effect_cycle("climate_api:sound", 0)
|
||||
climate_api.register_effect(EFFECT_NAME, start_effect, "start")
|
||||
climate_api.register_effect(EFFECT_NAME, handle_effect, "tick")
|
||||
climate_api.register_effect(EFFECT_NAME, stop_effect, "stop")
|
||||
climate_api.set_effect_cycle(EFFECT_NAME, climate_api.LONG_CYCLE)
|
Loading…
Add table
Add a link
Reference in a new issue