summaryrefslogtreecommitdiff
path: root/mesecons/settings.lua
diff options
context:
space:
mode:
authorJeija <jeija@mesecons.net>2014-11-22 22:09:26 +0100
committerJeija <jeija@mesecons.net>2014-11-22 22:09:26 +0100
commitf977ac821aa2f6c7053ec7f65d289c57de1e91a8 (patch)
tree2d025fd6483e1ac3e4c409a356d2015aada00778 /mesecons/settings.lua
parent80d136125ef8f17af85d0045800d5e761ace3229 (diff)
downloadmesecons-f977ac821aa2f6c7053ec7f65d289c57de1e91a8.tar
mesecons-f977ac821aa2f6c7053ec7f65d289c57de1e91a8.tar.gz
mesecons-f977ac821aa2f6c7053ec7f65d289c57de1e91a8.tar.bz2
mesecons-f977ac821aa2f6c7053ec7f65d289c57de1e91a8.tar.xz
mesecons-f977ac821aa2f6c7053ec7f65d289c57de1e91a8.zip
Re-implement settings system:
Settings can now be retrieved by mesecon.setting(<name>, <default>) and can be modified without editing the source code by adding the setting to minetest.conf For instance, you can add mesecon.blinky_plant_interval = 0.5 to minetest.conf in order to increase the blinking speed. Rewrite the blinky plant with nodetimers. Fixes #161
Diffstat (limited to 'mesecons/settings.lua')
-rw-r--r--mesecons/settings.lua22
1 files changed, 9 insertions, 13 deletions
diff --git a/mesecons/settings.lua b/mesecons/settings.lua
index eb34f17..164cb57 100644
--- a/mesecons/settings.lua
+++ b/mesecons/settings.lua
@@ -1,14 +1,10 @@
-- SETTINGS
-BLINKY_PLANT_INTERVAL = 3
-NEW_STYLE_WIRES = true -- true = new nodebox wires, false = old raillike wires
-PRESSURE_PLATE_INTERVAL = 0.1
-OBJECT_DETECTOR_RADIUS = 6
-PISTON_MAXIMUM_PUSH = 15
-MOVESTONE_MAXIMUM_PUSH = 100
-MESECONS_RESUMETIME = 4 -- time to wait when starting the server before
- -- processing the ActionQueue, don't set this too low
-OVERHEAT_MAX = 20 -- maximum heat of any component that directly sends an output
- -- signal when the input changes (e.g. luacontroller, gates)
- -- Unit: actions per second, checks are every 1 second
-STACK_SIZE = 3000 -- Recursive functions will abort when this is reached. Therefore,
- -- this is also limits the maximum circuit size.
+function mesecon.setting(setting, default)
+ if type(default) == "bool" then
+ return minetest.setting_getbool("mesecon."..setting) or default
+ elseif type(default) == "string" then
+ return minetest.setting_get("mesecon."..setting) or default
+ elseif type(default) == "number" then
+ return tonumber(minetest.setting_get("mesecon."..setting) or default)
+ end
+end