mirror of
https://github.com/t-affeldt/climate_api.git
synced 2024-12-22 08:50:37 +01:00
Add improved indoors check
This commit is contained in:
parent
a3d4dd446d
commit
cd98798880
3
init.lua
3
init.lua
@ -40,7 +40,8 @@ climate_mod.settings = {
|
||||
time_spread = get_setting_number("time_spread", 1),
|
||||
particle_count = get_setting_number("particle_count", 1),
|
||||
tick_speed = get_setting_number("tick_speed", 1),
|
||||
volume = get_setting_number("volume", 1)
|
||||
volume = get_setting_number("volume", 1),
|
||||
ceiling_checks = get_setting_number("ceiling_checks", 10),
|
||||
}
|
||||
|
||||
climate_mod.i18n = minetest.get_translator("climate_api")
|
||||
|
@ -58,6 +58,21 @@ climate_api.register_influence("daylight", function(pos)
|
||||
return minetest.get_node_light(pos, 0.5) or 0
|
||||
end)
|
||||
|
||||
climate_api.register_influence("indoors", function(pos)
|
||||
pos = vector.add(pos, {x = 0, y = 1, z = 0})
|
||||
local daylight = minetest.get_node_light(pos, 0.5) or 0
|
||||
if daylight < 15 then return true end
|
||||
|
||||
for i = 1, climate_mod.settings.ceiling_checks do
|
||||
local lpos = vector.add(pos, {x = 0, y = i, z = 0})
|
||||
local node = minetest.get_node_or_nil(lpos)
|
||||
if node ~= nil and node.name ~= "air" and node.name ~= "ignore" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end)
|
||||
|
||||
climate_api.register_global_influence("time",
|
||||
minetest.get_timeofday
|
||||
)
|
2
mod.conf
2
mod.conf
@ -1,7 +1,7 @@
|
||||
name = climate_api
|
||||
title = Climate API
|
||||
author = TestificateMods
|
||||
release = 10000
|
||||
release = 10001
|
||||
optional_depends = player_monoids, playerphysics, pova
|
||||
description = """
|
||||
A powerful engine for weather presets and visual effects.
|
||||
|
@ -19,6 +19,10 @@ climate_api_block_updates (Dynamically modify nodes) bool true
|
||||
# Only applied if climate_api_damage is also set to true.
|
||||
climate_api_raycast (Include wind speed in damage checks) bool true
|
||||
|
||||
# Increase this number if you notice snow or rain inside large glass domes.
|
||||
# Decrease this number if you notice lag spikes or overall reduced game performance.
|
||||
ceiling_checks (Check x nodes on outdoor test) int 10 0 50
|
||||
|
||||
|
||||
[Weather Effects]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user