Uranium enrichment!
This commit is contained in:
parent
b00ddce531
commit
f258a451ef
@ -73,6 +73,13 @@ function elepm.register_crafter(nodename, nodedef)
|
||||
nodedef.groups["tubedevice"] = 1
|
||||
nodedef.groups["tubedevice_receiver"] = 1
|
||||
|
||||
-- Allow for custom formspec
|
||||
local get_formspec = ele.formspec.get_crafter_formspec
|
||||
if nodedef.get_formspec then
|
||||
get_formspec = nodedef.get_formspec
|
||||
nodedef.get_formspec = nil
|
||||
end
|
||||
|
||||
nodedef.on_timer = function (pos, elapsed)
|
||||
local refresh = false
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -102,13 +109,13 @@ function elepm.register_crafter(nodename, nodedef)
|
||||
ele.helpers.swap_node(pos, machine_node)
|
||||
|
||||
if result.time == 0 then
|
||||
meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, pow_percent))
|
||||
meta:set_string("formspec", get_formspec(craft_type, pow_percent, nil, pos))
|
||||
time = 0
|
||||
meta:set_string("infotext", ("%s Idle"):format(nodedef.description) ..
|
||||
"\n" .. ele.capacity_text(capacity, storage))
|
||||
else
|
||||
local pct = math.floor((ele.helpers.round(result.time * 10) / meta:get_int("src_time")) * 100)
|
||||
meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, pow_percent, pct))
|
||||
meta:set_string("formspec", get_formspec(craft_type, pow_percent, pct, pos))
|
||||
meta:set_string("infotext", ("%s Out of Power!"):format(nodedef.description) ..
|
||||
"\n" .. ele.capacity_text(capacity, storage))
|
||||
end
|
||||
@ -136,7 +143,7 @@ function elepm.register_crafter(nodename, nodedef)
|
||||
|
||||
if time <= ele.helpers.round(result.time * 10) then
|
||||
local pct = math.floor((time / ele.helpers.round(result.time * 10)) * 100)
|
||||
meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, pow_percent, pct))
|
||||
meta:set_string("formspec", get_formspec(craft_type, pow_percent, pct, pos))
|
||||
break
|
||||
end
|
||||
|
||||
@ -161,7 +168,7 @@ function elepm.register_crafter(nodename, nodedef)
|
||||
|
||||
if not room_for_output then
|
||||
ele.helpers.swap_node(pos, machine_node)
|
||||
meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, pow_percent))
|
||||
meta:set_string("formspec", get_formspec(craft_type, pow_percent, nil, pos))
|
||||
time = ele.helpers.round(result.time*10)
|
||||
meta:set_string("infotext", ("%s Output Full!"):format(nodedef.description) ..
|
||||
"\n" .. ele.capacity_text(capacity, storage))
|
||||
@ -187,7 +194,8 @@ 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")
|
||||
meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, capacity, storage))
|
||||
local pow_percent = math.floor((storage / capacity) * 100)
|
||||
meta:set_string("formspec", get_formspec(craft_type, pow_percent, nil, pos))
|
||||
end
|
||||
|
||||
ele.register_machine(nodename, nodedef)
|
||||
|
@ -19,6 +19,28 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
elepm.register_craft({
|
||||
type = "enrichment",
|
||||
output = { "elepower_nuclear:uranium_dust", "elepower_nuclear:depleted_uranium_dust 3"},
|
||||
recipe = { "elepower_nuclear:uranium_lump 4" },
|
||||
time = 30,
|
||||
})
|
||||
|
||||
elepm.register_craft({
|
||||
type = "enrichment",
|
||||
output = { "elepower_nuclear:uranium_dust", "elepower_nuclear:depleted_uranium_dust", "elepower_nuclear:nuclear_waste 2"},
|
||||
recipe = { "elepower_nuclear:depleted_uranium_dust 4" },
|
||||
time = 40,
|
||||
})
|
||||
|
||||
elepm.register_craft({
|
||||
type = "enrichment",
|
||||
output = { "elepower_nuclear:depleted_uranium_dust", "elepower_nuclear:nuclear_waste 3"},
|
||||
recipe = { "elepower_nuclear:nuclear_waste 4" },
|
||||
time = 50,
|
||||
})
|
||||
|
||||
-- Graphite rods
|
||||
elepm.register_craft({
|
||||
type = "grind",
|
||||
recipe = { "elepower_dynamics:graphite_ingot" },
|
||||
|
@ -10,30 +10,20 @@ minetest.register_craftitem("elepower_nuclear: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",
|
||||
description = "Enriched Uranium Dust\nReady to be used as fuel",
|
||||
inventory_image = "elenuclear_uranium_dust.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:depleted_uranium_dust", {
|
||||
description = "Depleted Uranium Dust",
|
||||
description = "Depleted Uranium Dust\nRequires enrichment",
|
||||
inventory_image = "elenuclear_depleted_uranium_dust.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("elepower_nuclear:uranium_waste", {
|
||||
description = "Uranium Waste",
|
||||
minetest.register_craftitem("elepower_nuclear:nuclear_waste", {
|
||||
description = "Nuclear Waste\nMostly unusable",
|
||||
inventory_image = "elenuclear_uranium_waste.png"
|
||||
})
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
-- Nuclear fuel enrichment plant
|
||||
|
||||
local function get_formspec(power, heat, progress, water)
|
||||
local function get_formspec(craft_type, power, progress, pos)
|
||||
if not progress then progress = 0 end
|
||||
return "size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
ele.formspec.power_meter(power)..
|
||||
ele.formspec.create_bar(1, 0, heat, "#ffbb11", true)..
|
||||
"list[context;src;2,0.75;1,1;]"..
|
||||
"image[3.5,0.75;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||
(progress)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||
"list[context;dst;5,0.25;2,2;]"..
|
||||
ele.formspec.fluid_bar(7, 0, water)..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"image[7,3;1,1;elenuclear_radioactive.png]"..
|
||||
@ -23,38 +22,21 @@ local function get_formspec(power, heat, progress, water)
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
end
|
||||
|
||||
local function enrichment_plant_timer (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local refresh = false
|
||||
elepm.register_craft_type("enrichment", {
|
||||
description = "Enrichment",
|
||||
inputs = 1,
|
||||
})
|
||||
|
||||
return refresh
|
||||
end
|
||||
|
||||
ele.register_machine("elepower_nuclear:enrichment_plant", {
|
||||
elepm.register_crafter("elepower_nuclear:enrichment_plant", {
|
||||
description = "Enrichment Plant",
|
||||
craft_type = "enrichment",
|
||||
tiles = {
|
||||
"elenuclear_machine_top.png", "elenuclear_machine_top.png", "elenuclear_machine_side.png",
|
||||
"elenuclear_machine_side.png", "elenuclear_machine_side.png", "elenuclear_enrichment_plant.png",
|
||||
},
|
||||
groups = {ele_user = 1, cracky = 3, fluid_container = 1},
|
||||
ele_capacity = 16000,
|
||||
ele_usage = 288,
|
||||
ele_inrush = 288,
|
||||
fluid_buffers = {
|
||||
water = {
|
||||
accepts = {"default:water_source"},
|
||||
capacity = 8000,
|
||||
drainable = false,
|
||||
}
|
||||
},
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
inv:set_size("src", 1)
|
||||
inv:set_size("dst", 4)
|
||||
|
||||
meta:set_string("formspec", get_formspec(0, 25, 0, nil))
|
||||
end,
|
||||
on_timer = enrichment_plant_timer,
|
||||
groups = {ele_user = 1, cracky = 3},
|
||||
ele_capacity = 64000,
|
||||
ele_usage = 1000,
|
||||
ele_inrush = 8000,
|
||||
get_formspec = get_formspec,
|
||||
})
|
||||
|
@ -3,7 +3,7 @@
|
||||
ele.formspec = {}
|
||||
|
||||
function ele.formspec.create_bar(x, y, metric, color, small)
|
||||
if not metric or metric < 0 then metric = 0 end
|
||||
if not metric or type(metric) ~= "number" or metric < 0 then metric = 0 end
|
||||
|
||||
local width = 1
|
||||
local gauge = "image[0,0;1,2.8;elepower_gui_gauge.png]"
|
||||
|
Loading…
Reference in New Issue
Block a user