mirror of
https://github.com/t-affeldt/climate_api.git
synced 2025-07-05 01:40:38 +02:00
Tweak world cycle, add documentation
This commit is contained in:
18
init.lua
18
init.lua
@ -1,17 +1,22 @@
|
||||
-- warn about outdated Minetest versions
|
||||
assert(minetest.add_particlespawner, "[Climate API] This mod requires a more current version of Minetest")
|
||||
|
||||
-- initialize global API interfaces
|
||||
climate_api = {}
|
||||
climate_mod = {}
|
||||
|
||||
-- set mod path for file imports
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
-- retrieve boolean value from mod config
|
||||
local function get_setting_bool(name, default)
|
||||
local value = minetest.settings:get_bool("climate_api_" .. name)
|
||||
if type(value) == "nil" then value = default end
|
||||
return minetest.is_yes(value)
|
||||
end
|
||||
|
||||
-- retrive numeric value from mod config
|
||||
local function get_setting_number(name, default)
|
||||
local value = minetest.settings:get("climate_api_" .. name)
|
||||
if type(value) == "nil" then value = default end
|
||||
@ -36,7 +41,7 @@ climate_mod.settings = {
|
||||
volume = get_setting_number("volume", 1)
|
||||
}
|
||||
|
||||
-- initiate empty registers
|
||||
-- initialize empty registers
|
||||
climate_mod.weathers = {}
|
||||
climate_mod.effects = {}
|
||||
climate_mod.cycles = {}
|
||||
@ -48,19 +53,24 @@ climate_mod.current_effects = {}
|
||||
climate_mod.forced_weather = {}
|
||||
climate_mod.forced_wind = nil
|
||||
|
||||
-- import core API
|
||||
-- handle persistent mod storage
|
||||
climate_mod.state = dofile(modpath .. "/lib/datastorage.lua")
|
||||
|
||||
-- import core API
|
||||
climate_api = dofile(modpath .. "/lib/api.lua")
|
||||
climate_api.utility = dofile(modpath .. "/lib/api_utility.lua")
|
||||
climate_api.skybox = dofile(modpath .. "/lib/skybox_merger.lua")
|
||||
dofile(modpath .. "/lib/influences.lua")
|
||||
climate_api.environment = dofile(modpath .. "/lib/environment.lua")
|
||||
--climate_api = dofile(modpath .. "/lib/influences.lua")
|
||||
climate_mod.world = dofile(modpath .. "/lib/world.lua")
|
||||
climate_mod.trigger = dofile(modpath .. "/lib/trigger.lua")
|
||||
|
||||
-- start event loop and register chat commands
|
||||
dofile(modpath.."/lib/main.lua")
|
||||
dofile(modpath.."/lib/commands.lua")
|
||||
|
||||
-- register environment influences
|
||||
dofile(modpath .. "/lib/influences.lua")
|
||||
|
||||
-- import predefined environment effects
|
||||
dofile(modpath .. "/ca_effects/hud_overlay.lua")
|
||||
dofile(modpath .. "/ca_effects/particles.lua")
|
||||
|
Reference in New Issue
Block a user