From 2ab287a64f76ebb572fb87caea2cba82c531a2b6 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Tue, 7 Aug 2018 22:47:59 +0300 Subject: [PATCH] Add a settings option to enable easier crafting --- elepower_dynamics/crafting.lua | 101 ++++++++++++------ elepower_dynamics/worldgen.lua | 64 +++++------ elepower_farming/crafting.lua | 10 +- elepower_farming/nodes/harvester.lua | 4 +- elepower_farming/nodes/planter.lua | 2 +- elepower_farming/nodes/spawner.lua | 2 +- elepower_machines/crafting.lua | 36 +++++-- elepower_machines/machines/bases/crafter.lua | 7 +- .../machines/bases/fluidgenerator.lua | 5 +- .../machines/bases/generator.lua | 66 ++++++------ elepower_machines/machines/bases/storage.lua | 4 +- elepower_nuclear/crafting.lua | 8 +- elepower_papi/formspec.lua | 11 +- elepower_wireless/crafting.lua | 12 ++- settingtypes.txt | 5 + 15 files changed, 214 insertions(+), 123 deletions(-) create mode 100644 settingtypes.txt diff --git a/elepower_dynamics/crafting.lua b/elepower_dynamics/crafting.lua index 6dc2ff3..4197ae4 100644 --- a/elepower_dynamics/crafting.lua +++ b/elepower_dynamics/crafting.lua @@ -1,4 +1,6 @@ +local easycrafting = minetest.settings:get("elepower_easy_crafting") == "true" + --------------- -- Overrides -- --------------- @@ -125,16 +127,6 @@ minetest.register_craft({ } }) --- Fluid Transfer Node -minetest.register_craft({ - output = "elepower_dynamics:fluid_transfer_node", - recipe = { - {"group:stone", "elepower_dynamics:control_circuit", "group:stone"}, - {"elepower_dynamics:viridisium_gear", "elepower_dynamics:servo_valve", "elepower_dynamics:viridisium_gear"}, - {"group:stone", "elepower_dynamics:fluid_duct", "group:stone"}, - } -}) - -- Portable Tank minetest.register_craft({ output = "elepower_dynamics:portable_tank", @@ -210,30 +202,73 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = "elepower_dynamics:pcb_blank", - recipe = { - {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, - {"default:copper_ingot", "default:mese_crystal", "default:copper_ingot"}, - {"default:gold_ingot", "elepower_dynamics:viridisium_ingot", "default:gold_ingot"}, - } -}) +if easycrafting then + minetest.register_craft({ + output = "elepower_dynamics:pcb_blank", + recipe = { + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "default:mese_crystal", "default:copper_ingot"}, + {"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"}, + } + }) -minetest.register_craft({ - type = "shapeless", - output = "elepower_dynamics:acidic_compound", - recipe = { - "elepower_dynamics:viridisium_dust", - "elepower_dynamics:viridisium_dust", - "elepower_dynamics:viridisium_dust", - "elepower_dynamics:viridisium_dust", - "elepower_dynamics:copper_dust", - "elepower_dynamics:copper_dust", - "elepower_dynamics:copper_dust", - "elepower_dynamics:copper_dust", - "farming:seed_wheat", - } -}) + minetest.register_craft({ + type = "shapeless", + output = "elepower_dynamics:acidic_compound", + recipe = { + "elepower_dynamics:copper_dust", + "elepower_dynamics:copper_dust", + "elepower_dynamics:copper_dust", + "elepower_dynamics:copper_dust", + "farming:seed_wheat", + } + }) + + -- Fluid Transfer Node + minetest.register_craft({ + output = "elepower_dynamics:fluid_transfer_node", + recipe = { + {"group:stone", "elepower_dynamics:control_circuit", "group:stone"}, + {"elepower_dynamics:electrum_gear", "elepower_dynamics:servo_valve", "elepower_dynamics:electrum_gear"}, + {"group:stone", "elepower_dynamics:fluid_duct", "group:stone"}, + } + }) +else + minetest.register_craft({ + output = "elepower_dynamics:pcb_blank", + recipe = { + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "default:mese_crystal", "default:copper_ingot"}, + {"default:gold_ingot", "elepower_dynamics:viridisium_ingot", "default:gold_ingot"}, + } + }) + + minetest.register_craft({ + type = "shapeless", + output = "elepower_dynamics:acidic_compound", + recipe = { + "elepower_dynamics:viridisium_dust", + "elepower_dynamics:viridisium_dust", + "elepower_dynamics:viridisium_dust", + "elepower_dynamics:viridisium_dust", + "elepower_dynamics:copper_dust", + "elepower_dynamics:copper_dust", + "elepower_dynamics:copper_dust", + "elepower_dynamics:copper_dust", + "farming:seed_wheat", + } + }) + + -- Fluid Transfer Node + minetest.register_craft({ + output = "elepower_dynamics:fluid_transfer_node", + recipe = { + {"group:stone", "elepower_dynamics:control_circuit", "group:stone"}, + {"elepower_dynamics:viridisium_gear", "elepower_dynamics:servo_valve", "elepower_dynamics:viridisium_gear"}, + {"group:stone", "elepower_dynamics:fluid_duct", "group:stone"}, + } + }) +end minetest.register_craft({ output = "elepower_dynamics:integrated_circuit", diff --git a/elepower_dynamics/worldgen.lua b/elepower_dynamics/worldgen.lua index 77a97b0..a1e6f4a 100644 --- a/elepower_dynamics/worldgen.lua +++ b/elepower_dynamics/worldgen.lua @@ -1,4 +1,6 @@ +local easycrafting = minetest.settings:get("elepower_easy_crafting") == true + -------------- -- Worldgen -- -------------- @@ -64,38 +66,40 @@ minetest.register_ore({ -- Viridisium -minetest.register_ore({ - ore_type = "scatter", - ore = "elepower_dynamics:stone_with_viridisium", - wherein = "default:stone", - clust_scarcity = 25 * 25 * 25, - clust_num_ores = 5, - clust_size = 3, - y_max = -1028, - y_min = -31000, -}) +if not easycrafting then + minetest.register_ore({ + ore_type = "scatter", + ore = "elepower_dynamics:stone_with_viridisium", + wherein = "default:stone", + clust_scarcity = 25 * 25 * 25, + clust_num_ores = 5, + clust_size = 3, + y_max = -1028, + y_min = -31000, + }) -minetest.register_ore({ - ore_type = "scatter", - ore = "elepower_dynamics:stone_with_viridisium", - wherein = "default:stone", - clust_scarcity = 20 * 20 * 20, - clust_num_ores = 5, - clust_size = 3, - y_max = -8096, - y_min = -31000, -}) + minetest.register_ore({ + ore_type = "scatter", + ore = "elepower_dynamics:stone_with_viridisium", + wherein = "default:stone", + clust_scarcity = 20 * 20 * 20, + clust_num_ores = 5, + clust_size = 3, + y_max = -8096, + y_min = -31000, + }) -minetest.register_ore({ - ore_type = "scatter", - ore = "elepower_dynamics:stone_with_viridisium", - wherein = "default:stone", - clust_scarcity = 10 * 10 * 10, - clust_num_ores = 5, - clust_size = 3, - y_max = -12000, - y_min = -31000, -}) + minetest.register_ore({ + ore_type = "scatter", + ore = "elepower_dynamics:stone_with_viridisium", + wherein = "default:stone", + clust_scarcity = 10 * 10 * 10, + clust_num_ores = 5, + clust_size = 3, + y_max = -12000, + y_min = -31000, + }) +end -- Zinc diff --git a/elepower_farming/crafting.lua b/elepower_farming/crafting.lua index 1049e52..3bc11f3 100644 --- a/elepower_farming/crafting.lua +++ b/elepower_farming/crafting.lua @@ -1,4 +1,10 @@ +local easycrafting = minetest.settings:get("elepower_easy_crafting") == "true" +local ingot = "elepower_dynamics:viridisium_ingot" +if easycrafting then + ingot = "elepower_dynamics:wound_copper_coil" +end + ----------- -- Nodes -- ----------- @@ -17,7 +23,7 @@ minetest.register_craft({ minetest.register_craft({ output = "elepower_farming:planter", recipe = { - {"elepower_dynamics:viridisium_ingot", "elepower_dynamics:control_circuit", "elepower_dynamics:viridisium_ingot"}, + {ingot, "elepower_dynamics:control_circuit", ingot}, {"farming:hoe_steel", "elepower_farming:device_frame", "farming:hoe_steel"}, {"elepower_dynamics:wound_copper_coil", "elepower_dynamics:motor", "elepower_dynamics:wound_copper_coil"}, } @@ -27,7 +33,7 @@ minetest.register_craft({ minetest.register_craft({ output = "elepower_farming:harvester", recipe = { - {"elepower_dynamics:viridisium_ingot", "elepower_dynamics:control_circuit", "elepower_dynamics:viridisium_ingot"}, + {ingot, "elepower_dynamics:control_circuit", ingot}, {"default:axe_steel", "elepower_farming:device_frame", "farming:hoe_steel"}, {"elepower_dynamics:motor", "elepower_dynamics:diamond_gear", "elepower_dynamics:motor"}, } diff --git a/elepower_farming/nodes/harvester.lua b/elepower_farming/nodes/harvester.lua index 1ff9681..136423a 100644 --- a/elepower_farming/nodes/harvester.lua +++ b/elepower_farming/nodes/harvester.lua @@ -135,7 +135,7 @@ local function on_timer(pos, elapsed) ele.helpers.swap_node(pos, "elepower_farming:harvester") end - local power = {capacity = capacity, storage = storage} + local power = {capacity = capacity, storage = storage, usage = usage} local work_percent = math.floor((work / HARVESTER_TICK)*100) meta:set_string("formspec", get_formspec(work_percent, power, sludge)) @@ -180,7 +180,7 @@ ele.register_machine("elepower_farming:harvester", { meta:set_int("src_time", 0) local capacity = ele.helpers.get_node_property(meta, pos, "capacity") - meta:set_string("formspec", get_formspec(0, {capacity = capacity, storage = 0})) + meta:set_string("formspec", get_formspec(0, {capacity = capacity, storage = 0, usage = 0})) local node = minetest.get_node(pos) end, diff --git a/elepower_farming/nodes/planter.lua b/elepower_farming/nodes/planter.lua index 611cd83..5e1fc6b 100644 --- a/elepower_farming/nodes/planter.lua +++ b/elepower_farming/nodes/planter.lua @@ -252,7 +252,7 @@ local function on_timer(pos, elapsed) refresh = true end - local power = {capacity = capacity, storage = storage} + local power = {capacity = capacity, storage = storage, usage = usage} local work_percent = math.floor((work / PLANTER_TICK)*100) meta:set_string("formspec", get_formspec(work_percent, power)) diff --git a/elepower_farming/nodes/spawner.lua b/elepower_farming/nodes/spawner.lua index 3911fae..3dd4f67 100644 --- a/elepower_farming/nodes/spawner.lua +++ b/elepower_farming/nodes/spawner.lua @@ -150,7 +150,7 @@ local function on_timer(pos, elapsed) meta:set_string("infotext", ("Powered Mob Spawner %s\nMob: %s\n%s"):format( active, mob_desc, ele.capacity_text(capacity, storage))) - local power = {capacity = capacity, storage = storage} + local power = {capacity = capacity, storage = storage, usage = usage} local work_percent = math.floor((work / SPAWNER_TICK)*100) meta:set_string("formspec", get_formspec(work_percent, power)) diff --git a/elepower_machines/crafting.lua b/elepower_machines/crafting.lua index 2dc1d46..f936e04 100644 --- a/elepower_machines/crafting.lua +++ b/elepower_machines/crafting.lua @@ -1,4 +1,6 @@ +local easycrafting = minetest.settings:get("elepower_easy_crafting") == "true" + --*****************-- -- MACHINE RECIPES -- --*****************-- @@ -142,12 +144,21 @@ for name in pairs(minetest.registered_nodes) do end end -elepm.register_craft({ - type = "compress", - recipe = { "elepower_dynamics:viridisium_block 9" }, - output = "elepower_dynamics:xycrone_lump", - time = 20, -}) +if easycrafting then + elepm.register_craft({ + type = "compress", + recipe = { "default:steel_block 9" }, + output = "elepower_dynamics:xycrone_lump", + time = 20, + }) +else + elepm.register_craft({ + type = "compress", + recipe = { "elepower_dynamics:viridisium_block 9" }, + output = "elepower_dynamics:xycrone_lump", + time = 20, + }) +end ------------- -- Sawmill -- @@ -188,6 +199,10 @@ end) --------------- -- Soldering -- --------------- +local induction_dust = "elepower_dynamics:viridisium_dust" +if easycrafting then + induction_dust = "elepower_dynamics:zinc_dust" +end local soldering_recipes = { { @@ -216,7 +231,7 @@ local soldering_recipes = { time = 16, }, { - recipe = { "elepower_dynamics:induction_coil 4", "elepower_dynamics:copper_wire", "elepower_dynamics:viridisium_dust 2" }, + recipe = { "elepower_dynamics:induction_coil 4", "elepower_dynamics:copper_wire", induction_dust .. " 2" }, output = "elepower_dynamics:induction_coil_advanced", time = 18, } @@ -265,11 +280,16 @@ minetest.register_craft({ } }) +local ingot_machine = "elepower_dynamics:viridisium_ingot" +if easycrafting then + ingot_machine = "default:steel_ingot" +end + -- Machine block minetest.register_craft({ output = "elepower_machines:machine_block", recipe = { - {"elepower_dynamics:viridisium_ingot", "default:steel_ingot", "elepower_dynamics:viridisium_ingot"}, + {ingot_machine, "default:steel_ingot", ingot_machine}, {"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"}, {"elepower_dynamics:viridisium_ingot", "elepower_dynamics:motor", "elepower_dynamics:viridisium_ingot"}, } diff --git a/elepower_machines/machines/bases/crafter.lua b/elepower_machines/machines/bases/crafter.lua index fd36f19..ad1c4d4 100644 --- a/elepower_machines/machines/bases/crafter.lua +++ b/elepower_machines/machines/bases/crafter.lua @@ -96,13 +96,14 @@ function elepm.register_crafter(nodename, nodedef) local usage = ele.helpers.get_node_property(meta, pos, "usage") local storage = ele.helpers.get_node_property(meta, pos, "storage") - local pow_buffer = {capacity = capacity, storage = storage} + local pow_buffer = {capacity = capacity, storage = storage, usage = 0} local power_operation = false -- Determine if there is enough power for this action if result.time ~= 0 and storage >= usage then power_operation = true + pow_buffer.usage = usage end if result.time == 0 or not power_operation then @@ -127,7 +128,7 @@ function elepm.register_crafter(nodename, nodedef) -- One step meta:set_int("storage", storage - usage) - pow_buffer = {capacity = capacity, storage = storage} + pow_buffer = {capacity = capacity, storage = storage, usage = usage} time = time + ele.helpers.round(machine_speed * 10) meta:set_string("infotext", ("%s Active"):format(nodedef.description) .. "\n" .. ele.capacity_text(capacity, storage)) @@ -194,7 +195,7 @@ function elepm.register_crafter(nodename, nodedef) local storage = ele.helpers.get_node_property(meta, pos, "storage") local capacity = ele.helpers.get_node_property(meta, pos, "capacity") - local pow_buffer = {capacity = capacity, storage = storage} + local pow_buffer = {capacity = capacity, storage = storage, usage = 0} meta:set_string("formspec", get_formspec(craft_type, pow_buffer, nil, pos)) end diff --git a/elepower_machines/machines/bases/fluidgenerator.lua b/elepower_machines/machines/bases/fluidgenerator.lua index e7390b5..4ca65b5 100644 --- a/elepower_machines/machines/bases/fluidgenerator.lua +++ b/elepower_machines/machines/bases/fluidgenerator.lua @@ -77,7 +77,7 @@ function ele.register_fluid_generator(nodename, nodedef) meta:set_int("burn_time", burn_time) end - pow_buffer = {capacity = capacity, storage = storage} + pow_buffer = {capacity = capacity, storage = storage, usage = 0} -- Burn another bucket of lava if burn_time == 0 then @@ -88,6 +88,7 @@ function ele.register_fluid_generator(nodename, nodedef) -- Take lava flbuffer.amount = flbuffer.amount - 1000 + pow_buffer.usage = generation local active_node = nodename.."_active" ele.helpers.swap_node(pos, active_node) @@ -120,7 +121,7 @@ function ele.register_fluid_generator(nodename, nodedef) local capacity = ele.helpers.get_node_property(meta, pos, "capacity") local storage = ele.helpers.get_node_property(meta, pos, "storage") - meta:set_string("formspec", get_formspec({capacity = capacity, storage = storage}, 0)) + meta:set_string("formspec", get_formspec({capacity = capacity, storage = storage, usage = 0}, 0)) end } diff --git a/elepower_machines/machines/bases/generator.lua b/elepower_machines/machines/bases/generator.lua index 200009e..6196c08 100644 --- a/elepower_machines/machines/bases/generator.lua +++ b/elepower_machines/machines/bases/generator.lua @@ -34,6 +34,7 @@ function elepm.register_fuel_generator(nodename, nodedef) end nodedef.on_timer = function (pos, elapsed) + local refresh = false local meta = minetest.get_meta(pos) local burn_time = meta:get_int("burn_time") @@ -56,48 +57,53 @@ function elepm.register_fuel_generator(nodename, nodedef) meta:set_int("burn_time", burn_time) end - local pow_buffer = {capacity = capacity, storage = storage} + local pow_buffer = {capacity = capacity, storage = storage, usage = 0} - -- Burn another piece of fuel - if burn_time == 0 then - local inv = meta:get_inventory() - if not inv:is_empty("src") then - local fuellist = inv:get_list("src") - local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + while true do + -- Burn another piece of fuel + if burn_time == 0 then + local inv = meta:get_inventory() + if not inv:is_empty("src") then + local fuellist = inv:get_list("src") + local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) - if not fuel or fuel.time == 0 then - ele.helpers.swap_node(pos, nodename) - return false - end - - meta:set_int("burn_time", fuel.time) - meta:set_int("burn_totaltime", fuel.time) - inv:set_stack("src", 1, afterfuel.items[1]) - - if nodedef.ele_active_node then - local active_node = nodename.."_active" - if nodedef.ele_active_node ~= true then - active_node = nodedef.ele_active_node + if not fuel or fuel.time == 0 then + ele.helpers.swap_node(pos, nodename) + break end - ele.helpers.swap_node(pos, active_node) + meta:set_int("burn_time", fuel.time) + meta:set_int("burn_totaltime", fuel.time) + inv:set_stack("src", 1, afterfuel.items[1]) + pow_buffer.usage = generation + + if nodedef.ele_active_node then + local active_node = nodename.."_active" + if nodedef.ele_active_node ~= true then + active_node = nodedef.ele_active_node + end + + ele.helpers.swap_node(pos, active_node) + end + + refresh = true + else + meta:set_string("formspec", get_formspec(pow_buffer, 0)) + meta:set_string("infotext", ("%s Idle"):format(nodedef.description) .. + "\n" .. ele.capacity_text(capacity, storage)) + ele.helpers.swap_node(pos, nodename) end - else - meta:set_string("formspec", get_formspec(pow_buffer, 0)) - meta:set_string("infotext", ("%s Idle"):format(nodedef.description) .. - "\n" .. ele.capacity_text(capacity, storage)) - ele.helpers.swap_node(pos, nodename) - return false end + if burn_totaltime == 0 then burn_totaltime = 1 end + break end - if burn_totaltime == 0 then burn_totaltime = 1 end local percent = math.floor((burn_time / burn_totaltime) * 100) meta:set_string("formspec", get_formspec(pow_buffer, percent)) meta:set_string("infotext", ("%s Active"):format(nodedef.description) .. "\n" .. ele.capacity_text(capacity, storage)) - return true + return refresh end nodedef.on_construct = function (pos) @@ -108,7 +114,7 @@ function elepm.register_fuel_generator(nodename, nodedef) local capacity = ele.helpers.get_node_property(meta, pos, "capacity") local storage = ele.helpers.get_node_property(meta, pos, "storage") - meta:set_string("formspec", get_formspec({capacity = capacity, storage = storage}, 0)) + meta:set_string("formspec", get_formspec({capacity = capacity, storage = storage, usage = 0}, 0)) end ele.register_machine(nodename, nodedef) diff --git a/elepower_machines/machines/bases/storage.lua b/elepower_machines/machines/bases/storage.lua index 5b66994..71116d9 100644 --- a/elepower_machines/machines/bases/storage.lua +++ b/elepower_machines/machines/bases/storage.lua @@ -60,7 +60,7 @@ function elepm.register_storage(nodename, nodedef) local level = math.floor(percent * levels) ele.helpers.swap_node(pos, nodename .. "_" .. level) - meta:set_string("formspec", get_formspec({capacity = capacity, storage = storage})) + meta:set_string("formspec", get_formspec({capacity = capacity, storage = storage, usage = 0})) meta:set_string("infotext", ("%s Active"):format(nodedef.description) .. "\n" .. ele.capacity_text(capacity, storage)) @@ -140,7 +140,7 @@ function elepm.register_storage(nodename, nodedef) inv:set_size("in", 1) local capacity = ele.helpers.get_node_property(meta, pos, "capacity") - meta:set_string("formspec", get_formspec({ capacity = capacity, storage = 0 })) + meta:set_string("formspec", get_formspec({ capacity = capacity, storage = 0, usage = 0 })) end for i = 0, levels do diff --git a/elepower_nuclear/crafting.lua b/elepower_nuclear/crafting.lua index ff49960..5efe854 100644 --- a/elepower_nuclear/crafting.lua +++ b/elepower_nuclear/crafting.lua @@ -15,7 +15,7 @@ minetest.register_craft({ recipe = { {"elepower_dynamics:induction_coil_advanced", "elepower_dynamics:soc", "elepower_dynamics:induction_coil_advanced"}, {"elepower_nuclear:graphite_rod", "elepower_nuclear:machine_block", "elepower_nuclear:graphite_rod"}, - {"elepower_dynamics:wound_silver_coil", "elepower_dynamics:viridisium_gear", "elepower_dynamics:wound_silver_coil"}, + {"elepower_dynamics:wound_silver_coil", "elepower_dynamics:electrum_gear", "elepower_dynamics:wound_silver_coil"}, } }) @@ -35,7 +35,7 @@ minetest.register_craft({ recipe = { {"elepower_dynamics:wound_copper_coil", "elepower_nuclear:graphite_moderator", "elepower_dynamics:wound_copper_coil"}, {"elepower_nuclear:graphite_moderator", "elepower_nuclear:machine_block", "elepower_nuclear:graphite_moderator"}, - {"elepower_dynamics:viridisium_gear", "elepower_nuclear:graphite_moderator", "elepower_dynamics:viridisium_gear"}, + {"elepower_dynamics:electrum_gear", "elepower_nuclear:graphite_moderator", "elepower_dynamics:electrum_gear"}, } }) @@ -45,7 +45,7 @@ minetest.register_craft({ recipe = { {"elepower_dynamics:induction_coil_advanced", "elepower_dynamics:graphite_ingot", "elepower_dynamics:induction_coil_advanced"}, {"elepower_nuclear:graphite_moderator", "elepower_nuclear:machine_block", "elepower_nuclear:graphite_moderator"}, - {"elepower_dynamics:viridisium_gear", "elepower_dynamics:copper_plate", "elepower_dynamics:viridisium_gear"}, + {"elepower_dynamics:electrum_gear", "elepower_dynamics:copper_plate", "elepower_dynamics:electrum_gear"}, } }) @@ -55,7 +55,7 @@ minetest.register_craft({ recipe = { {"elepower_dynamics:portable_tank", "elepower_dynamics:copper_plate", "elepower_dynamics:portable_tank"}, {"elepower_nuclear:graphite_moderator", "elepower_nuclear:machine_block", "elepower_nuclear:graphite_moderator"}, - {"elepower_dynamics:viridisium_gear", "elepower_dynamics:copper_plate", "elepower_dynamics:viridisium_gear"}, + {"elepower_dynamics:electrum_gear", "elepower_dynamics:copper_plate", "elepower_dynamics:electrum_gear"}, } }) diff --git a/elepower_papi/formspec.lua b/elepower_papi/formspec.lua index 210fffa..6c7d748 100644 --- a/elepower_papi/formspec.lua +++ b/elepower_papi/formspec.lua @@ -21,11 +21,18 @@ end function ele.formspec.power_meter(capacitor) if not capacitor then - capacitor = { capacity = 8000, storage = 0 } + capacitor = { capacity = 8000, storage = 0, usage = 0 } end local pw_percent = math.floor(100 * capacitor.storage / capacitor.capacity) + local usage = capacitor.usage + if not usage then + usage = 0 + end return ele.formspec.create_bar(0, 0, pw_percent, "#00a1ff") .. - "tooltip[0,0;1,2.5;Power Buffer\n" .. ele.capacity_text(capacitor.capacity, capacitor.storage) .. "]" + "tooltip[0,0;1,2.5;".. + minetest.colorize("#c60303", "Energy Storage\n").. + minetest.colorize("#0399c6", ele.capacity_text(capacitor.capacity, capacitor.storage)).. + minetest.colorize("#565656", "\nPower Used / Generated: " .. usage .. " " .. ele.unit) .. "]" end diff --git a/elepower_wireless/crafting.lua b/elepower_wireless/crafting.lua index 6f67722..decc5e7 100644 --- a/elepower_wireless/crafting.lua +++ b/elepower_wireless/crafting.lua @@ -1,11 +1,17 @@ +local easycrafting = minetest.settings:get("elepower_easy_crafting") == "true" +local ingot = "elepower_dynamics:viridisium_ingot" +if easycrafting then + ingot = "elepower_dynamics:electrum_ingot" +end + -- Receiver minetest.register_craft({ output = "elepower_wireless:matter_receiver", recipe = { {"elepower_dynamics:wound_silver_coil", "elepower_dynamics:soc", "elepower_dynamics:wound_silver_coil"}, {"elepower_dynamics:electrum_gear", "default:steelblock", "elepower_dynamics:electrum_gear"}, - {"elepower_dynamics:xycrone_lump", "elepower_dynamics:viridisium_ingot", "elepower_dynamics:xycrone_lump"}, + {"elepower_dynamics:xycrone_lump", ingot, "elepower_dynamics:xycrone_lump"}, } }) @@ -15,7 +21,7 @@ minetest.register_craft({ recipe = { {"elepower_dynamics:wound_silver_coil", "elepower_dynamics:soc", "elepower_dynamics:wound_silver_coil"}, {"elepower_dynamics:xycrone_lump", "default:steelblock", "elepower_dynamics:xycrone_lump"}, - {"elepower_dynamics:electrum_gear", "elepower_dynamics:viridisium_ingot", "elepower_dynamics:electrum_gear"}, + {"elepower_dynamics:electrum_gear", ingot, "elepower_dynamics:electrum_gear"}, } }) @@ -25,7 +31,7 @@ minetest.register_craft({ recipe = { {"elepower_dynamics:wound_silver_coil", "elepower_dynamics:soc", "elepower_dynamics:wound_silver_coil"}, {"elepower_dynamics:wound_copper_coil", "default:steelblock", "elepower_dynamics:wound_copper_coil"}, - {"elepower_dynamics:electrum_gear", "elepower_dynamics:viridisium_ingot", "elepower_dynamics:electrum_gear"}, + {"elepower_dynamics:electrum_gear", ingot, "elepower_dynamics:electrum_gear"}, } }) diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..7be5a5e --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,5 @@ +[Crafting] + +# Enable easier crafting recipes for Elepower +# Removes viridisium (which is fairly rare) as a component. +elepower_easy_crafting (Easy Crafting Recipes) bool false