Add copper, and the beginnings of a machine system.

This commit is contained in:
Signal 2025-12-29 16:53:50 -05:00
parent 30ba6e5385
commit 1e897665bb
69 changed files with 976 additions and 135 deletions

View file

@ -5,8 +5,9 @@ local function can_work(node, m, inv)
if input:get_count() > 0 then
-- Would melting this item exceed our fluid capacity?
local fluid = m:get_float "fluid"
local capacity = m:get_int "fluid_capacity"
if capacity -fluid >= 1 then
local fluid_type = m:get "fluid_type"
local capacity = m:get_float "fluid_capacity"
if capacity -fluid >= 1 and (fluid == 0 or input:get_definition().material == fluid_type) then
return true
end
end
@ -16,7 +17,7 @@ end
local function update_formspec(m, progress)
progress = progress or m:get_int "progress"
local fluid = m:get_float "fluid"
local capacity = m:get_int "fluid_capacity"
local capacity = m:get_float "fluid_capacity"
local progressbar = progress == 0 and "rgt_progress_bg.png^[transformR270" or "rgt_progress_bg.png^[lowpart:"..progress..":rgt_progress_bg_active.png^[transformR270"
local fluidcontainer = fluid == 0 and "rgt_fluid_container_bg.png" or "rgt_fluid_container_bg.png^[lowpart:"..(fluid /capacity *100)..":rgt_fluid_container_bg_filled.png"
local fs = {"\
@ -57,11 +58,14 @@ local function update(pos, elapsed)
minetest.swap_node(pos, node)
end
local progress = m:get_int("progress") +20
local progress = m:get_int("progress") +50
if progress >= 100 then
local fluid = m:get_float "fluid"
fluid = fluid +1
if fluid >= 2 then
fluid = fluid -rgt_machines.push_fluid(pos, m:get "fluid_type", fluid)
end
m:set_float("fluid", fluid)
-- Consume an item.
@ -69,6 +73,8 @@ local function update(pos, elapsed)
s:take_item()
inv:set_stack("input", 1, s)
m:set_string("fluid_type", s:get_definition().material)
progress = 0
end
m:set_int("progress", progress)
@ -90,7 +96,7 @@ rgt_machines.register_machine("arc_furnace", {
},
active = {
tiles = {"rgt_iron_block.png", "rgt_iron_block.png", "rgt_iron_block.png", "rgt_iron_block.png", "rgt_iron_block.png", "rgt_arc_furnace_front_active.png"},
drop = "arc_furnace_idle"
drop = "arc_furnace_idle",
}
},
paramtype2 = "4dir",
@ -100,7 +106,7 @@ rgt_machines.register_machine("arc_furnace", {
local inv = m:get_inventory()
inv:set_size("input", 1)
m:set_int("fluid_capacity", 10)
m:set_float("fluid_capacity", 10)
m:set_string("active", "false")
update_formspec(m)

View file

@ -1,2 +1,2 @@
name = rgt_arc_furnace
depends = rgt_machines_core
depends = rgt_machines