climate_api/init.lua

43 lines
1.5 KiB
Lua
Raw Normal View History

2020-04-13 01:55:39 +02:00
assert(minetest.add_particlespawner, "[Climate API] This mod requires a more current version of Minetest")
2020-04-09 09:03:02 +02:00
2020-04-13 01:55:39 +02:00
climate_api = {}
climate_mod = {}
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
2020-04-09 09:03:02 +02:00
local function getBoolSetting(name, default)
2020-04-13 01:55:39 +02:00
return minetest.is_yes(minetest.settings:get_bool("climate_api_" .. name) or default)
2020-04-09 09:03:02 +02:00
end
local function getNumericSetting(name, default)
2020-04-13 01:55:39 +02:00
return tonumber(minetest.settings:get("climate_api_" .. name) or default)
2020-04-09 09:03:02 +02:00
end
-- load settings from config file
2020-04-13 01:55:39 +02:00
climate_mod.settings = {
2020-04-09 09:59:40 +02:00
particles = getBoolSetting("particles", true),
2020-04-09 09:03:02 +02:00
skybox = getBoolSetting("skybox", true),
2020-04-13 01:55:39 +02:00
sound = getBoolSetting("sound", true),
2020-04-09 09:03:02 +02:00
wind = getBoolSetting("wind", true),
seasons = getBoolSetting("seasons", true),
2020-04-13 01:55:39 +02:00
heat = getNumericSetting("heat_base", 0),
humidity = getNumericSetting("humidity_base", 0)
2020-04-09 09:03:02 +02:00
}
2020-04-13 01:55:39 +02:00
climate_mod.current_weather = {}
climate_mod.current_effects = {}
2020-04-09 09:03:02 +02:00
-- import core API
2020-04-13 01:55:39 +02:00
climate_mod.state = dofile(modpath .. "/lib/datastorage.lua")
climate_api = dofile(modpath .. "/lib/api.lua")
climate_api.utility = dofile(modpath .. "/lib/api_utility.lua")
climate_api.environment = dofile(modpath .. "/lib/environment.lua")
climate_mod.world = dofile(modpath .. "/lib/world.lua")
climate_mod.trigger = dofile(modpath .. "/lib/trigger.lua")
dofile(modpath.."/lib/main.lua")
-- import predefined environment effects
dofile(modpath .. "/ca_effects/particles.lua")
dofile(modpath .. "/ca_effects/skybox.lua")