mirror of
https://github.com/sirrobzeroone/elepower.git
synced 2024-08-20 04:44:05 +02:00
Fix enrichment plant, add speed and efficiency upgrades
This commit is contained in:
parent
1b4453fae3
commit
7de297dace
@ -80,6 +80,8 @@ function elepm.register_craft(craftdef)
|
||||
time = time
|
||||
}
|
||||
|
||||
table.insert(elepm.craft[ctype], recipe)
|
||||
|
||||
if have_ui or have_cg then
|
||||
local spec = {}
|
||||
local items = {}
|
||||
@ -133,8 +135,6 @@ function elepm.register_craft(craftdef)
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(elepm.craft[ctype], recipe)
|
||||
end
|
||||
|
||||
local no_recipe = {
|
||||
|
@ -330,6 +330,21 @@ local soldering_recipes = {
|
||||
recipe = { "elepower_machines:resonant_power_cell_0", "elepower_machines:super_capacitor 2", "elepower_dynamics:xycrone_lump" },
|
||||
output = "elepower_machines:super_power_cell_0",
|
||||
time = 24,
|
||||
},
|
||||
{
|
||||
recipe = { "elepower_dynamics:integrated_circuit", "elepower_dynamics:induction_coil 2", "elepower_dynamics:soc" },
|
||||
output = "elepower_machines:upgrade_speed",
|
||||
time = 16,
|
||||
},
|
||||
{
|
||||
recipe = { "elepower_dynamics:integrated_circuit", "elepower_machines:hardened_capacitor 2", "elepower_dynamics:soc" },
|
||||
output = "elepower_machines:upgrade_efficiency",
|
||||
time = 16,
|
||||
},
|
||||
{
|
||||
recipe = { "elepower_machines:upgrade_efficiency", "elepower_machines:resonant_capacitor 2", "elepower_dynamics:soc" },
|
||||
output = "elepower_machines:upgrade_efficiency_2",
|
||||
time = 16,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,33 +9,101 @@ minetest.register_craftitem("elepower_machines:turbine_blades", {
|
||||
inventory_image = "elepower_turbine.png"
|
||||
})
|
||||
|
||||
-- Pump Tube Roll
|
||||
minetest.register_craftitem("elepower_machines:opaque_duct_roll", {
|
||||
description = "Retractable Opaque Fluid Duct\nA Pump uses this to reach fluids.",
|
||||
inventory_image = "elepower_opaque_duct.png",
|
||||
})
|
||||
|
||||
---------------
|
||||
-- Upgrading --
|
||||
---------------
|
||||
|
||||
-- Capacitors
|
||||
|
||||
minetest.register_craftitem("elepower_machines:hardened_capacitor", {
|
||||
description = "Hardened Capacitor\nTier 2 Capacitor",
|
||||
groups = {capacitor = 2, ele_upgrade_component = 1},
|
||||
inventory_image = "elepower_upgrade_hardened_capacitor.png"
|
||||
inventory_image = "elepower_upgrade_hardened_capacitor.png",
|
||||
ele_upgrade = {
|
||||
capacity = {
|
||||
multiplier = 1,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_machines:reinforced_capacitor", {
|
||||
description = "Reinforced Capacitor\nIt will probably obliterate you if you touched it while charged\nTier 3 Capacitor",
|
||||
groups = {capacitor = 3, ele_upgrade_component = 1},
|
||||
inventory_image = "elepower_upgrade_reinforced_capacitor.png"
|
||||
inventory_image = "elepower_upgrade_reinforced_capacitor.png",
|
||||
ele_upgrade = {
|
||||
capacity = {
|
||||
multiplier = 10,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_machines:resonant_capacitor", {
|
||||
description = "Resonant Capacitor\nTier 4 Capacitor",
|
||||
groups = {capacitor = 4, ele_upgrade_component = 1},
|
||||
inventory_image = "elepower_upgrade_resonant_capacitor.png"
|
||||
inventory_image = "elepower_upgrade_resonant_capacitor.png",
|
||||
ele_upgrade = {
|
||||
capacity = {
|
||||
multiplier = 100,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_machines:super_capacitor", {
|
||||
description = "Supercapacitor\nAmazing energy density in a small container! Wow!\nTier 5 Capacitor",
|
||||
groups = {capacitor = 5, ele_upgrade_component = 1},
|
||||
inventory_image = "elepower_upgrade_supercapacitor.png"
|
||||
inventory_image = "elepower_upgrade_supercapacitor.png",
|
||||
ele_upgrade = {
|
||||
capacity = {
|
||||
multiplier = 1000,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Machine chips
|
||||
|
||||
minetest.register_craftitem("elepower_machines:upgrade_speed", {
|
||||
description = "Speed Upgrade\nCrafting Speed +1\nPower Usage +50%",
|
||||
groups = {machine_chip = 2, ele_upgrade_component = 1},
|
||||
inventory_image = "elepower_upgrade_speed.png",
|
||||
ele_upgrade = {
|
||||
craft_speed = {
|
||||
add = 1
|
||||
},
|
||||
usage = {
|
||||
multiplier = 0.5
|
||||
},
|
||||
inrush = {
|
||||
multiplier = 0.5
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_machines:upgrade_efficiency", {
|
||||
description = "Efficiency Upgrade\nReduces power usage by 25%",
|
||||
groups = {machine_chip = 2, ele_upgrade_component = 1},
|
||||
inventory_image = "elepower_upgrade_efficiency.png",
|
||||
ele_upgrade = {
|
||||
usage = {
|
||||
divider = 0.25
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_machines:upgrade_efficiency_2", {
|
||||
description = "Efficiency Upgrade\nReduces power usage by 50%",
|
||||
groups = {machine_chip = 2, ele_upgrade_component = 1},
|
||||
inventory_image = "elepower_upgrade_efficiency_2.png",
|
||||
ele_upgrade = {
|
||||
usage = {
|
||||
divider = 0.50
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Accumulator filter
|
||||
@ -62,9 +130,3 @@ minetest.register_craftitem("elepower_machines:heavy_filter", {
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
-- Pump Tube Roll
|
||||
minetest.register_craftitem("elepower_machines:opaque_duct_roll", {
|
||||
description = "Retractable Opaque Fluid Duct\nA Pump uses this to reach fluids.",
|
||||
inventory_image = "elepower_opaque_duct.png",
|
||||
})
|
||||
|
@ -7,6 +7,7 @@ elepm.register_storage("elepower_machines:power_cell", {
|
||||
description = "Power Cell",
|
||||
ele_capacity = 16000,
|
||||
ele_inrush = 128,
|
||||
ele_output = 128,
|
||||
tiles = {
|
||||
"elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png",
|
||||
"elepower_machine_side.png", "elepower_machine_side.png", "elepower_power_cell.png",
|
||||
@ -18,6 +19,7 @@ elepm.register_storage("elepower_machines:hardened_power_cell", {
|
||||
description = "Hardened Power Cell",
|
||||
ele_capacity = 64000,
|
||||
ele_inrush = 640,
|
||||
ele_output = 640,
|
||||
tiles = {
|
||||
"elepower_machine_top.png^elepower_overlay_hardened.png",
|
||||
"elepower_machine_base.png^elepower_overlay_hardened.png",
|
||||
@ -33,6 +35,7 @@ elepm.register_storage("elepower_machines:reinforced_power_cell", {
|
||||
description = "Reinforced Power Cell",
|
||||
ele_capacity = 128000,
|
||||
ele_inrush = 1024,
|
||||
ele_output = 1024,
|
||||
tiles = {
|
||||
"elepower_machine_top.png^elepower_overlay_reinforced.png",
|
||||
"elepower_machine_base.png^elepower_overlay_reinforced.png",
|
||||
@ -48,6 +51,7 @@ elepm.register_storage("elepower_machines:resonant_power_cell", {
|
||||
description = "Resonant Power Cell",
|
||||
ele_capacity = 640000,
|
||||
ele_inrush = 2048,
|
||||
ele_output = 2048,
|
||||
tiles = {
|
||||
"elepower_machine_top.png^elepower_overlay_resonant.png",
|
||||
"elepower_machine_base.png^elepower_overlay_resonant.png",
|
||||
@ -63,6 +67,7 @@ elepm.register_storage("elepower_machines:super_power_cell", {
|
||||
description = "Supercapacitor Cell",
|
||||
ele_capacity = 1280000,
|
||||
ele_inrush = 4096,
|
||||
ele_output = 4096,
|
||||
tiles = {
|
||||
"elepower_machine_top.png^elepower_overlay_super.png",
|
||||
"elepower_machine_base.png^elepower_overlay_super.png",
|
||||
|
BIN
elepower_machines/textures/elepower_upgrade_efficiency.png
Normal file
BIN
elepower_machines/textures/elepower_upgrade_efficiency.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 521 B |
BIN
elepower_machines/textures/elepower_upgrade_efficiency_2.png
Normal file
BIN
elepower_machines/textures/elepower_upgrade_efficiency_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 515 B |
BIN
elepower_machines/textures/elepower_upgrade_speed.png
Normal file
BIN
elepower_machines/textures/elepower_upgrade_speed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 460 B |
@ -18,7 +18,7 @@ function elepm.handle_machine_upgrades (pos)
|
||||
end
|
||||
|
||||
if nodedef.ele_upgrades then
|
||||
for comp, vars in pairs(nodedef.ele_upgrades) do
|
||||
for comp,vars in pairs(nodedef.ele_upgrades) do
|
||||
for _,c in pairs(vars) do
|
||||
if not comps[comp] then
|
||||
-- If we're resetting capacity, set storage to max initial capacity
|
||||
@ -35,18 +35,36 @@ function elepm.handle_machine_upgrades (pos)
|
||||
if meta:get_int(c) ~= 0 then
|
||||
meta:set_int(c, 0)
|
||||
end
|
||||
elseif nodedef["ele_" .. c] ~= nil then
|
||||
-- Set updated value in metadata
|
||||
local default = nodedef["ele_" .. c]
|
||||
local ulevel = minetest.get_item_group(comps[comp], comp) - 1
|
||||
local multiplier = 1
|
||||
else
|
||||
local compdef = minetest.registered_items[comps[comp]]
|
||||
local default = nodedef["ele_" .. c] or 1
|
||||
local ulevel = minetest.get_item_group(comps[comp], comp) - 1
|
||||
|
||||
-- Capacitor value is multiplied
|
||||
if comp == "capacitor" then
|
||||
multiplier = math.pow(10, ulevel)
|
||||
-- Only upgrade if present
|
||||
if compdef and compdef.ele_upgrade and compdef.ele_upgrade[c] then
|
||||
local task = compdef.ele_upgrade[c]
|
||||
local final = default
|
||||
|
||||
if task.multiplier then
|
||||
final = final + (default * task.multiplier * ulevel)
|
||||
end
|
||||
|
||||
if task.add then
|
||||
final = final + (task.add * ulevel)
|
||||
end
|
||||
|
||||
if task.subtract then
|
||||
final = final - (task.subtract * ulevel)
|
||||
end
|
||||
|
||||
if task.divider then
|
||||
final = final - (default * task.divider * ulevel)
|
||||
end
|
||||
|
||||
if final <= 0 then final = 1 end
|
||||
|
||||
meta:set_int(c, math.abs(math.floor(final)))
|
||||
end
|
||||
|
||||
meta:set_int(c, math.abs(default + (default * ulevel * multiplier)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ elepm.register_crafter("elepower_nuclear:enrichment_plant", {
|
||||
"elenuclear_machine_side.png", "elenuclear_machine_side.png", "elenuclear_enrichment_plant.png",
|
||||
},
|
||||
groups = {ele_user = 1, cracky = 3},
|
||||
ele_capacity = 64000,
|
||||
ele_capacity = 8000,
|
||||
ele_usage = 1000,
|
||||
ele_inrush = 8000,
|
||||
get_formspec = get_formspec,
|
||||
|
Loading…
Reference in New Issue
Block a user