digtron/config.lua

55 lines
2.1 KiB
Lua
Raw Normal View History

2017-09-11 23:20:52 -07:00
local CONFIG_FILE_PREFIX = "digtron_"
digtron.config = {}
local print_settingtypes = false
local function setting(stype, name, default, description)
local value
if stype == "bool" then
2017-10-02 12:49:23 -07:00
value = minetest.settings:get_bool(CONFIG_FILE_PREFIX..name)
2017-09-11 23:20:52 -07:00
elseif stype == "string" then
2017-10-02 12:49:23 -07:00
value = minetest.settings:get(CONFIG_FILE_PREFIX..name)
2017-09-11 23:20:52 -07:00
elseif stype == "int" or stype == "float" then
2017-10-02 12:49:23 -07:00
value = tonumber(minetest.settings:get(CONFIG_FILE_PREFIX..name))
2017-09-11 23:20:52 -07:00
end
if value == nil then
value = default
end
digtron.config[name] = value
2017-10-02 12:49:23 -07:00
2017-09-11 23:20:52 -07:00
if print_settingtypes then
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
2017-10-02 12:49:23 -07:00
end
2017-09-11 23:20:52 -07:00
end
2017-09-11 23:20:52 -07:00
setting("bool", "uses_resources", true, "Digtron uses resources when active")
setting("bool", "lava_impassible", true, "Lava counts as a protected node")
setting("bool", "damage_creatures", true, "Diggers damage creatures")
2017-09-11 23:20:52 -07:00
-- Enables the spray of particles out the back of a digger head and puffs of smoke from the controller
local particle_effects = minetest.settings:get_bool("enable_particles")
digtron.config.particle_effects = particle_effects or particle_effects == nil -- default true
2017-09-11 23:20:52 -07:00
setting("int", "maximum_extrusion", 25, "Maximum builder extrusion distance")
setting("float", "cycle_time", 1.0, "Minimum Digtron cycle time")
setting("float", "traction_factor", 3.0, "Traction factor")
-- fuel costs. For comparison, in the default game:
-- one default tree block is 30 units
-- one coal lump is 40 units
-- one coal block is 370 units (apparently it's slightly more productive making your coal lumps into blocks before burning)
-- one book is 3 units
-- how much fuel is required to dig a node if not in one of the following groups.
2017-09-11 23:20:52 -07:00
setting("float", "dig_cost_default", 3.0, "Default dig cost")
-- eg, stone
2017-09-11 23:20:52 -07:00
setting("float", "dig_cost_cracky", 1.0, "Cracky dig cost")
-- eg, dirt, sand
2017-09-11 23:20:52 -07:00
setting("float", "dig_cost_crumbly", 0.5, "Crumbly dig cost")
-- eg, wood
2017-09-11 23:20:52 -07:00
setting("float", "dig_cost_choppy", 0.75, "Choppy dig cost")
-- how much fuel is required to build a node
2017-09-11 23:20:52 -07:00
setting("float", "build_cost", 1.0, "Build cost")