mirror of
https://github.com/t-affeldt/climate_api.git
synced 2025-07-05 01:40:38 +02:00
Fix countless bugs, implement chat commands
This commit is contained in:
14
init.lua
14
init.lua
@ -7,11 +7,15 @@ local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
local function getBoolSetting(name, default)
|
||||
return minetest.is_yes(minetest.settings:get_bool("climate_api_" .. name) or default)
|
||||
local value = minetest.settings:get_bool("climate_api_" .. name)
|
||||
if type(value) == "nil" then value = default end
|
||||
return minetest.is_yes(value)
|
||||
end
|
||||
|
||||
local function getNumericSetting(name, default)
|
||||
return tonumber(minetest.settings:get("climate_api_" .. name) or default)
|
||||
local value = minetest.settings:get("climate_api_" .. name)
|
||||
if type(value) == "nil" then value = default end
|
||||
return tonumber(value)
|
||||
end
|
||||
|
||||
-- load settings from config file
|
||||
@ -21,14 +25,19 @@ climate_mod.settings = {
|
||||
sound = getBoolSetting("sound", true),
|
||||
wind = getBoolSetting("wind", true),
|
||||
seasons = getBoolSetting("seasons", true),
|
||||
fahrenheit = getBoolSetting("fahrenheit", false),
|
||||
heat = getNumericSetting("heat_base", 0),
|
||||
humidity = getNumericSetting("humidity_base", 0),
|
||||
time_spread = getNumericSetting("time_spread", 1),
|
||||
particle_count = getNumericSetting("particle_count", 1)
|
||||
}
|
||||
|
||||
-- initiate empty registers
|
||||
climate_mod.current_weather = {}
|
||||
climate_mod.current_effects = {}
|
||||
climate_mod.weathers = {}
|
||||
climate_mod.effects = {}
|
||||
climate_mod.cycles = {}
|
||||
|
||||
-- import core API
|
||||
climate_mod.state = dofile(modpath .. "/lib/datastorage.lua")
|
||||
@ -38,6 +47,7 @@ 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")
|
||||
dofile(modpath.."/lib/commands.lua")
|
||||
|
||||
-- import predefined environment effects
|
||||
dofile(modpath .. "/ca_effects/particles.lua")
|
||||
|
Reference in New Issue
Block a user