2020-04-13 01:58:27 +02:00
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
local modpath = minetest.get_modpath(modname)
|
|
|
|
|
2020-05-16 16:20:47 +02:00
|
|
|
local function get_setting_bool(name, default, is_global)
|
|
|
|
local prefix = ""
|
|
|
|
if not is_global then prefix = "regional_weather_" end
|
|
|
|
local value = minetest.settings:get_bool(prefix .. name)
|
2020-04-16 19:13:14 +02:00
|
|
|
if type(value) == "nil" then value = default end
|
|
|
|
return minetest.is_yes(value)
|
2020-04-13 01:58:27 +02:00
|
|
|
end
|
|
|
|
|
2020-05-16 16:20:47 +02:00
|
|
|
local function get_setting_number(name, default, is_global)
|
|
|
|
local prefix = ""
|
|
|
|
if not is_global then prefix = "regional_weather_" end
|
|
|
|
local value = minetest.settings:get(prefix .. name)
|
2020-04-16 19:13:14 +02:00
|
|
|
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 = {}
|
2023-02-22 05:22:45 +01:00
|
|
|
regional_weather.settings.player_speed = get_setting_bool("player_speed", false)
|
2020-05-16 05:02:01 +02:00
|
|
|
regional_weather.settings.snow = get_setting_bool("snow_layers", true)
|
2020-10-08 14:29:17 +02:00
|
|
|
regional_weather.settings.snow_griefing = get_setting_bool("snow_griefing", true)
|
2020-05-16 05:02:01 +02:00
|
|
|
regional_weather.settings.puddles = get_setting_bool("puddles", true)
|
2020-10-08 15:42:43 +02:00
|
|
|
regional_weather.settings.puddles_water = get_setting_bool("puddles_water", false)
|
2020-05-16 05:02:01 +02:00
|
|
|
regional_weather.settings.soil = get_setting_bool("soil", true)
|
|
|
|
regional_weather.settings.fire = get_setting_bool("fire", true)
|
|
|
|
regional_weather.settings.ice = get_setting_bool("ice", true)
|
|
|
|
regional_weather.settings.pedology = get_setting_bool("pedology", true)
|
2020-05-16 16:20:47 +02:00
|
|
|
regional_weather.settings.lightning = get_setting_number("lightning", 1)
|
2020-05-16 05:02:01 +02:00
|
|
|
regional_weather.settings.max_height = get_setting_number("max_height", 120)
|
|
|
|
regional_weather.settings.min_height = get_setting_number("min_height", -50)
|
|
|
|
regional_weather.settings.cloud_height = get_setting_number("cloud_height", 120)
|
|
|
|
regional_weather.settings.cloud_scale = get_setting_number("cloud_scale", 40)
|
2020-04-13 01:58:27 +02:00
|
|
|
|
2020-10-10 12:53:48 +02:00
|
|
|
local S = minetest.get_translator("regional_weather")
|
|
|
|
regional_weather.i18n = S
|
2020-05-29 22:02:12 +02:00
|
|
|
|
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-24 01:36:58 +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
|
|
|
|
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-26 18:10:46 +02:00
|
|
|
dofile(modpath .. "/abms/pedology.lua")
|
2020-04-18 17:26:01 +02:00
|
|
|
dofile(modpath .. "/abms/soil.lua")
|