2020-04-13 01:58:27 +02:00
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
local modpath = minetest.get_modpath(modname)
|
|
|
|
|
|
|
|
local function get_setting_bool(name, default)
|
2020-04-16 19:13:14 +02:00
|
|
|
local value = minetest.settings:get_bool("regional_weather_" .. name)
|
|
|
|
if type(value) == "nil" then value = default end
|
|
|
|
return minetest.is_yes(value)
|
2020-04-13 01:58:27 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local function get_setting_number(name, default)
|
2020-04-16 19:13:14 +02:00
|
|
|
local value = minetest.settings:get("regional_weather_" .. name)
|
|
|
|
if type(value) == "nil" then value = default end
|
|
|
|
return tonumber(value)
|
2020-04-13 01:58:27 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
regional_weather = {}
|
|
|
|
regional_weather.settings = {}
|
|
|
|
regional_weather.settings.damage = get_setting_bool("damage", true)
|
|
|
|
regional_weather.settings.snow = get_setting_bool("snow_layers", true)
|
|
|
|
regional_weather.settings.puddles = get_setting_bool("puddles", true)
|
|
|
|
regional_weather.settings.soil = get_setting_bool("soil", true)
|
2020-04-16 19:13:14 +02:00
|
|
|
regional_weather.settings.fire = get_setting_bool("fire", true)
|
2020-04-22 00:54:27 +02:00
|
|
|
regional_weather.settings.ice = get_setting_bool("ice", true)
|
2020-04-13 01:58:27 +02:00
|
|
|
regional_weather.settings.max_height = get_setting_number("max_height", 120)
|
|
|
|
regional_weather.settings.min_height = get_setting_number("min_height", -50)
|
|
|
|
|
2020-04-22 00:54:27 +02:00
|
|
|
-- warn about clouds being overriden by MTG weather
|
|
|
|
if climate_mod.settings.skybox
|
|
|
|
and minetest.get_modpath("weather")
|
|
|
|
and get_setting_bool("enable_weather", true) then
|
|
|
|
minetest.log("warning", "[Regional Weather] Disable MTG weather for the best experience")
|
|
|
|
end
|
|
|
|
|
2020-04-13 01:58:27 +02:00
|
|
|
-- import individual weather types
|
2020-04-13 16:52:45 +02:00
|
|
|
dofile(modpath.."/ca_weathers/ambient.lua")
|
2020-04-16 08:04:06 +02:00
|
|
|
dofile(modpath.."/ca_weathers/deep_cave.lua")
|
2020-04-22 00:54:27 +02:00
|
|
|
--dofile(modpath.."/ca_weathers/fog.lua")
|
2020-04-13 16:52:45 +02:00
|
|
|
dofile(modpath.."/ca_weathers/hail.lua")
|
|
|
|
dofile(modpath.."/ca_weathers/pollen.lua")
|
2020-04-13 01:58:27 +02:00
|
|
|
dofile(modpath.."/ca_weathers/rain.lua")
|
|
|
|
dofile(modpath.."/ca_weathers/rain_heavy.lua")
|
2020-04-13 16:52:45 +02:00
|
|
|
dofile(modpath.."/ca_weathers/sandstorm.lua")
|
2020-04-13 01:58:27 +02:00
|
|
|
dofile(modpath.."/ca_weathers/snow.lua")
|
|
|
|
dofile(modpath.."/ca_weathers/snow_heavy.lua")
|
|
|
|
dofile(modpath.."/ca_weathers/storm.lua")
|
|
|
|
|
|
|
|
-- register environment effects
|
2020-04-16 19:13:14 +02:00
|
|
|
dofile(modpath.."/ca_effects/damage.lua")
|
2020-04-13 01:58:27 +02:00
|
|
|
dofile(modpath.."/ca_effects/lightning.lua")
|
2020-04-16 19:13:14 +02:00
|
|
|
dofile(modpath.."/ca_effects/speed_buff.lua")
|
|
|
|
|
|
|
|
-- register ABM cycles and custom nodes
|
|
|
|
dofile(modpath .. "/abms/puddle.lua")
|
|
|
|
dofile(modpath .. "/abms/snow_cover.lua")
|
|
|
|
dofile(modpath .. "/abms/fire.lua")
|
2020-04-22 00:54:27 +02:00
|
|
|
dofile(modpath .. "/abms/ice.lua")
|
2020-04-18 17:26:01 +02:00
|
|
|
dofile(modpath .. "/abms/soil.lua")
|