mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/block/production.rs')
| -rw-r--r-- | src/block/production.rs | 89 |
1 files changed, 42 insertions, 47 deletions
diff --git a/src/block/production.rs b/src/block/production.rs index af4c547..8faf359 100644 --- a/src/block/production.rs +++ b/src/block/production.rs @@ -4,43 +4,43 @@ use crate::block::*; use crate::data::DataRead; make_register! { - "cultivator" => ProductionBlock::new(2, true, cost!(Copper: 25, Lead: 25, Silicon: 10)); - "graphite-press" => ProductionBlock::new(2, true, cost!(Copper: 75, Lead: 30)); - "multi-press" => ProductionBlock::new(3, true, cost!(Lead: 100, Graphite: 50, Titanium: 100, Silicon: 25)); - "silicon-smelter" => ProductionBlock::new(2, true, cost!(Copper: 30, Lead: 25)); - "silicon-crucible" => ProductionBlock::new(3, true, cost!(Metaglass: 80, Titanium: 120, Silicon: 60, Plastanium: 35)); - "kiln" => ProductionBlock::new(2, true, cost!(Copper: 60, Lead: 30, Graphite: 30)); - "plastanium-compressor" => ProductionBlock::new(2, true, cost!(Lead: 115, Graphite: 60, Titanium: 80, Silicon: 80)); - "phase-weaver" => ProductionBlock::new(2, true, cost!(Lead: 120, Thorium: 75, Silicon: 130)); - "surge-smelter" => ProductionBlock::new(3, true, cost!(Lead: 80, Thorium: 70, Silicon: 80)); - "cryofluid-mixer" => ProductionBlock::new(2, true, cost!(Lead: 65, Thorium: 60, Silicon: 40)); - "pyratite-mixer" => ProductionBlock::new(2, true, cost!(Copper: 50, Lead: 25)); - "blast-mixer" => ProductionBlock::new(2, true, cost!(Lead: 30, Thorium: 20)); - "melter" => ProductionBlock::new(1, true, cost!(Copper: 30, Lead: 35, Graphite: 45)); - "separator" => ProductionBlock::new(2, true, cost!(Copper: 30, Titanium: 25)); - "disassembler" => ProductionBlock::new(3, true, cost!(Titanium: 100, Thorium: 80, Silicon: 150, Plastanium: 40)); - "spore-press" => ProductionBlock::new(2, true, cost!(Lead: 35, Silicon: 30)); - "pulverizer" => ProductionBlock::new(1, true, cost!(Copper: 30, Lead: 25)); - "coal-centrifuge" => ProductionBlock::new(2, true, cost!(Lead: 30, Graphite: 40, Titanium: 20)); - "incinerator" => Incinerator::new(1, true, cost!(Lead: 15, Graphite: 5)); - "silicon-arc-furnace" => ProductionBlock::new(3, true, cost!(Beryllium: 70, Graphite: 80)); + "cultivator" -> ProductionBlock::new(2, true, cost!(Copper: 25, Lead: 25, Silicon: 10)); + "graphite-press" -> ProductionBlock::new(2, true, cost!(Copper: 75, Lead: 30)); + "multi-press" -> ProductionBlock::new(3, true, cost!(Lead: 100, Graphite: 50, Titanium: 100, Silicon: 25)); + "silicon-smelter" -> ProductionBlock::new(2, true, cost!(Copper: 30, Lead: 25)); + "silicon-crucible" -> ProductionBlock::new(3, true, cost!(Metaglass: 80, Titanium: 120, Silicon: 60, Plastanium: 35)); + "kiln" -> ProductionBlock::new(2, true, cost!(Copper: 60, Lead: 30, Graphite: 30)); + "plastanium-compressor" -> ProductionBlock::new(2, true, cost!(Lead: 115, Graphite: 60, Titanium: 80, Silicon: 80)); + "phase-weaver" -> ProductionBlock::new(2, true, cost!(Lead: 120, Thorium: 75, Silicon: 130)); + "surge-smelter" -> ProductionBlock::new(3, true, cost!(Lead: 80, Thorium: 70, Silicon: 80)); + "cryofluid-mixer" -> ProductionBlock::new(2, true, cost!(Lead: 65, Thorium: 60, Silicon: 40)); + "pyratite-mixer" -> ProductionBlock::new(2, true, cost!(Copper: 50, Lead: 25)); + "blast-mixer" -> ProductionBlock::new(2, true, cost!(Lead: 30, Thorium: 20)); + "melter" -> ProductionBlock::new(1, true, cost!(Copper: 30, Lead: 35, Graphite: 45)); + "separator" -> ProductionBlock::new(2, true, cost!(Copper: 30, Titanium: 25)); + "disassembler" -> ProductionBlock::new(3, true, cost!(Titanium: 100, Thorium: 80, Silicon: 150, Plastanium: 40)); + "spore-press" -> ProductionBlock::new(2, true, cost!(Lead: 35, Silicon: 30)); + "pulverizer" -> ProductionBlock::new(1, true, cost!(Copper: 30, Lead: 25)); + "coal-centrifuge" -> ProductionBlock::new(2, true, cost!(Lead: 30, Graphite: 40, Titanium: 20)); + "incinerator" -> Incinerator::new(1, true, cost!(Lead: 15, Graphite: 5)); + "silicon-arc-furnace" -> ProductionBlock::new(3, true, cost!(Beryllium: 70, Graphite: 80)); "electrolyzer" => ProductionBlock::new(3, true, cost!(Silicon: 50, Graphite: 40, Beryllium: 130, Tungsten: 80)); - "atmospheric-concentrator" => ProductionBlock::new(3, true, cost!(Oxide: 60, Beryllium: 180, Silicon: 150)); + "atmospheric-concentrator" -> ProductionBlock::new(3, true, cost!(Oxide: 60, Beryllium: 180, Silicon: 150)); "oxidation-chamber" => HeatCrafter::new(3, true, cost!(Tungsten: 120, Graphite: 80, Silicon: 100, Beryllium: 120)); "electric-heater" => HeatCrafter::new(2, false, cost!(Tungsten: 30, Oxide: 30)); "slag-heater" => HeatCrafter::new(3, false, cost!(Tungsten: 50, Oxide: 20, Beryllium: 20)); "phase-heater" => HeatCrafter::new(2, false, cost!(Oxide: 30, Carbide: 30, Beryllium: 30)); "heat-redirector" => HeatConduit::new(3, false, cost!(Tungsten: 10, Graphite: 10)); "heat-router" => HeatConduit::new(3, false, cost!(Tungsten: 15, Graphite: 10)); - "slag-incinerator" => Incinerator::new(1, true, cost!(Tungsten: 15)); - "carbide-crucible" => ProductionBlock::new(3, true, cost!(Tungsten: 110, Thorium: 150, Oxide: 60)); + "slag-incinerator" -> Incinerator::new(1, true, cost!(Tungsten: 15)); + "carbide-crucible" -> ProductionBlock::new(3, true, cost!(Tungsten: 110, Thorium: 150, Oxide: 60)); // slag centrifuge - "surge-crucible" => ProductionBlock::new(3, true, cost!(Silicon: 100, Graphite: 80, Tungsten: 80, Oxide: 80)); - "cyanogen-synthesizer" => ProductionBlock::new(3, true, cost!(Carbide: 50, Silicon: 80, Beryllium: 90)); - "phase-synthesizer" => ProductionBlock::new(3, true, cost!(Carbide: 90, Silicon: 100, Thorium: 100, Tungsten: 200)); + "surge-crucible" -> ProductionBlock::new(3, true, cost!(Silicon: 100, Graphite: 80, Tungsten: 80, Oxide: 80)); + "cyanogen-synthesizer" -> ProductionBlock::new(3, true, cost!(Carbide: 50, Silicon: 80, Beryllium: 90)); + "phase-synthesizer" -> ProductionBlock::new(3, true, cost!(Carbide: 90, Silicon: 100, Thorium: 100, Tungsten: 200)); // heat reactor // sandbox only - "heat-source" => HeatCrafter::new(1, false, &[]); + "heat-source" -> HeatCrafter::new(1, false, &[]); } make_simple!( @@ -60,30 +60,18 @@ make_simple!( match n { // TODO i didnt realize the significance of two tops before and kinda deleted them, add them back "phase-heater" | "electric-heater" | "oxidation-chamber" | "slag-heater" => { - let mut base = load(n, s); + let mut base = load!(from n which is ["phase-heater" | "electric-heater" | "oxidation-chamber" | "slag-heater"], s); base.overlay( - load( - match r { - Rotation::Up | Rotation::Right => match n { - "phase-heater" => "phase-heater-top1", - "oxidation-chamber" => "oxidation-chamber-top1", - "slag-heater" => "slag-heater-top1", - _ => "electric-heater-top1", - }, - _ => match n { - "phase-heater" => "phase-heater-top2", - "oxidation-chamber" => "oxidation-chamber-top2", - "slag-heater" => "slag-heater-top2", - _ => "electric-heater-top2", - }, - }, - s, - ) + match r { + Rotation::Up | Rotation::Right => + load!(concat top1 => n which is ["phase-heater" | "electric-heater" | "oxidation-chamber" | "slag-heater"], s), + _ => load!(concat top2 => n which is ["phase-heater" | "electric-heater" | "oxidation-chamber" | "slag-heater"], s) + } .rotate(r.rotated(false).count()), ); base } - _ => load(n, s), + n => unimplemented!("{n}"), } }, |_, _, _, buff: &mut DataRead| { @@ -95,5 +83,12 @@ make_simple!( Ok(()) } ); -make_simple!(HeatConduit); +make_simple!(HeatConduit, |_, n, _, _, r: Rotation, s| { + let mut base = load!(from n which is ["heat-router" | "heat-redirector"], s); + base.overlay(match r { + Rotation::Up | Rotation::Right => load!(concat top1 => n which is ["heat-router" | "heat-redirector"], s), + _ => load!(concat top2 => n which is ["heat-router" | "heat-redirector"], s), + }.rotate(r.rotated(false).count())); + base +}); make_simple!(Incinerator); |