Start with nuclear, add new mineral and components, complexify recipes
@ -129,8 +129,8 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_dynamics:fluid_transfer_node",
|
||||
recipe = {
|
||||
{"group:stone", "elepower_dynamics:fluid_duct", "group:stone"},
|
||||
{"elepower_dynamics:steel_gear", "elepower_dynamics:servo_valve", "elepower_dynamics:steel_gear"},
|
||||
{"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"},
|
||||
}
|
||||
})
|
||||
@ -158,6 +158,15 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "elepower_dynamics:wound_silver_coil",
|
||||
recipe = {
|
||||
{"", "moreores:silver_ingot", ""},
|
||||
{"moreores:silver_ingot", "elepower_dynamics:iron_ingot", "moreores:silver_ingot"},
|
||||
{"", "moreores:silver_ingot", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "elepower_dynamics:copper_wire",
|
||||
recipe = {
|
||||
@ -183,6 +192,42 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "elepower_dynamics:chip",
|
||||
recipe = {
|
||||
{"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"},
|
||||
{"default:mese_crystal", "dye:black", "default:mese_crystal"},
|
||||
{"default:copper_ingot", "moreores:silver_ingot", "default:copper_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "elepower_dynamics:capacitor",
|
||||
recipe = {
|
||||
{"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"},
|
||||
{"moreores:silver_ingot", "default:mese_crystal", "moreores:silver_ingot"},
|
||||
{"default:copper_ingot", "dye:violet", "default:copper_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "elepower_dynamics:integrated_circuit",
|
||||
recipe = {
|
||||
{"elepower_dynamics:chip", "elepower_dynamics:chip", "elepower_dynamics:chip"},
|
||||
{"elepower_dynamics:capacitor", "elepower_dynamics:pcb", "elepower_dynamics:capacitor"},
|
||||
{"default:copper_ingot", "default:mese_crystal", "default:gold_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "elepower_dynamics:control_circuit",
|
||||
recipe = {
|
||||
{"elepower_dynamics:chip", "elepower_dynamics:chip", "elepower_dynamics:chip"},
|
||||
{"elepower_dynamics:capacitor", "elepower_dynamics:integrated_circuit", "elepower_dynamics:capacitor"},
|
||||
{"default:gold_ingot", "elepower_dynamics:viridisium_ingot", "default:gold_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
--------------
|
||||
-- Smelting --
|
||||
--------------
|
||||
@ -207,9 +252,9 @@ minetest.register_craft({
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:steel_ingot",
|
||||
recipe = "elepower_dynamics:iron_ingot",
|
||||
cooktime = 20
|
||||
output = "elepower_dynamics:viridisium_ingot",
|
||||
recipe = "elepower_dynamics:viridisium_lump",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
-----------
|
||||
|
@ -35,6 +35,12 @@ minetest.register_craftitem("elepower_dynamics:electrum_ingot", {
|
||||
groups = {electrum = 1, ingot = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:viridisium_ingot", {
|
||||
description = "Viridisium Ingot",
|
||||
inventory_image = "elepower_viridisium_ingot.png",
|
||||
groups = {viridisium = 1, ingot = 1}
|
||||
})
|
||||
|
||||
-- Lumps
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:lead_lump", {
|
||||
@ -49,7 +55,13 @@ minetest.register_craftitem("elepower_dynamics:nickel_lump", {
|
||||
groups = {nickel = 1, lump = 1}
|
||||
})
|
||||
|
||||
-- Other
|
||||
minetest.register_craftitem("elepower_dynamics:viridisium_lump", {
|
||||
description = "Viridisium Lump",
|
||||
inventory_image = "elepower_viridisium_lump.png",
|
||||
groups = {viridisium = 1, lump = 1}
|
||||
})
|
||||
|
||||
-- Special
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:carbon_fiber", {
|
||||
description = "Carbon Fibers",
|
||||
@ -63,30 +75,38 @@ minetest.register_craftitem("elepower_dynamics:carbon_sheet", {
|
||||
groups = {carbon_fiber_sheet = 1, sheet = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:tree_tap", {
|
||||
description = "Steel Treetap",
|
||||
inventory_image = "elepower_tree_tap.png",
|
||||
groups = {treetap = 1, static_component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:pcb", {
|
||||
description = "Printed Circuit Board (PCB)",
|
||||
inventory_image = "elepower_pcb.png",
|
||||
groups = {pcb = 1, static_component = 1}
|
||||
})
|
||||
|
||||
-- Electronics
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:wound_copper_coil", {
|
||||
description = "Wound Copper Coil",
|
||||
inventory_image = "elepower_copper_coil.png",
|
||||
groups = {copper = 1, coil = 1, component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:wound_silver_coil", {
|
||||
description = "Wound Silver Coil",
|
||||
inventory_image = "elepower_silver_coil.png",
|
||||
groups = {silver = 1, coil = 1, component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:copper_wire", {
|
||||
description = "Copper Wire",
|
||||
inventory_image = "elepower_copper_wire.png",
|
||||
groups = {copper = 1, wire = 1, component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:servo_valve", {
|
||||
description = "Servo Valve",
|
||||
inventory_image = "elepower_servo_valve.png",
|
||||
groups = {servo_valve = 1, component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:tree_tap", {
|
||||
description = "Steel Treetap",
|
||||
inventory_image = "elepower_tree_tap.png",
|
||||
groups = {treetap = 1, component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:induction_coil", {
|
||||
description = "Induction Coil",
|
||||
inventory_image = "elepower_induction_coil.png",
|
||||
@ -99,6 +119,38 @@ minetest.register_craftitem("elepower_dynamics:induction_coil_advanced", {
|
||||
groups = {induction_coil = 1, component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:chip", {
|
||||
description = "Chip",
|
||||
inventory_image = "elepower_chip.png",
|
||||
groups = {ic = 2, component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:capacitor", {
|
||||
description = "Capacitor",
|
||||
inventory_image = "elepower_capacitor.png",
|
||||
groups = {capacitor = 2, component = 1}
|
||||
})
|
||||
|
||||
-- Assembled Components
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:servo_valve", {
|
||||
description = "Servo Valve",
|
||||
inventory_image = "elepower_servo_valve.png",
|
||||
groups = {servo_valve = 1, assembled_component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:integrated_circuit", {
|
||||
description = "Integrated Circuit",
|
||||
inventory_image = "elepower_ic.png",
|
||||
groups = {ic = 1, assembled_component = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_dynamics:control_circuit", {
|
||||
description = "Integrated Control Circuit",
|
||||
inventory_image = "elepower_ic_2.png",
|
||||
groups = {ic = 2, assembled_component = 1, control_circuit = 1}
|
||||
})
|
||||
|
||||
---------------
|
||||
-- Overrides --
|
||||
---------------
|
||||
|
@ -100,6 +100,11 @@ elepd.register_dust("electrum", {
|
||||
color = "#ebeb90"
|
||||
})
|
||||
|
||||
elepd.register_dust("viridisium", {
|
||||
description = "Viridisium",
|
||||
color = "#5b9751"
|
||||
})
|
||||
|
||||
elepd.register_dust("wood", {
|
||||
description = "Wood Shavings",
|
||||
force_description = true,
|
||||
|
@ -95,3 +95,8 @@ elepd.register_gear("electrum", {
|
||||
description = "Electrum",
|
||||
color = "#ebeb90"
|
||||
})
|
||||
|
||||
elepd.register_gear("viridisium", {
|
||||
description = "Viridisium",
|
||||
color = "#5b9751"
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
name = elepower_dynamics
|
||||
description = Elepower Dynamics. Conduits and materials!
|
||||
depends = elepower_papi,elepower_fapi,default,fluid_tanks
|
||||
depends = elepower_papi,elepower_fapi,default,fluid_tanks,dye
|
||||
optional_depends = moreores,pipeworks,homedecor
|
||||
|
@ -23,6 +23,14 @@ minetest.register_node("elepower_dynamics:stone_with_nickel", {
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("elepower_dynamics:stone_with_viridisium", {
|
||||
description = "Viridisium Ore",
|
||||
tiles = {"default_stone.png^elepower_mineral_viridisium.png"},
|
||||
groups = {cracky = 3},
|
||||
drop = 'elepower_dynamics:viridisium_lump',
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("elepower_dynamics:particle_board", {
|
||||
description = "Particle Board",
|
||||
tiles = {"elepower_particle_board.png"},
|
||||
|
BIN
elepower_dynamics/textures/elepower_capacitor.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
elepower_dynamics/textures/elepower_chip.png
Normal file
After Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
elepower_dynamics/textures/elepower_ic.png
Normal file
After Width: | Height: | Size: 438 B |
BIN
elepower_dynamics/textures/elepower_ic_2.png
Normal file
After Width: | Height: | Size: 429 B |
BIN
elepower_dynamics/textures/elepower_mineral_viridisium.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
elepower_dynamics/textures/elepower_pcb.png
Normal file
After Width: | Height: | Size: 341 B |
BIN
elepower_dynamics/textures/elepower_silver_coil.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
elepower_dynamics/textures/elepower_viridisium_ingot.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
elepower_dynamics/textures/elepower_viridisium_lump.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
@ -61,3 +61,38 @@ minetest.register_ore({
|
||||
y_max = -8096,
|
||||
y_min = -31000,
|
||||
})
|
||||
|
||||
-- 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,
|
||||
})
|
||||
|
||||
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,
|
||||
})
|
||||
|
@ -17,7 +17,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_farming:planter",
|
||||
recipe = {
|
||||
{"homedecor:plastic_sheeting", "elepower_dynamics:copper_wire", "homedecor:plastic_sheeting"},
|
||||
{"elepower_dynamics:viridisium_ingot", "elepower_dynamics:control_circuit", "elepower_dynamics:viridisium_ingot"},
|
||||
{"farming:hoe_steel", "elepower_farming:device_frame", "farming:hoe_steel"},
|
||||
{"elepower_dynamics:wound_copper_coil", "elepower_dynamics:diamond_gear", "elepower_dynamics:wound_copper_coil"},
|
||||
}
|
||||
@ -27,7 +27,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_farming:harvester",
|
||||
recipe = {
|
||||
{"homedecor:plastic_sheeting", "elepower_dynamics:copper_wire", "homedecor:plastic_sheeting"},
|
||||
{"elepower_dynamics:viridisium_ingot", "elepower_dynamics:control_circuit", "elepower_dynamics:viridisium_ingot"},
|
||||
{"default:axe_steel", "elepower_farming:device_frame", "farming:hoe_steel"},
|
||||
{"elepower_dynamics:wound_copper_coil", "elepower_dynamics:diamond_gear", "elepower_dynamics:wound_copper_coil"},
|
||||
}
|
||||
@ -37,7 +37,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_farming:tree_extractor",
|
||||
recipe = {
|
||||
{"homedecor:plastic_sheeting", "bucket:bucket_empty", "homedecor:plastic_sheeting"},
|
||||
{"default:steel_ingot", "bucket:bucket_empty", "default:steel_ingot"},
|
||||
{"elepower_dynamics:tree_tap", "elepower_farming:device_frame", "elepower_dynamics:tree_tap"},
|
||||
{"elepower_dynamics:copper_gear", "elepower_dynamics:servo_valve", "elepower_dynamics:copper_gear"},
|
||||
}
|
||||
|
@ -56,9 +56,15 @@ function elepm.register_craft(craftdef)
|
||||
table.insert(elepm.craft[ctype], recipe)
|
||||
end
|
||||
|
||||
local no_recipe = {
|
||||
time = 0,
|
||||
new_input = {},
|
||||
output = {}
|
||||
}
|
||||
|
||||
function elepm.get_recipe(type, inputs)
|
||||
if not elepm.craft[type] or not inputs then
|
||||
return nil
|
||||
return no_recipe
|
||||
end
|
||||
|
||||
-- Minetest's cooking builtin type
|
||||
@ -70,7 +76,7 @@ function elepm.get_recipe(type, inputs)
|
||||
})
|
||||
|
||||
if not result or result.time == 0 then
|
||||
return nil
|
||||
return no_recipe
|
||||
else
|
||||
return {
|
||||
time = result.time,
|
||||
@ -81,7 +87,7 @@ function elepm.get_recipe(type, inputs)
|
||||
end
|
||||
|
||||
-- Custom types
|
||||
local result = nil
|
||||
local result = no_recipe
|
||||
for _,recipe in ipairs(elepm.craft[type]) do
|
||||
local recip_match = true
|
||||
local inputs_full = {}
|
||||
|
@ -111,13 +111,25 @@ end)
|
||||
-- CRAFTING RECIPES --
|
||||
--******************--
|
||||
|
||||
-- Coal-fired Alloy Furnace
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:coal_alloy_furnace",
|
||||
recipe = {
|
||||
{"default:brick", "default:brick", "default:brick"},
|
||||
{"default:furnace", "bucket:bucket_lava", "default:furnace"}
|
||||
},
|
||||
replacements = {
|
||||
{"bucket:bucket_lava", "bucket:bucket_empty"}
|
||||
}
|
||||
})
|
||||
|
||||
-- Machine block
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:machine_block",
|
||||
recipe = {
|
||||
{"group:glass", "default:steel_ingot", "group:glass"},
|
||||
{"elepower_dynamics:viridisium_ingot", "default:steel_ingot", "elepower_dynamics:viridisium_ingot"},
|
||||
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
|
||||
{"group:glass", "default:steel_ingot", "group:glass"},
|
||||
{"elepower_dynamics:viridisium_ingot", "elepower_dynamics:tin_gear", "elepower_dynamics:viridisium_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
@ -135,9 +147,13 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:alloy_furnace",
|
||||
recipe = {
|
||||
{"", "elepower_dynamics:copper_wire", ""},
|
||||
{"", "elepower_dynamics:integrated_circuit", ""},
|
||||
{"default:brick", "elepower_machines:machine_block", "default:brick"},
|
||||
{"default:furnace", "elepower_dynamics:wound_copper_coil", "default:furnace"},
|
||||
{
|
||||
"elepower_dynamics:wound_copper_coil",
|
||||
"elepower_machines:coal_alloy_furnace",
|
||||
"elepower_dynamics:wound_copper_coil"
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@ -145,7 +161,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:furnace",
|
||||
recipe = {
|
||||
{"", "elepower_dynamics:copper_wire", ""},
|
||||
{"", "elepower_dynamics:integrated_circuit", ""},
|
||||
{"default:clay_brick", "elepower_machines:machine_block", "default:clay_brick"},
|
||||
{"elepower_dynamics:wound_copper_coil", "default:furnace", "elepower_dynamics:wound_copper_coil"},
|
||||
}
|
||||
@ -155,7 +171,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:pulverizer",
|
||||
recipe = {
|
||||
{"", "elepower_dynamics:copper_wire", ""},
|
||||
{"", "elepower_dynamics:integrated_circuit", ""},
|
||||
{"default:flint", "elepower_machines:machine_block", "default:flint"},
|
||||
{"elepower_dynamics:wound_copper_coil", "elepower_dynamics:lead_gear", "elepower_dynamics:wound_copper_coil"},
|
||||
}
|
||||
@ -165,7 +181,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:sawmill",
|
||||
recipe = {
|
||||
{"", "elepower_dynamics:copper_wire", ""},
|
||||
{"", "elepower_dynamics:integrated_circuit", ""},
|
||||
{"elepower_dynamics:steel_gear", "elepower_machines:machine_block", "elepower_dynamics:steel_gear"},
|
||||
{"elepower_dynamics:lead_ingot", "elepower_dynamics:diamond_gear", "elepower_dynamics:lead_ingot"},
|
||||
}
|
||||
@ -175,7 +191,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:power_cell_0",
|
||||
recipe = {
|
||||
{"elepower_dynamics:lead_ingot", "elepower_dynamics:copper_wire", "elepower_dynamics:lead_ingot"},
|
||||
{"elepower_dynamics:lead_ingot", "elepower_dynamics:control_circuit", "elepower_dynamics:lead_ingot"},
|
||||
{"elepower_dynamics:wound_copper_coil", "elepower_machines:machine_block", "elepower_dynamics:wound_copper_coil"},
|
||||
{"elepower_dynamics:lead_ingot", "elepower_dynamics:diamond_gear", "elepower_dynamics:lead_ingot"},
|
||||
}
|
||||
|
@ -65,3 +65,26 @@ function ele.formspec.get_storage_formspec(power)
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
end
|
||||
|
||||
function elepm.get_coal_alloy_furnace_formspec(fuel_percent, item_percent)
|
||||
return "size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[context;src;2,0.5;2,1;]"..
|
||||
"list[context;fuel;2.5,2.5;1,1;]"..
|
||||
"image[2.5,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
|
||||
"image[4,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||
"list[context;dst;5,0.96;2,2;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"listring[context;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;fuel]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
end
|
||||
|
@ -36,14 +36,14 @@ function elepm.register_crafter(nodename, nodedef)
|
||||
local power_operation = false
|
||||
|
||||
-- Determine if there is enough power for this action
|
||||
if result and storage >= usage then
|
||||
if result.time ~= 0 and storage >= usage then
|
||||
power_operation = true
|
||||
end
|
||||
|
||||
if not result or not power_operation then
|
||||
if result.time == 0 or not power_operation then
|
||||
ele.helpers.swap_node(pos, machine_node)
|
||||
|
||||
if not result then
|
||||
if result.time == 0 then
|
||||
meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, pow_percent))
|
||||
meta:set_int("src_time", 0)
|
||||
meta:set_string("infotext", ("%s Idle"):format(nodedef.description) ..
|
||||
|
224
elepower_machines/machines/coal_alloy_furnace.lua
Normal file
@ -0,0 +1,224 @@
|
||||
|
||||
local function can_dig(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src")
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "fuel" then
|
||||
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == "src" then
|
||||
return stack:get_count()
|
||||
elseif listname == "dst" then
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
local function alloy_furnace_timer(pos, elapsed)
|
||||
--
|
||||
-- Inizialize metadata
|
||||
--
|
||||
local meta = minetest.get_meta(pos)
|
||||
local fuel_time = meta:get_float("fuel_time") or 0
|
||||
local src_time = meta:get_float("src_time") or 0
|
||||
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
local srclist, fuellist
|
||||
|
||||
local alloyable
|
||||
local fuel
|
||||
local time = 0
|
||||
|
||||
local update = true
|
||||
while elapsed > 0 and update do
|
||||
update = false
|
||||
|
||||
srclist = inv:get_list("src")
|
||||
fuellist = inv:get_list("fuel")
|
||||
|
||||
--
|
||||
-- Alloying
|
||||
--
|
||||
|
||||
-- Check if we have alloyable content
|
||||
local alloy = elepm.get_recipe("alloy", srclist)
|
||||
local afteralloy = alloy.new_input
|
||||
alloyable = alloy.time ~= 0
|
||||
|
||||
local el = math.min(elapsed, fuel_totaltime - fuel_time)
|
||||
if alloyable then -- fuel lasts long enough, adjust el to cooking duration
|
||||
time = alloy.time + 4
|
||||
el = math.min(el, time - src_time)
|
||||
end
|
||||
|
||||
-- Check if we have enough fuel to burn
|
||||
if fuel_time < fuel_totaltime then
|
||||
-- The furnace is currently active and has enough fuel
|
||||
fuel_time = fuel_time + el
|
||||
-- If there is a alloyable item then check if it is ready yet
|
||||
if alloyable then
|
||||
src_time = src_time + el
|
||||
if src_time >= time then
|
||||
-- Place result in dst list if possible
|
||||
if inv:room_for_item("dst", alloy.output) then
|
||||
inv:add_item("dst", alloy.output)
|
||||
inv:set_list("src", afteralloy)
|
||||
src_time = src_time - time
|
||||
update = true
|
||||
end
|
||||
else
|
||||
-- Item could not be alloy: probably missing fuel
|
||||
update = true
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Furnace ran out of fuel
|
||||
if alloyable then
|
||||
-- We need to get new fuel
|
||||
local afterfuel
|
||||
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
|
||||
if fuel.time == 0 then
|
||||
-- No valid fuel in fuel list
|
||||
fuel_totaltime = 0
|
||||
src_time = 0
|
||||
else
|
||||
-- Take fuel from fuel list
|
||||
inv:set_stack("fuel", 1, afterfuel.items[1])
|
||||
update = true
|
||||
fuel_totaltime = fuel.time + (fuel_totaltime - fuel_time)
|
||||
end
|
||||
else
|
||||
-- We don't need to get new fuel since there is no alloyable item
|
||||
fuel_totaltime = 0
|
||||
src_time = 0
|
||||
end
|
||||
fuel_time = 0
|
||||
end
|
||||
|
||||
elapsed = elapsed - el
|
||||
end
|
||||
|
||||
if fuel and fuel_totaltime > time then
|
||||
fuel_totaltime = time
|
||||
end
|
||||
if srclist[1]:is_empty() then
|
||||
src_time = 0
|
||||
end
|
||||
|
||||
--
|
||||
-- Update formspec, infotext and node
|
||||
--
|
||||
local formspec
|
||||
local item_percent = 0
|
||||
if alloyable then
|
||||
item_percent = math.floor(src_time / time * 100)
|
||||
end
|
||||
|
||||
local active = "Inactive"
|
||||
local result = false
|
||||
|
||||
if fuel_totaltime ~= 0 then
|
||||
active = "Active"
|
||||
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
|
||||
formspec = elepm.get_coal_alloy_furnace_formspec(fuel_percent, item_percent)
|
||||
ele.helpers.swap_node(pos, "elepower_machines:coal_alloy_furnace_active")
|
||||
result = true
|
||||
else
|
||||
formspec = elepm.get_coal_alloy_furnace_formspec(100, 0)
|
||||
ele.helpers.swap_node(pos, "elepower_machines:coal_alloy_furnace")
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
|
||||
local infotext = "Alloy Furnace " .. active
|
||||
|
||||
--
|
||||
-- Set meta values
|
||||
--
|
||||
meta:set_float("fuel_totaltime", fuel_totaltime)
|
||||
meta:set_float("fuel_time", fuel_time)
|
||||
meta:set_float("src_time", src_time)
|
||||
meta:set_string("formspec", formspec)
|
||||
meta:set_string("infotext", infotext)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local function metadata_inventory_changed(pos)
|
||||
local t = minetest.get_node_timer(pos)
|
||||
|
||||
if not t:is_started() then
|
||||
t:start(1.0)
|
||||
end
|
||||
end
|
||||
|
||||
ele.register_base_device("elepower_machines:coal_alloy_furnace", {
|
||||
description = "Coal-fired Alloy Furnace",
|
||||
paramtype2 = "facedir",
|
||||
ele_active_node = true,
|
||||
ele_active_nodedef = {
|
||||
tiles = {
|
||||
"elepower_cfalloy_top.png", "elepower_cfalloy_bottom.png", "elepower_cfalloy_side.png",
|
||||
"elepower_cfalloy_side.png", "elepower_cfalloy_side.png", {
|
||||
name = "elepower_cfalloy_front_active.png",
|
||||
animation = {
|
||||
aspect_h = 16,
|
||||
aspect_w = 16,
|
||||
length = 1,
|
||||
type = "vertical_frames",
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tiles = {
|
||||
"elepower_cfalloy_top.png", "elepower_cfalloy_bottom.png", "elepower_cfalloy_side.png",
|
||||
"elepower_cfalloy_side.png", "elepower_cfalloy_side.png", "elepower_cfalloy_front.png"
|
||||
},
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
inv:set_size("src", 2)
|
||||
inv:set_size("dst", 4)
|
||||
inv:set_size("fuel", 1)
|
||||
|
||||
meta:set_string("formspec", elepm.get_coal_alloy_furnace_formspec(100, 0))
|
||||
end,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
on_metadata_inventory_move = metadata_inventory_changed,
|
||||
on_metadata_inventory_take = metadata_inventory_changed,
|
||||
on_metadata_inventory_put = metadata_inventory_changed,
|
||||
can_dig = can_dig,
|
||||
on_timer = alloy_furnace_timer,
|
||||
groups = {
|
||||
tubedevice = 1,
|
||||
cracky = 2,
|
||||
}
|
||||
})
|
@ -3,6 +3,7 @@ dofile(elepm.modpath.."/machines/bases/init.lua")
|
||||
dofile(elepm.modpath.."/machines/accumulator.lua")
|
||||
dofile(elepm.modpath.."/machines/furnace.lua")
|
||||
dofile(elepm.modpath.."/machines/alloy_furnace.lua")
|
||||
dofile(elepm.modpath.."/machines/coal_alloy_furnace.lua")
|
||||
dofile(elepm.modpath.."/machines/pulverizer.lua")
|
||||
dofile(elepm.modpath.."/machines/sawmill.lua")
|
||||
dofile(elepm.modpath.."/machines/generator.lua")
|
||||
|
BIN
elepower_machines/textures/elepower_cfalloy_bottom.png
Normal file
After Width: | Height: | Size: 540 B |
BIN
elepower_machines/textures/elepower_cfalloy_front.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
elepower_machines/textures/elepower_cfalloy_front_active.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
elepower_machines/textures/elepower_cfalloy_side.png
Normal file
After Width: | Height: | Size: 686 B |
BIN
elepower_machines/textures/elepower_cfalloy_top.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
72
elepower_nuclear/craftitems.lua
Normal file
@ -0,0 +1,72 @@
|
||||
|
||||
---------------------------
|
||||
-- Fission-related items --
|
||||
---------------------------
|
||||
|
||||
-- Uranium
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:uranium_lump", {
|
||||
description = "Uranium Lump",
|
||||
inventory_image = "elenuclear_uranium_lump.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:uranium_ingot", {
|
||||
description = "Enriched Uranium Ingot",
|
||||
inventory_image = "elenuclear_uranium_ingot.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:depleted_uranium_ingot", {
|
||||
description = "Depleted Uranium Ingot",
|
||||
inventory_image = "elenuclear_depleted_uranium_ingot.png"
|
||||
})
|
||||
|
||||
-- Dusts
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:uranium_dust", {
|
||||
description = "Enriched Uranium Dust",
|
||||
inventory_image = "elenuclear_uranium_dust.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:depleted_uranium_dust", {
|
||||
description = "Depleted Uranium Dust",
|
||||
inventory_image = "elenuclear_depleted_uranium_dust.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:uranium_waste", {
|
||||
description = "Uranium Waste",
|
||||
inventory_image = "elenuclear_uranium_waste.png"
|
||||
})
|
||||
|
||||
-- Fuel rods
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:fuel_rod_empty", {
|
||||
description = "Empty Fuel Rod",
|
||||
inventory_image = "elenuclear_fuel_rod_empty.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:fuel_rod_fissile", {
|
||||
description = "Fissile Fuel Rod",
|
||||
inventory_image = "elenuclear_fuel_rod_fissile.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:fuel_rod_depleted", {
|
||||
description = "Depleted Fuel Rod",
|
||||
inventory_image = "elenuclear_fuel_rod_depleted.png"
|
||||
})
|
||||
|
||||
--------------------------
|
||||
-- Fusion-related items --
|
||||
--------------------------
|
||||
|
||||
|
||||
|
||||
-------------------------
|
||||
-- Crafting components --
|
||||
-------------------------
|
||||
|
||||
-- Graphite
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:graphite_rod", {
|
||||
description = "Graphite Rod",
|
||||
inventory_image = "elenuclear_graphite_rod.png"
|
||||
})
|
@ -5,3 +5,5 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
elenuclear = rawget(_G, "elenuclear") or {}
|
||||
elenuclear.modpath = modpath
|
||||
|
||||
dofile(modpath.."/craftitems.lua")
|
||||
|
BIN
elepower_nuclear/textures/elenuclear_depleted_uranium_dust.png
Normal file
After Width: | Height: | Size: 422 B |
BIN
elepower_nuclear/textures/elenuclear_depleted_uranium_ingot.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
elepower_nuclear/textures/elenuclear_fuel_rod_depleted.png
Normal file
After Width: | Height: | Size: 414 B |
BIN
elepower_nuclear/textures/elenuclear_fuel_rod_empty.png
Normal file
After Width: | Height: | Size: 413 B |
BIN
elepower_nuclear/textures/elenuclear_fuel_rod_fissile.png
Normal file
After Width: | Height: | Size: 420 B |
BIN
elepower_nuclear/textures/elenuclear_graphite_moderator.png
Normal file
After Width: | Height: | Size: 419 B |
BIN
elepower_nuclear/textures/elenuclear_graphite_rod.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
elepower_nuclear/textures/elenuclear_heat_exchanger.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
elepower_nuclear/textures/elenuclear_reinforced_block.png
Normal file
After Width: | Height: | Size: 515 B |
BIN
elepower_nuclear/textures/elenuclear_uranium_dust.png
Normal file
After Width: | Height: | Size: 381 B |
BIN
elepower_nuclear/textures/elenuclear_uranium_ingot.png
Normal file
After Width: | Height: | Size: 481 B |
BIN
elepower_nuclear/textures/elenuclear_uranium_lump.png
Normal file
After Width: | Height: | Size: 481 B |
BIN
elepower_nuclear/textures/elenuclear_uranium_waste.png
Normal file
After Width: | Height: | Size: 404 B |
@ -74,7 +74,7 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
function metadata_inventory_changed(pos)
|
||||
local function metadata_inventory_changed(pos)
|
||||
local t = minetest.get_node_timer(pos)
|
||||
|
||||
if not t:is_started() then
|
||||
|