2017-09-12 08:20:52 +02: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
|
|
|
|
value = minetest.setting_getbool(CONFIG_FILE_PREFIX..name)
|
|
|
|
elseif stype == "string" then
|
|
|
|
value = minetest.setting_get(CONFIG_FILE_PREFIX..name)
|
|
|
|
elseif stype == "int" or stype == "float" then
|
|
|
|
value = tonumber(minetest.setting_get(CONFIG_FILE_PREFIX..name))
|
|
|
|
end
|
|
|
|
if value == nil then
|
|
|
|
value = default
|
|
|
|
end
|
|
|
|
digtron.config[name] = value
|
|
|
|
|
|
|
|
if print_settingtypes then
|
|
|
|
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
|
|
|
|
end
|
|
|
|
end
|
2017-09-11 02:58:25 +02:00
|
|
|
|
2017-09-12 08:20:52 +02: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 02:58:25 +02:00
|
|
|
|
2017-09-12 08:20:52 +02: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 02:58:25 +02:00
|
|
|
|
|
|
|
|
2017-09-12 08:20:52 +02: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")
|
2017-09-11 02:58:25 +02:00
|
|
|
|
|
|
|
-- 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-12 08:20:52 +02:00
|
|
|
setting("float", "dig_cost_default", 3.0, "Default dig cost")
|
2017-09-11 02:58:25 +02:00
|
|
|
-- eg, stone
|
2017-09-12 08:20:52 +02:00
|
|
|
setting("float", "dig_cost_cracky", 1.0, "Cracky dig cost")
|
2017-09-11 02:58:25 +02:00
|
|
|
-- eg, dirt, sand
|
2017-09-12 08:20:52 +02:00
|
|
|
setting("float", "dig_cost_crumbly", 0.5, "Crumbly dig cost")
|
2017-09-11 02:58:25 +02:00
|
|
|
-- eg, wood
|
2017-09-12 08:20:52 +02:00
|
|
|
setting("float", "dig_cost_choppy", 0.75, "Choppy dig cost")
|
2017-09-11 02:58:25 +02:00
|
|
|
-- how much fuel is required to build a node
|
2017-09-12 08:20:52 +02:00
|
|
|
setting("float", "build_cost", 1.0, "Build cost")
|