mirror of
https://github.com/t-affeldt/climate_api.git
synced 2025-07-03 00:40:36 +02:00
Add hud overlay effect, increase global tick cycle, improve skybox and sound effects
This commit is contained in:
@ -129,4 +129,4 @@ minetest.register_chatcommand("weather_status", {
|
||||
minetest.chat_send_player(playername, dump2(status, weather))
|
||||
end
|
||||
end
|
||||
})
|
||||
})
|
||||
|
11
lib/main.lua
11
lib/main.lua
@ -1,5 +1,5 @@
|
||||
local GSCYCLE = 0.01
|
||||
local WORLD_CYCLE = 0.5
|
||||
local GSCYCLE = 0.03
|
||||
local WORLD_CYCLE = 2
|
||||
|
||||
local gs_timer = 0
|
||||
local world_timer = 0
|
||||
@ -16,13 +16,14 @@ minetest.register_globalstep(function(dtime)
|
||||
climate_mod.world.update_status(noise_timer)
|
||||
end
|
||||
|
||||
local previous_effects = climate_mod.current_effects
|
||||
climate_mod.current_effects = climate_mod.trigger.get_active_effects()
|
||||
local previous_effects = table.copy(climate_mod.current_effects)
|
||||
local current_effects = climate_mod.trigger.get_active_effects()
|
||||
|
||||
for name, effect in pairs(climate_mod.effects) do
|
||||
if climate_mod.cycles[name].timespan < climate_mod.cycles[name].timer + dtime then
|
||||
climate_mod.cycles[name].timer = 0
|
||||
climate_mod.trigger.call_handlers(name, climate_mod.current_effects[name], previous_effects[name])
|
||||
climate_mod.current_effects[name] = current_effects[name]
|
||||
climate_mod.trigger.call_handlers(name, current_effects[name], previous_effects[name])
|
||||
else
|
||||
climate_mod.cycles[name].timer = climate_mod.cycles[name].timer + dtime
|
||||
end
|
||||
|
@ -15,6 +15,7 @@ function trigger.get_player_environment(player)
|
||||
env.humidity = climate_api.environment.get_humidity(ppos)
|
||||
env.time = minetest.get_timeofday()
|
||||
env.date = minetest.get_day_count()
|
||||
env.light = minetest.get_node_light(vector.add(ppos, vector.new({x=0,y=1.5,z=0})), 0.5)
|
||||
return env
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user