digtron/config.lua

59 lines
2.4 KiB
Lua
Raw Normal View History

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
2017-10-02 21:49:23 +02:00
value = minetest.settings:get_bool(CONFIG_FILE_PREFIX..name)
2017-09-12 08:20:52 +02:00
elseif stype == "string" then
2017-10-02 21:49:23 +02:00
value = minetest.settings:get(CONFIG_FILE_PREFIX..name)
2017-09-12 08:20:52 +02:00
elseif stype == "int" or stype == "float" then
2017-10-02 21:49:23 +02:00
value = tonumber(minetest.settings:get(CONFIG_FILE_PREFIX..name))
2017-09-12 08:20:52 +02:00
end
if value == nil then
value = default
end
digtron.config[name] = value
2017-10-02 21:49:23 +02:00
2017-09-12 08:20:52 +02:00
if print_settingtypes then
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
2017-10-02 21:49:23 +02:00
end
2017-09-12 08:20:52 +02:00
end
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-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-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")
-- 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")
-- eg, stone
2017-09-12 08:20:52 +02:00
setting("float", "dig_cost_cracky", 1.0, "Cracky dig cost")
-- eg, dirt, sand
2017-09-12 08:20:52 +02:00
setting("float", "dig_cost_crumbly", 0.5, "Crumbly dig cost")
-- eg, wood
2017-09-12 08:20:52 +02:00
setting("float", "dig_cost_choppy", 0.75, "Choppy dig cost")
-- 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")
2017-10-10 21:02:35 +02:00
-- How much charge (an RE battery holds 10000 EU) is equivalent to 1 unit of heat produced by burning coal
-- With 100, the battery is 2.5 better than a coal lump, yet 3.7 less powerful than a coal block
-- Being rechargeable should pay off for this "average" performance.
setting("int", "power_ratio", 100, "The electrical charge to 1 coal heat unit conversion ratio")