mirror of
https://github.com/t-affeldt/climate_api.git
synced 2025-06-30 07:20:48 +02:00
Enable more options for particles, fix skybox reset, add new debug command, fix daylight influence
This commit is contained in:
@ -17,7 +17,7 @@ end
|
||||
function api.register_effect(name, handler, htype)
|
||||
-- check for valid handler types
|
||||
if htype ~= "start" and htype ~= "tick" and htype ~= "stop" then
|
||||
minetest.log("warning", "[Climate API] Invalid effect handler type: " .. htype)
|
||||
minetest.log("warning", "[Climate API] Effect " .. dump(name) .. " uses invalid callback type: " .. dump(htype))
|
||||
return
|
||||
end
|
||||
-- create effect handler registry if not existent yet
|
||||
|
@ -156,3 +156,15 @@ minetest.register_chatcommand("weather_status", {
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("weather_influences", {
|
||||
description = "Prints which weather influences cause your current weather",
|
||||
func = function(playername)
|
||||
minetest.chat_send_player(playername, "Current influences rules:\n================")
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
local influences = climate_mod.trigger.get_player_environment(player)
|
||||
for influence, value in pairs(influences) do
|
||||
minetest.chat_send_player(playername, dump2(value, influence))
|
||||
end
|
||||
end
|
||||
})
|
@ -36,13 +36,19 @@ climate_api.register_influence("height", function(pos)
|
||||
end)
|
||||
|
||||
climate_api.register_influence("light", function(pos)
|
||||
pos = vector.add(pos, {x = 0, y = 1, z = 0})
|
||||
return minetest.env:get_node_light(pos)
|
||||
end)
|
||||
|
||||
climate_api.register_influence("daylight", function(pos)
|
||||
pos = vector.add(pos, {x = 0, y = 1, z = 0})
|
||||
return minetest.env:get_node_light(pos, 0.5)
|
||||
end)
|
||||
|
||||
climate_api.register_influence("time", function(_)
|
||||
return minetest.get_timeofday()
|
||||
end)
|
||||
|
||||
climate_api.register_influence("day_count", function(_)
|
||||
return minetest.get_day_count()
|
||||
end)
|
@ -155,7 +155,6 @@ function trigger.call_handlers(name, effect, prev_effect)
|
||||
|
||||
-- remaining table lists ending effects
|
||||
if has_stops then
|
||||
minetest.log(dump2(name, "AAAAAAAAAAA"))
|
||||
for _, handler in ipairs(climate_mod.effects[name]["stop"]) do
|
||||
handler(stops)
|
||||
end
|
||||
|
Reference in New Issue
Block a user