// Machines: buildings with item slots that process their own recipes over time. // Interacting with a machine opens its window; put items into the input slots // and collect the results from the output slots. // // Fields: // id id of the building this machine belongs to (required) // input_slots number of input slots (1) // output_slots number of output slots (1) // recipes [{ id, name, inputs, outputs, time (seconds, default 1.0) }] // The first recipe whose inputs are present and whose outputs // fit is processed. // active_variant building variant shown while working // ui window layout, everything optional: // background PNG drawn behind the slots (relative to assets/) // size (width, height) of the window content in pixels // slot_size slot size in pixels (40) // inputs one (x, y) per input slot; default: column on the left // outputs one (x, y) per output slot; default: column on the right // progress progress bar (x, y, width, height); default: between the columns machines: [ { id: "furnace", input_slots: 2, output_slots: 1, active_variant: Some("lit"), recipes: [ { id: "smelt_iron", name: Some("Smelt iron plates"), inputs: [("iron_ore", 4), ("log", 1)], outputs: [("iron_plate", 2)], time: 4.0, }, ], }, { id: "assembler", input_slots: 3, output_slots: 1, active_variant: Some("active"), recipes: [ { id: "assemble_wrench", inputs: [("iron_plate", 2)], outputs: [("wrench", 1)], time: 3.0 }, { id: "assemble_screwdriver", inputs: [("iron_plate", 1), ("plank", 1)], outputs: [("screwdriver", 1)], time: 3.0 }, ], ui: { background: Some("ui/machines/assembler.png"), size: Some((260.0, 150.0)), inputs: [(16.0, 14.0), (16.0, 96.0), (70.0, 55.0)], outputs: [(200.0, 55.0)], progress: Some((124.0, 69.0, 60.0, 12.0)), }, }, ]