Add a settings option to enable easier crafting
This commit is contained in:
parent
c4949c2935
commit
2ab287a64f
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
local easycrafting = minetest.settings:get("elepower_easy_crafting") == "true"
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- Overrides --
|
-- 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
|
-- Portable Tank
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "elepower_dynamics:portable_tank",
|
output = "elepower_dynamics:portable_tank",
|
||||||
@ -210,30 +202,73 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
if easycrafting then
|
||||||
output = "elepower_dynamics:pcb_blank",
|
minetest.register_craft({
|
||||||
recipe = {
|
output = "elepower_dynamics:pcb_blank",
|
||||||
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
recipe = {
|
||||||
{"default:copper_ingot", "default:mese_crystal", "default:copper_ingot"},
|
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
||||||
{"default:gold_ingot", "elepower_dynamics:viridisium_ingot", "default:gold_ingot"},
|
{"default:copper_ingot", "default:mese_crystal", "default:copper_ingot"},
|
||||||
}
|
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "elepower_dynamics:acidic_compound",
|
output = "elepower_dynamics:acidic_compound",
|
||||||
recipe = {
|
recipe = {
|
||||||
"elepower_dynamics:viridisium_dust",
|
"elepower_dynamics:copper_dust",
|
||||||
"elepower_dynamics:viridisium_dust",
|
"elepower_dynamics:copper_dust",
|
||||||
"elepower_dynamics:viridisium_dust",
|
"elepower_dynamics:copper_dust",
|
||||||
"elepower_dynamics:viridisium_dust",
|
"elepower_dynamics:copper_dust",
|
||||||
"elepower_dynamics:copper_dust",
|
"farming:seed_wheat",
|
||||||
"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({
|
minetest.register_craft({
|
||||||
output = "elepower_dynamics:integrated_circuit",
|
output = "elepower_dynamics:integrated_circuit",
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
local easycrafting = minetest.settings:get("elepower_easy_crafting") == true
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Worldgen --
|
-- Worldgen --
|
||||||
--------------
|
--------------
|
||||||
@ -64,38 +66,40 @@ minetest.register_ore({
|
|||||||
|
|
||||||
-- Viridisium
|
-- Viridisium
|
||||||
|
|
||||||
minetest.register_ore({
|
if not easycrafting then
|
||||||
ore_type = "scatter",
|
minetest.register_ore({
|
||||||
ore = "elepower_dynamics:stone_with_viridisium",
|
ore_type = "scatter",
|
||||||
wherein = "default:stone",
|
ore = "elepower_dynamics:stone_with_viridisium",
|
||||||
clust_scarcity = 25 * 25 * 25,
|
wherein = "default:stone",
|
||||||
clust_num_ores = 5,
|
clust_scarcity = 25 * 25 * 25,
|
||||||
clust_size = 3,
|
clust_num_ores = 5,
|
||||||
y_max = -1028,
|
clust_size = 3,
|
||||||
y_min = -31000,
|
y_max = -1028,
|
||||||
})
|
y_min = -31000,
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_ore({
|
minetest.register_ore({
|
||||||
ore_type = "scatter",
|
ore_type = "scatter",
|
||||||
ore = "elepower_dynamics:stone_with_viridisium",
|
ore = "elepower_dynamics:stone_with_viridisium",
|
||||||
wherein = "default:stone",
|
wherein = "default:stone",
|
||||||
clust_scarcity = 20 * 20 * 20,
|
clust_scarcity = 20 * 20 * 20,
|
||||||
clust_num_ores = 5,
|
clust_num_ores = 5,
|
||||||
clust_size = 3,
|
clust_size = 3,
|
||||||
y_max = -8096,
|
y_max = -8096,
|
||||||
y_min = -31000,
|
y_min = -31000,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_ore({
|
minetest.register_ore({
|
||||||
ore_type = "scatter",
|
ore_type = "scatter",
|
||||||
ore = "elepower_dynamics:stone_with_viridisium",
|
ore = "elepower_dynamics:stone_with_viridisium",
|
||||||
wherein = "default:stone",
|
wherein = "default:stone",
|
||||||
clust_scarcity = 10 * 10 * 10,
|
clust_scarcity = 10 * 10 * 10,
|
||||||
clust_num_ores = 5,
|
clust_num_ores = 5,
|
||||||
clust_size = 3,
|
clust_size = 3,
|
||||||
y_max = -12000,
|
y_max = -12000,
|
||||||
y_min = -31000,
|
y_min = -31000,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- Zinc
|
-- Zinc
|
||||||
|
|
||||||
|
@ -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 --
|
-- Nodes --
|
||||||
-----------
|
-----------
|
||||||
@ -17,7 +23,7 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "elepower_farming:planter",
|
output = "elepower_farming:planter",
|
||||||
recipe = {
|
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"},
|
{"farming:hoe_steel", "elepower_farming:device_frame", "farming:hoe_steel"},
|
||||||
{"elepower_dynamics:wound_copper_coil", "elepower_dynamics:motor", "elepower_dynamics:wound_copper_coil"},
|
{"elepower_dynamics:wound_copper_coil", "elepower_dynamics:motor", "elepower_dynamics:wound_copper_coil"},
|
||||||
}
|
}
|
||||||
@ -27,7 +33,7 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "elepower_farming:harvester",
|
output = "elepower_farming:harvester",
|
||||||
recipe = {
|
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"},
|
{"default:axe_steel", "elepower_farming:device_frame", "farming:hoe_steel"},
|
||||||
{"elepower_dynamics:motor", "elepower_dynamics:diamond_gear", "elepower_dynamics:motor"},
|
{"elepower_dynamics:motor", "elepower_dynamics:diamond_gear", "elepower_dynamics:motor"},
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ local function on_timer(pos, elapsed)
|
|||||||
ele.helpers.swap_node(pos, "elepower_farming:harvester")
|
ele.helpers.swap_node(pos, "elepower_farming:harvester")
|
||||||
end
|
end
|
||||||
|
|
||||||
local power = {capacity = capacity, storage = storage}
|
local power = {capacity = capacity, storage = storage, usage = usage}
|
||||||
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
local work_percent = math.floor((work / HARVESTER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power, sludge))
|
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)
|
meta:set_int("src_time", 0)
|
||||||
|
|
||||||
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
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)
|
local node = minetest.get_node(pos)
|
||||||
end,
|
end,
|
||||||
|
@ -252,7 +252,7 @@ local function on_timer(pos, elapsed)
|
|||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local power = {capacity = capacity, storage = storage}
|
local power = {capacity = capacity, storage = storage, usage = usage}
|
||||||
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
local work_percent = math.floor((work / PLANTER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power))
|
meta:set_string("formspec", get_formspec(work_percent, power))
|
||||||
|
@ -150,7 +150,7 @@ local function on_timer(pos, elapsed)
|
|||||||
meta:set_string("infotext", ("Powered Mob Spawner %s\nMob: %s\n%s"):format(
|
meta:set_string("infotext", ("Powered Mob Spawner %s\nMob: %s\n%s"):format(
|
||||||
active, mob_desc, ele.capacity_text(capacity, storage)))
|
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)
|
local work_percent = math.floor((work / SPAWNER_TICK)*100)
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(work_percent, power))
|
meta:set_string("formspec", get_formspec(work_percent, power))
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
local easycrafting = minetest.settings:get("elepower_easy_crafting") == "true"
|
||||||
|
|
||||||
--*****************--
|
--*****************--
|
||||||
-- MACHINE RECIPES --
|
-- MACHINE RECIPES --
|
||||||
--*****************--
|
--*****************--
|
||||||
@ -142,12 +144,21 @@ for name in pairs(minetest.registered_nodes) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elepm.register_craft({
|
if easycrafting then
|
||||||
type = "compress",
|
elepm.register_craft({
|
||||||
recipe = { "elepower_dynamics:viridisium_block 9" },
|
type = "compress",
|
||||||
output = "elepower_dynamics:xycrone_lump",
|
recipe = { "default:steel_block 9" },
|
||||||
time = 20,
|
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 --
|
-- Sawmill --
|
||||||
@ -188,6 +199,10 @@ end)
|
|||||||
---------------
|
---------------
|
||||||
-- Soldering --
|
-- Soldering --
|
||||||
---------------
|
---------------
|
||||||
|
local induction_dust = "elepower_dynamics:viridisium_dust"
|
||||||
|
if easycrafting then
|
||||||
|
induction_dust = "elepower_dynamics:zinc_dust"
|
||||||
|
end
|
||||||
|
|
||||||
local soldering_recipes = {
|
local soldering_recipes = {
|
||||||
{
|
{
|
||||||
@ -216,7 +231,7 @@ local soldering_recipes = {
|
|||||||
time = 16,
|
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",
|
output = "elepower_dynamics:induction_coil_advanced",
|
||||||
time = 18,
|
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
|
-- Machine block
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "elepower_machines:machine_block",
|
output = "elepower_machines:machine_block",
|
||||||
recipe = {
|
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"},
|
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
|
||||||
{"elepower_dynamics:viridisium_ingot", "elepower_dynamics:motor", "elepower_dynamics:viridisium_ingot"},
|
{"elepower_dynamics:viridisium_ingot", "elepower_dynamics:motor", "elepower_dynamics:viridisium_ingot"},
|
||||||
}
|
}
|
||||||
|
@ -96,13 +96,14 @@ function elepm.register_crafter(nodename, nodedef)
|
|||||||
local usage = ele.helpers.get_node_property(meta, pos, "usage")
|
local usage = ele.helpers.get_node_property(meta, pos, "usage")
|
||||||
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
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
|
local power_operation = false
|
||||||
|
|
||||||
-- Determine if there is enough power for this action
|
-- Determine if there is enough power for this action
|
||||||
if result.time ~= 0 and storage >= usage then
|
if result.time ~= 0 and storage >= usage then
|
||||||
power_operation = true
|
power_operation = true
|
||||||
|
pow_buffer.usage = usage
|
||||||
end
|
end
|
||||||
|
|
||||||
if result.time == 0 or not power_operation then
|
if result.time == 0 or not power_operation then
|
||||||
@ -127,7 +128,7 @@ function elepm.register_crafter(nodename, nodedef)
|
|||||||
|
|
||||||
-- One step
|
-- One step
|
||||||
meta:set_int("storage", storage - usage)
|
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)
|
time = time + ele.helpers.round(machine_speed * 10)
|
||||||
meta:set_string("infotext", ("%s Active"):format(nodedef.description) ..
|
meta:set_string("infotext", ("%s Active"):format(nodedef.description) ..
|
||||||
"\n" .. ele.capacity_text(capacity, storage))
|
"\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 storage = ele.helpers.get_node_property(meta, pos, "storage")
|
||||||
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
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))
|
meta:set_string("formspec", get_formspec(craft_type, pow_buffer, nil, pos))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ function ele.register_fluid_generator(nodename, nodedef)
|
|||||||
meta:set_int("burn_time", burn_time)
|
meta:set_int("burn_time", burn_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
pow_buffer = {capacity = capacity, storage = storage}
|
pow_buffer = {capacity = capacity, storage = storage, usage = 0}
|
||||||
|
|
||||||
-- Burn another bucket of lava
|
-- Burn another bucket of lava
|
||||||
if burn_time == 0 then
|
if burn_time == 0 then
|
||||||
@ -88,6 +88,7 @@ function ele.register_fluid_generator(nodename, nodedef)
|
|||||||
|
|
||||||
-- Take lava
|
-- Take lava
|
||||||
flbuffer.amount = flbuffer.amount - 1000
|
flbuffer.amount = flbuffer.amount - 1000
|
||||||
|
pow_buffer.usage = generation
|
||||||
|
|
||||||
local active_node = nodename.."_active"
|
local active_node = nodename.."_active"
|
||||||
ele.helpers.swap_node(pos, active_node)
|
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 capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
||||||
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
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
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ function elepm.register_fuel_generator(nodename, nodedef)
|
|||||||
end
|
end
|
||||||
|
|
||||||
nodedef.on_timer = function (pos, elapsed)
|
nodedef.on_timer = function (pos, elapsed)
|
||||||
|
local refresh = false
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
local burn_time = meta:get_int("burn_time")
|
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)
|
meta:set_int("burn_time", burn_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
local pow_buffer = {capacity = capacity, storage = storage}
|
local pow_buffer = {capacity = capacity, storage = storage, usage = 0}
|
||||||
|
|
||||||
-- Burn another piece of fuel
|
while true do
|
||||||
if burn_time == 0 then
|
-- Burn another piece of fuel
|
||||||
local inv = meta:get_inventory()
|
if burn_time == 0 then
|
||||||
if not inv:is_empty("src") then
|
local inv = meta:get_inventory()
|
||||||
local fuellist = inv:get_list("src")
|
if not inv:is_empty("src") then
|
||||||
local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
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
|
if not fuel or fuel.time == 0 then
|
||||||
ele.helpers.swap_node(pos, nodename)
|
ele.helpers.swap_node(pos, nodename)
|
||||||
return false
|
break
|
||||||
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
|
|
||||||
end
|
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
|
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
|
end
|
||||||
|
if burn_totaltime == 0 then burn_totaltime = 1 end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
if burn_totaltime == 0 then burn_totaltime = 1 end
|
|
||||||
|
|
||||||
local percent = math.floor((burn_time / burn_totaltime) * 100)
|
local percent = math.floor((burn_time / burn_totaltime) * 100)
|
||||||
meta:set_string("formspec", get_formspec(pow_buffer, percent))
|
meta:set_string("formspec", get_formspec(pow_buffer, percent))
|
||||||
meta:set_string("infotext", ("%s Active"):format(nodedef.description) ..
|
meta:set_string("infotext", ("%s Active"):format(nodedef.description) ..
|
||||||
"\n" .. ele.capacity_text(capacity, storage))
|
"\n" .. ele.capacity_text(capacity, storage))
|
||||||
|
|
||||||
return true
|
return refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
nodedef.on_construct = function (pos)
|
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 capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
||||||
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
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
|
end
|
||||||
|
|
||||||
ele.register_machine(nodename, nodedef)
|
ele.register_machine(nodename, nodedef)
|
||||||
|
@ -60,7 +60,7 @@ function elepm.register_storage(nodename, nodedef)
|
|||||||
local level = math.floor(percent * levels)
|
local level = math.floor(percent * levels)
|
||||||
|
|
||||||
ele.helpers.swap_node(pos, nodename .. "_" .. level)
|
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" ..
|
meta:set_string("infotext", ("%s Active"):format(nodedef.description) .. "\n" ..
|
||||||
ele.capacity_text(capacity, storage))
|
ele.capacity_text(capacity, storage))
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ function elepm.register_storage(nodename, nodedef)
|
|||||||
inv:set_size("in", 1)
|
inv:set_size("in", 1)
|
||||||
|
|
||||||
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
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
|
end
|
||||||
|
|
||||||
for i = 0, levels do
|
for i = 0, levels do
|
||||||
|
@ -15,7 +15,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"elepower_dynamics:induction_coil_advanced", "elepower_dynamics:soc", "elepower_dynamics:induction_coil_advanced"},
|
{"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_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 = {
|
recipe = {
|
||||||
{"elepower_dynamics:wound_copper_coil", "elepower_nuclear:graphite_moderator", "elepower_dynamics:wound_copper_coil"},
|
{"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_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 = {
|
recipe = {
|
||||||
{"elepower_dynamics:induction_coil_advanced", "elepower_dynamics:graphite_ingot", "elepower_dynamics:induction_coil_advanced"},
|
{"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_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 = {
|
recipe = {
|
||||||
{"elepower_dynamics:portable_tank", "elepower_dynamics:copper_plate", "elepower_dynamics:portable_tank"},
|
{"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_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"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -21,11 +21,18 @@ end
|
|||||||
|
|
||||||
function ele.formspec.power_meter(capacitor)
|
function ele.formspec.power_meter(capacitor)
|
||||||
if not capacitor then
|
if not capacitor then
|
||||||
capacitor = { capacity = 8000, storage = 0 }
|
capacitor = { capacity = 8000, storage = 0, usage = 0 }
|
||||||
end
|
end
|
||||||
|
|
||||||
local pw_percent = math.floor(100 * capacitor.storage / capacitor.capacity)
|
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") ..
|
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
|
end
|
||||||
|
@ -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
|
-- Receiver
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "elepower_wireless:matter_receiver",
|
output = "elepower_wireless:matter_receiver",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"elepower_dynamics:wound_silver_coil", "elepower_dynamics:soc", "elepower_dynamics:wound_silver_coil"},
|
{"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: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 = {
|
recipe = {
|
||||||
{"elepower_dynamics:wound_silver_coil", "elepower_dynamics:soc", "elepower_dynamics:wound_silver_coil"},
|
{"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: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 = {
|
recipe = {
|
||||||
{"elepower_dynamics:wound_silver_coil", "elepower_dynamics:soc", "elepower_dynamics:wound_silver_coil"},
|
{"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: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"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
5
settingtypes.txt
Normal file
5
settingtypes.txt
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user