PCB Etching plant
This commit is contained in:
parent
e8fe4a09e5
commit
f710c3472c
@ -210,6 +210,15 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "elepower_dynamics:pcb_blank",
|
||||||
|
recipe = {
|
||||||
|
{"", "elepower_dynamics:copper_plate", ""},
|
||||||
|
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
|
||||||
|
{"", "elepower_dynamics:gold_plate", ""},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "elepower_dynamics:acidic_compound",
|
output = "elepower_dynamics:acidic_compound",
|
||||||
@ -222,6 +231,15 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "elepower_dynamics:uv_bulb",
|
||||||
|
recipe = {
|
||||||
|
{"group:color_blue", "group:color_violet", "group:color_blue"},
|
||||||
|
{"", "default:meselamp", ""},
|
||||||
|
{"", "default:glass", ""},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- Fluid Transfer Node
|
-- Fluid Transfer Node
|
||||||
minetest.clear_craft({output = "fluid_transfer:fluid_transfer_pump"})
|
minetest.clear_craft({output = "fluid_transfer:fluid_transfer_pump"})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -249,6 +249,12 @@ minetest.register_craftitem("elepower_dynamics:capacitor", {
|
|||||||
groups = {capacitor = 1, component = 1}
|
groups = {capacitor = 1, component = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("elepower_dynamics:uv_bulb", {
|
||||||
|
description = "Ultraviolet Light Bulb",
|
||||||
|
inventory_image = "elepower_uv_bulb.png",
|
||||||
|
groups = {component = 1, bulb = 1}
|
||||||
|
})
|
||||||
|
|
||||||
-- Assembled Components
|
-- Assembled Components
|
||||||
|
|
||||||
minetest.register_craftitem("elepower_dynamics:battery", {
|
minetest.register_craftitem("elepower_dynamics:battery", {
|
||||||
|
BIN
elepower_dynamics/textures/elepower_uv_bulb.png
Normal file
BIN
elepower_dynamics/textures/elepower_uv_bulb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 467 B |
@ -728,3 +728,13 @@ minetest.register_craft({
|
|||||||
{"elepower_dynamics:induction_coil", "elepower_dynamics:zinc_plate", "elepower_dynamics:induction_coil"},
|
{"elepower_dynamics:induction_coil", "elepower_dynamics:zinc_plate", "elepower_dynamics:induction_coil"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- PCB Plant
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "elepower_machines:pcb_plant",
|
||||||
|
recipe = {
|
||||||
|
{"", "elepower_dynamics:integrated_circuit", ""},
|
||||||
|
{"elepower_dynamics:chip", "elepower_machines:machine_block", "elepower_dynamics:chip"},
|
||||||
|
{"elepower_dynamics:servo_valve", "elepower_dynamics:uv_bulb", "elepower_dynamics:bronze_gear"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@ -30,6 +30,7 @@ dofile(mp .. "electrolyzer.lua")
|
|||||||
dofile(mp .. "evaporator.lua")
|
dofile(mp .. "evaporator.lua")
|
||||||
|
|
||||||
-- Other
|
-- Other
|
||||||
|
dofile(mp .. "pcb_plant.lua")
|
||||||
dofile(mp .. "accumulator.lua")
|
dofile(mp .. "accumulator.lua")
|
||||||
dofile(mp .. "lava_cooler.lua")
|
dofile(mp .. "lava_cooler.lua")
|
||||||
dofile(mp .. "bucketer.lua")
|
dofile(mp .. "bucketer.lua")
|
||||||
|
172
elepower_machines/machines/pcb_plant.lua
Normal file
172
elepower_machines/machines/pcb_plant.lua
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
|
||||||
|
local function get_formspec(power, input, state, active, percent)
|
||||||
|
local t = "image[3.5,1.75;1,1;elepower_uv_bulb.png]"
|
||||||
|
|
||||||
|
if active then
|
||||||
|
t = "image[3.5,1.75;1,1;elepower_uv_bulb_lit.png]"
|
||||||
|
end
|
||||||
|
|
||||||
|
return "size[8,8.5]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
ele.formspec.power_meter(power)..
|
||||||
|
ele.formspec.state_switcher(7, 0, state)..
|
||||||
|
ele.formspec.fluid_bar(1, 0, input)..
|
||||||
|
"image[3.5,1;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||||
|
(percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||||
|
t..
|
||||||
|
"list[context;src;2.5,1;1,1;]"..
|
||||||
|
"list[context;dst;4.5,1;1,1;]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;src]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_timer(pos, elapsed)
|
||||||
|
local refresh = false
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
|
local input = fluid_lib.get_buffer_data(pos, "acid")
|
||||||
|
local src = inv:get_stack("src", 1)
|
||||||
|
local dst = inv:get_stack("dst", 1)
|
||||||
|
local state = meta:get_int("state")
|
||||||
|
local time = meta:get_int("time")
|
||||||
|
|
||||||
|
local is_enabled = ele.helpers.state_enabled(meta, pos, state)
|
||||||
|
|
||||||
|
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
|
||||||
|
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, usage = 0}
|
||||||
|
|
||||||
|
local status = "Idle"
|
||||||
|
|
||||||
|
while true do
|
||||||
|
if not is_enabled then
|
||||||
|
status = "Off"
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
if pow_buffer.storage < usage then
|
||||||
|
status = "Out of Power!"
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
if src:is_empty() or src:get_name() ~= "elepower_dynamics:pcb_blank" then
|
||||||
|
time = 0
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
if input.fluid == "" or input.amount < 10 then
|
||||||
|
status = "Out of Acid!"
|
||||||
|
time = 0
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
status = "Active"
|
||||||
|
pow_buffer.usage = usage
|
||||||
|
pow_buffer.storage = pow_buffer.storage - usage
|
||||||
|
|
||||||
|
input.amount = input.amount - 10
|
||||||
|
refresh = true
|
||||||
|
|
||||||
|
if input.amount == 0 then
|
||||||
|
input.fluid = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
if time < 4 then
|
||||||
|
time = time + 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
if not inv:room_for_item("dst", ItemStack("elepower_dynamics:pcb")) then
|
||||||
|
status = "Output full!"
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
src:take_item(1)
|
||||||
|
inv:add_item("dst", "elepower_dynamics:pcb")
|
||||||
|
inv:set_list("src", {src})
|
||||||
|
time = 0
|
||||||
|
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
local active = status == "Active"
|
||||||
|
if active then
|
||||||
|
ele.helpers.swap_node(pos, "elepower_machines:pcb_plant_active")
|
||||||
|
else
|
||||||
|
ele.helpers.swap_node(pos, "elepower_machines:pcb_plant")
|
||||||
|
end
|
||||||
|
|
||||||
|
meta:set_int("acid_fluid_storage", input.amount)
|
||||||
|
meta:set_string("acid_fluid", input.fluid)
|
||||||
|
|
||||||
|
meta:set_int("storage", pow_buffer.storage)
|
||||||
|
meta:set_int("time", time)
|
||||||
|
|
||||||
|
meta:set_string("infotext", ("PCB Plant %s\n%s"):format(status, ele.capacity_text(pow_buffer.capacity, pow_buffer.storage)))
|
||||||
|
meta:set_string("formspec", get_formspec(pow_buffer, input, state, active, math.floor((time / 4) * 100)))
|
||||||
|
|
||||||
|
return refresh
|
||||||
|
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
|
||||||
|
|
||||||
|
if listname == "dst" or (listname == "src" and stack:get_name() ~= "elepower_dynamics:pcb_blank") then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
return stack:get_count()
|
||||||
|
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
|
||||||
|
|
||||||
|
ele.register_machine("elepower_machines:pcb_plant", {
|
||||||
|
description = "Printed Circuit Board Plant",
|
||||||
|
groups = {oddly_breakable_by_hand = 1, cracky = 1, fluid_container = 1, ele_user = 1},
|
||||||
|
fluid_buffers = {
|
||||||
|
acid = {
|
||||||
|
capacity = 8000,
|
||||||
|
accepts = {"elepower_dynamics:etching_acid_source"},
|
||||||
|
drainable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_timer = on_timer,
|
||||||
|
on_construct = function (pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("src", 1)
|
||||||
|
inv:set_size("dst", 1)
|
||||||
|
meta:set_string("formspec", get_formspec())
|
||||||
|
end,
|
||||||
|
tiles = {
|
||||||
|
"elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png",
|
||||||
|
"elepower_machine_side.png", "elepower_machine_side.png", "elepower_machine_side.png^elepower_pcb_plant.png",
|
||||||
|
},
|
||||||
|
ele_active_node = true,
|
||||||
|
ele_active_nodedef = {
|
||||||
|
tiles = {
|
||||||
|
"elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png",
|
||||||
|
"elepower_machine_side.png", "elepower_machine_side.png", "elepower_machine_side.png^elepower_pcb_plant_active.png",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ele_usage = 32,
|
||||||
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
|
})
|
BIN
elepower_machines/textures/elepower_pcb_plant.png
Normal file
BIN
elepower_machines/textures/elepower_pcb_plant.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 529 B |
BIN
elepower_machines/textures/elepower_pcb_plant_active.png
Normal file
BIN
elepower_machines/textures/elepower_pcb_plant_active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 547 B |
BIN
elepower_machines/textures/elepower_uv_bulb_lit.png
Normal file
BIN
elepower_machines/textures/elepower_uv_bulb_lit.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 465 B |
Loading…
Reference in New Issue
Block a user