add more items, add building type for recipe

master
agp8x 2022-03-25 09:12:40 +01:00
parent 282f18f9d4
commit 029c4e8c96
11 changed files with 294 additions and 110 deletions

8
local.properties Normal file
View File

@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu Oct 14 18:38:37 CEST 2021
sdk.dir=/home/agp8x/Android/Sdk

View File

@ -1,5 +1,6 @@
package satisfactory; package satisfactory;
import satisfactory.buildings.production.*;
import satisfactory.items.Item; import satisfactory.items.Item;
import satisfactory.items.Recipe; import satisfactory.items.Recipe;
import satisfactory.items.type.*; import satisfactory.items.type.*;
@ -12,27 +13,27 @@ public class Database {
// Items & recipes // Items & recipes
public static final Item IronOre = new Ore("Iron Ore"); public static final Item IronOre = new Ore("Iron Ore");
public static final Item IronIngot = new Ingot("Iron Ingot", new Recipe(2, IronOre, 1)); public static final Item IronIngot = new Ingot("Iron Ingot", new Recipe(2, IronOre, 1, Smelter.class));
public static final Item CopperOre = new Ore("Copper Ore"); public static final Item CopperOre = new Ore("Copper Ore");
public static final Item CopperIngot = new Ingot("Copper Ingot", new Recipe(2, CopperOre, 1)); public static final Item CopperIngot = new Ingot("Copper Ingot", new Recipe(2, CopperOre, 1, Smelter.class));
public static final Item Coal = new Ore("Coal"); public static final Item Coal = new Ore("Coal");
public static final Item SteelIngot = new Ingot("Steel Ingot"); public static final Item SteelIngot = new Ingot("Steel Ingot");
public static final Item CateriumOre = new Ore("Caterium Ore"); public static final Item CateriumOre = new Ore("Caterium Ore");
public static final Item CateriumIngot = new Ingot("Caterium Ingot", new Recipe(4, CateriumOre, 3)); public static final Item CateriumIngot = new Ingot("Caterium Ingot", new Recipe(4, CateriumOre, 3, Smelter.class));
public static final Item IronPlate = new Part("Iron Plate"); public static final Item IronPlate = new Part("Iron Plate");
public static final Item IronRod = new Part("Iron Rod", new Recipe(4, IronIngot, 1)); public static final Item IronRod = new Part("Iron Rod", new Recipe(4, IronIngot, 1, Constructor.class));
public static final Item Screw = new Part("Screw"); public static final Item Screw = new Part("Screw");
public static final Item ReinforcedIronPlate = new Part("Reinforced Iron Plate"); public static final Item ReinforcedIronPlate = new Part("Reinforced Iron Plate");
public static final Item ModularFrame = new Part("Modular Frame"); public static final Item ModularFrame = new Part("Modular Frame");
public static final Item SteelBeam = new Part("Steel Beam", new Recipe(4, SteelIngot, 4)); public static final Item SteelBeam = new Part("Steel Beam", new Recipe(4, SteelIngot, 4, Constructor.class));
public static final Item SteelPipe = new Part("Steel Pipe"); public static final Item SteelPipe = new Part("Steel Pipe");
public static final Item Limestone = new Ore("Limestone"); public static final Item Limestone = new Ore("Limestone");
public static final Item Concrete = new Part("Concrete", new Recipe(4, Limestone, 3)); public static final Item Concrete = new Part("Concrete", new Recipe(4, Limestone, 3, Constructor.class));
public static final Item EncasedIndustrialBeam = new Part("Encased Industrial Beam"); public static final Item EncasedIndustrialBeam = new Part("Encased Industrial Beam");
public static final Item HeavyModularFrame = new Part("Heavy Modular Frame"); public static final Item HeavyModularFrame = new Part("Heavy Modular Frame");
public static final Item CopperSheet = new Part("Copper Sheet", new Recipe(6, CopperIngot, 2)); public static final Item CopperSheet = new Part("Copper Sheet", new Recipe(6, CopperIngot, 2, Constructor.class));
public static final Item Wire = new Part("Wire"); public static final Item Wire = new Part("Wire");
public static final Item Cable = new Part("Cable", new Recipe(2, Wire, 2)); public static final Item Cable = new Part("Cable", new Recipe(2, Wire, 2, Constructor.class));
public static final Item Quickwire = new Part("Quickwire"); public static final Item Quickwire = new Part("Quickwire");
public static final Item CircuitBoard = new Part("Circuit Board"); public static final Item CircuitBoard = new Part("Circuit Board");
public static final Item AILimiter = new Part("A.I. Limiter"); public static final Item AILimiter = new Part("A.I. Limiter");
@ -54,7 +55,7 @@ public class Database {
public static final Item PowerShard = new Pickup("PowerShard"); public static final Item PowerShard = new Pickup("PowerShard");
public static final Item Sulfur = new Ore("Sulfur"); public static final Item Sulfur = new Ore("Sulfur");
public static final Item BlackPowder = new Part("Black powder"); public static final Item BlackPowder = new Part("Black powder");
public static final Item SpikedRebar = new Part("Spiked Rebar", new Recipe(4, IronRod, 1)); public static final Item SpikedRebar = new Part("Spiked Rebar", new Recipe(4, IronRod, 1, Constructor.class));
public static final Item FlowerPetals = new Pickup("Flower Petals"); public static final Item FlowerPetals = new Pickup("Flower Petals");
public static final Item ColorCatridge = new Part("Color Catridge"); public static final Item ColorCatridge = new Part("Color Catridge");
public static final Item Beacon = new Tool("Beacon"); public static final Item Beacon = new Tool("Beacon");
@ -91,49 +92,83 @@ public class Database {
public static final Item Bauxite = new Ore("Bauxite"); public static final Item Bauxite = new Ore("Bauxite");
public static final Item AluminaSolution = new ProcessedFluid("Alumina Solution"); public static final Item AluminaSolution = new ProcessedFluid("Alumina Solution");
public static final Item SulfuricAcid = new ProcessedFluid("Sulfuric Acid");
public static final Item EncasedUraniumCell = new Part("Encased Uranium Cell");
public static final Item ElectromagneticControlRod = new Part("Electromagnetic Control Rod");
public static final Item UraniumFuelRod = new Part("Uranium Fuel Rod");
public static final Item Uranium = new Ore("Uranium");
public static final Item Battery = new Part("Battery");
public static final Item MagneticFieldGenerator = new Part("Magnetic Field Generator");
public static final Item HeatSink = new Part("Heat Sink");
public static final Item AssemblyDirectorSystem = new Part("Assembly Director System");
public static final Item NitrogenGas = new Gas("Nitrogen Gas");
public static final Item CoolingSystem = new Part("Cooling System");
public static final Item FusedModularFrame = new Part("Fused Modular Frame");
static { static {
{ {
Set<Item> ores = new HashSet<>(Arrays.asList(IronOre, Coal, Limestone, CopperOre, CateriumOre, Sulfur)); // raw resources
// ores
Set<Item> ores = new HashSet<>(Arrays.asList(IronOre, Coal, Limestone, CopperOre, CateriumOre, Sulfur, Uranium));
ores.addAll(Arrays.asList(Bauxite, RawQuartz));// TODO: rly? ores.addAll(Arrays.asList(Bauxite, RawQuartz));// TODO: rly?
for (Item ore : ores) { for (Item ore : ores) {
Recipe mk1 = new Recipe(1, "Miner MK 1", false); Recipe mk1 = new Recipe(1, "Miner MK 1", false, Miner.class);
ore.add(mk1, 1); ore.add(mk1, 1);
Recipe mk2 = new Recipe(1, "Miner MK2", false); Recipe mk2 = new Recipe(1, "Miner MK2", false, Miner.class);
ore.add(mk2, 2); ore.add(mk2, 2);
ore.setPreference(mk2); ore.setPreference(mk2);
} }
// fluids
Set<Item> rawFluids = new HashSet<>(Arrays.asList(CrudeOil, Water)); Set<Item> rawFluids = new HashSet<>(Arrays.asList(CrudeOil, Water));
// no common well yet // no common well yet
CrudeOil.add(new Recipe(1, "Oil extracting thingy", false), 2); CrudeOil.add(new Recipe(1, "Oil extracting thingy", false, OilExtractor.class), 2);
//CrudeOil.setPreference(); //CrudeOil.setPreference();
Recipe water = new Recipe(1, "water pump thingy", false); Recipe water = new Recipe(1, "water pump thingy", false, WaterExtractor.class);
Water.add(water, 2); Water.add(water, 2);
Water.setPreference(water); Water.setPreference(water);
// gases
NitrogenGas.add(new Recipe(1,"pressure thingy", false, ResourceWellExtractor.class));
} }
{ {
// Steel Ingot // Steel Ingot
Recipe recipe = new Recipe(4); Recipe recipe = new Recipe(4, Foundry.class);
recipe.addInput(IronOre, 3); recipe.addInput(IronOre, 3);
recipe.addInput(Coal, 3); recipe.addInput(Coal, 3);
SteelIngot.add(recipe, 3); SteelIngot.add(recipe, 3);
} }
{ {
// Iron Plate // Iron Plate
Recipe recipe = new Recipe(6, IronIngot, 3); Recipe recipe = new Recipe(6, IronIngot, 3, Constructor.class);
IronPlate.add(recipe, 2); IronPlate.add(recipe, 2);
Recipe steelCoated = new Recipe(24, "Steel Coated Plate", false, Assembler.class);
steelCoated.addInput(SteelIngot, 3);
steelCoated.addInput(Plastic, 2);
IronPlate.add(steelCoated, 18);
} }
{ {
// Screw // Screw
Screw.add(new Recipe(6, IronRod, 1), 4); Screw.add(new Recipe(6, IronRod, 1, Constructor.class), 4);
} }
{ {
// Reinforced Iron Plate // Reinforced Iron Plate
Recipe recipe = new Recipe(12); Recipe recipe = new Recipe(12, Assembler.class);
recipe.addInput(IronPlate, 6); recipe.addInput(IronPlate, 6);
recipe.addInput(Screw, 12); recipe.addInput(Screw, 12);
ReinforcedIronPlate.add(recipe); ReinforcedIronPlate.add(recipe);
Recipe bolted = new Recipe(12, "Bolted Iron Plate", false); Recipe bolted = new Recipe(12, "Bolted Iron Plate", false, Assembler.class);
bolted.addInput(IronPlate, 18); bolted.addInput(IronPlate, 18);
bolted.addInput(Screw, 50); bolted.addInput(Screw, 50);
ReinforcedIronPlate.add(bolted, 3); ReinforcedIronPlate.add(bolted, 3);
@ -142,27 +177,27 @@ public class Database {
} }
{ {
// Modular Frame // Modular Frame
Recipe recipe = new Recipe(60); Recipe recipe = new Recipe(60, Assembler.class);
recipe.addInput(ReinforcedIronPlate, 3); recipe.addInput(ReinforcedIronPlate, 3);
recipe.addInput(IronRod, 12); recipe.addInput(IronRod, 12);
ModularFrame.add(recipe, 2); ModularFrame.add(recipe, 2);
} }
{ {
// Steel Pipe // Steel Pipe
Recipe recipe = new Recipe(6); Recipe recipe = new Recipe(6, Constructor.class);
recipe.addInput(SteelIngot, 3); recipe.addInput(SteelIngot, 3);
SteelPipe.add(recipe, 2); SteelPipe.add(recipe, 2);
} }
{ {
// Encased Industrial Beam // Encased Industrial Beam
Recipe recipe = new Recipe(10); Recipe recipe = new Recipe(10, Assembler.class);
recipe.addInput(SteelBeam, 4); recipe.addInput(SteelBeam, 4);
recipe.addInput(Concrete, 5); recipe.addInput(Concrete, 5);
EncasedIndustrialBeam.add(recipe); EncasedIndustrialBeam.add(recipe);
} }
{ {
// Heavy Modular Frame // Heavy Modular Frame
Recipe recipe = new Recipe(30); Recipe recipe = new Recipe(30, Manufacturer.class);
recipe.addInput(ModularFrame, 5); recipe.addInput(ModularFrame, 5);
recipe.addInput(SteelPipe, 15); recipe.addInput(SteelPipe, 15);
recipe.addInput(EncasedIndustrialBeam, 5); recipe.addInput(EncasedIndustrialBeam, 5);
@ -171,15 +206,15 @@ public class Database {
} }
{ {
// Wire // Wire
Wire.add(new Recipe(4, CopperIngot, 1), 2); Wire.add(new Recipe(4, CopperIngot, 1, Constructor.class), 2);
} }
{ {
// Quickwire // Quickwire
Quickwire.add(new Recipe(5, CateriumIngot, 1), 5); Quickwire.add(new Recipe(5, CateriumIngot, 1, Constructor.class), 5);
} }
{ {
// Circuit Board // Circuit Board
Recipe recipe = new Recipe(8); Recipe recipe = new Recipe(8, Assembler.class);
recipe.addInput(CopperSheet, 2); recipe.addInput(CopperSheet, 2);
recipe.addInput(Plastic, 4); recipe.addInput(Plastic, 4);
CircuitBoard.add(recipe); CircuitBoard.add(recipe);
@ -187,14 +222,14 @@ public class Database {
} }
{ {
// A.I. Limiter // A.I. Limiter
Recipe recipe = new Recipe(12); Recipe recipe = new Recipe(12, Assembler.class);
recipe.addInput(CopperSheet, 5); recipe.addInput(CopperSheet, 5);
recipe.addInput(Quickwire, 20); recipe.addInput(Quickwire, 20);
AILimiter.add(recipe); AILimiter.add(recipe);
} }
{ {
// High Speed Connector // High Speed Connector
Recipe recipe = new Recipe(16); Recipe recipe = new Recipe(16, Manufacturer.class);
recipe.addInput(Quickwire, 56); recipe.addInput(Quickwire, 56);
recipe.addInput(Cable, 10); recipe.addInput(Cable, 10);
recipe.addInput(CircuitBoard, 1); recipe.addInput(CircuitBoard, 1);
@ -202,64 +237,64 @@ public class Database {
} }
{ {
// Biomass // Biomass
Biomass.add(new Recipe(5, Leaves, 10), 5); Biomass.add(new Recipe(5, Leaves, 10, Constructor.class), 5);
Biomass.add(new Recipe(4, Wood, 4), 20); Biomass.add(new Recipe(4, Wood, 4, Constructor.class), 20);
Biomass.add(new Recipe(4, Mycelia, 10), 10); Biomass.add(new Recipe(4, Mycelia, 10, Constructor.class), 10);
Biomass.add(new Recipe(4, AlienCarapace, 1), 100); Biomass.add(new Recipe(4, AlienCarapace, 1, Constructor.class), 100);
Biomass.add(new Recipe(8, AlienOrgans, 1), 200); Biomass.add(new Recipe(8, AlienOrgans, 1, Constructor.class), 200);
} }
{ {
// Fabric // Fabric
Recipe recipe = new Recipe(4); Recipe recipe = new Recipe(4, Assembler.class);
recipe.addInput(Mycelia); recipe.addInput(Mycelia);
recipe.addInput(Biomass, 5); recipe.addInput(Biomass, 5);
Fabric.add(recipe); Fabric.add(recipe);
} }
{ {
// Solid Biofuel // Solid Biofuel
SolidBiofuel.add(new Recipe(4, Biomass, 8), 4); SolidBiofuel.add(new Recipe(4, Biomass, 8, Constructor.class), 4);
} }
{ {
// Rotator // Rotor
Recipe recipe = new Recipe(15); Recipe recipe = new Recipe(15, Assembler.class);
recipe.addInput(IronRod, 5); recipe.addInput(IronRod, 5);
recipe.addInput(Screw, 25); recipe.addInput(Screw, 25);
Rotor.add(recipe); Rotor.add(recipe);
} }
{ {
// Stator // Stator
Recipe recipe = new Recipe(12); Recipe recipe = new Recipe(12, Assembler.class);
recipe.addInput(SteelPipe, 3); recipe.addInput(SteelPipe, 3);
recipe.addInput(Wire, 8); recipe.addInput(Wire, 8);
Stator.add(recipe); Stator.add(recipe);
} }
{ {
// Motor // Motor
Recipe recipe = new Recipe(12); Recipe recipe = new Recipe(12, Assembler.class);
recipe.addInput(Rotor, 2); recipe.addInput(Rotor, 2);
recipe.addInput(Stator, 2); recipe.addInput(Stator, 2);
Motor.add(recipe); Motor.add(recipe);
} }
{ {
// Power Shard // Power Shard
PowerShard.add(new Recipe(8, GreenPowerSlug, 1)); PowerShard.add(new Recipe(8, GreenPowerSlug, 1, Constructor.class));
PowerShard.add(new Recipe(12, YellowPowerSlug, 1), 2); PowerShard.add(new Recipe(12, YellowPowerSlug, 1, Constructor.class), 2);
PowerShard.add(new Recipe(24, PurplePowerSlug, 1), 5); PowerShard.add(new Recipe(24, PurplePowerSlug, 1, Constructor.class), 5);
} }
{ {
// Black Powder // Black Powder
Recipe recipe = new Recipe(8); Recipe recipe = new Recipe(8, Assembler.class);
recipe.addInput(Coal); recipe.addInput(Coal);
recipe.addInput(Sulfur, 2); recipe.addInput(Sulfur, 2);
BlackPowder.add(recipe); BlackPowder.add(recipe);
} }
{ {
// Color Catridge // Color Catridge
ColorCatridge.add(new Recipe(8, FlowerPetals, 5), 10); ColorCatridge.add(new Recipe(8, FlowerPetals, 5, Constructor.class), 10);
} }
{ {
// Rifle Catridge // Rifle Catridge
Recipe recipe = new Recipe(20); Recipe recipe = new Recipe(20, Manufacturer.class);
recipe.addInput(Beacon, 1); recipe.addInput(Beacon, 1);
recipe.addInput(SteelPipe, 10); recipe.addInput(SteelPipe, 10);
recipe.addInput(BlackPowder, 10); recipe.addInput(BlackPowder, 10);
@ -268,7 +303,7 @@ public class Database {
} }
{ {
// Gas Filter // Gas Filter
Recipe recipe = new Recipe(8); Recipe recipe = new Recipe(8, Manufacturer.class);
recipe.addInput(Coal, 5); recipe.addInput(Coal, 5);
recipe.addInput(Rubber, 2); recipe.addInput(Rubber, 2);
recipe.addInput(Fabric, 2); recipe.addInput(Fabric, 2);
@ -276,13 +311,13 @@ public class Database {
} }
{ {
// Computer // Computer
Recipe recipe = new Recipe(24); Recipe recipe = new Recipe(24, Manufacturer.class);
recipe.addInput(CircuitBoard, 10); recipe.addInput(CircuitBoard, 10);
recipe.addInput(Cable, 9); recipe.addInput(Cable, 9);
recipe.addInput(Plastic, 18); recipe.addInput(Plastic, 18);
recipe.addInput(Screw, 52); recipe.addInput(Screw, 52);
Computer.add(recipe); Computer.add(recipe);
Recipe alternative = new Recipe(16, "Caterium Computer", false); Recipe alternative = new Recipe(16, "Caterium Computer", false, Manufacturer.class);
alternative.addInput(CircuitBoard, 7); alternative.addInput(CircuitBoard, 7);
alternative.addInput(Quickwire, 28); alternative.addInput(Quickwire, 28);
alternative.addInput(Rubber, 12); alternative.addInput(Rubber, 12);
@ -292,7 +327,7 @@ public class Database {
} }
{ {
// Super Computer // Super Computer
Recipe recipe = new Recipe(32); Recipe recipe = new Recipe(32, Manufacturer.class);
recipe.addInput(Computer, 2); recipe.addInput(Computer, 2);
recipe.addInput(AILimiter, 2); recipe.addInput(AILimiter, 2);
recipe.addInput(HighSpeedConnector, 3); recipe.addInput(HighSpeedConnector, 3);
@ -301,11 +336,11 @@ public class Database {
} }
{ {
// Empty Canister // Empty Canister
EmptyCanister.add(new Recipe(4, Plastic, 2), 4); EmptyCanister.add(new Recipe(4, Plastic, 2, Constructor.class), 4);
} }
{ {
// Beacon // Beacon
Recipe recipe = new Recipe(8); Recipe recipe = new Recipe(8, Manufacturer.class);
recipe.addInput(IronPlate, 3); recipe.addInput(IronPlate, 3);
recipe.addInput(IronRod); recipe.addInput(IronRod);
recipe.addInput(Wire, 15); recipe.addInput(Wire, 15);
@ -314,7 +349,7 @@ public class Database {
} }
{ {
// Modular Engine // Modular Engine
Recipe recipe = new Recipe(60, false); Recipe recipe = new Recipe(60, false, Manufacturer.class);
recipe.addInput(Motor, 2); recipe.addInput(Motor, 2);
recipe.addInput(Rubber, 15); recipe.addInput(Rubber, 15);
recipe.addInput(SmartPlating, 2); recipe.addInput(SmartPlating, 2);
@ -322,7 +357,7 @@ public class Database {
} }
{ {
// Adaptive Control Unit // Adaptive Control Unit
Recipe recipe = new Recipe(120, false); Recipe recipe = new Recipe(120, false, Manufacturer.class);
recipe.addInput(AutomatedWiring, 15); recipe.addInput(AutomatedWiring, 15);
recipe.addInput(CircuitBoard, 10); recipe.addInput(CircuitBoard, 10);
recipe.addInput(HeavyModularFrame, 2); recipe.addInput(HeavyModularFrame, 2);
@ -331,38 +366,38 @@ public class Database {
} }
{ {
// Nobelisk // Nobelisk
Recipe recipe = new Recipe(20, false); Recipe recipe = new Recipe(20, false, Assembler.class);
recipe.addInput(BlackPowder, 5); recipe.addInput(BlackPowder, 5);
recipe.addInput(SteelPipe, 10); recipe.addInput(SteelPipe, 10);
Nobelisk.add(recipe); Nobelisk.add(recipe);
} }
{ {
// Smart Plating // Smart Plating
Recipe recipe = new Recipe(30, false); Recipe recipe = new Recipe(30, false, Assembler.class);
recipe.addInput(ReinforcedIronPlate); recipe.addInput(ReinforcedIronPlate);
recipe.addInput(Rotor); recipe.addInput(Rotor);
SmartPlating.add(recipe); SmartPlating.add(recipe);
} }
{ {
// Automated Wiring // Automated Wiring
Recipe recipe = new Recipe(24, false); Recipe recipe = new Recipe(24, false, Assembler.class);
recipe.addInput(Stator); recipe.addInput(Stator);
recipe.addInput(Cable, 20); recipe.addInput(Cable, 20);
AutomatedWiring.add(recipe); AutomatedWiring.add(recipe);
} }
{ {
// Versatile Framework // Versatile Framework
Recipe recipe = new Recipe(24, false); Recipe recipe = new Recipe(24, false, Assembler.class);
recipe.addInput(ModularFrame); recipe.addInput(ModularFrame);
recipe.addInput(SteelBeam, 12); recipe.addInput(SteelBeam, 12);
VersatileFrameWork.add(recipe, 2); VersatileFrameWork.add(recipe, 2);
} }
{ {
// Fuel // Fuel
Recipe residualFuel = new Recipe(6, "Residual Fuel", false); Recipe residualFuel = new Recipe(6, "Residual Fuel", false, Refinery.class);
residualFuel.addInput(HeavyOilResidue, 6); residualFuel.addInput(HeavyOilResidue, 6);
Fuel.add(residualFuel, 4); Fuel.add(residualFuel, 4);
Recipe recipe = new Recipe(6, false); Recipe recipe = new Recipe(6, false, Refinery.class);
recipe.addInput(CrudeOil, 6); recipe.addInput(CrudeOil, 6);
recipe.addOutput(PolymerResin, 3); recipe.addOutput(PolymerResin, 3);
Fuel.add(recipe, 4); Fuel.add(recipe, 4);
@ -371,18 +406,18 @@ public class Database {
} }
{ {
// Liquid Biofuel // Liquid Biofuel
Recipe recipe = new Recipe(4, false); Recipe recipe = new Recipe(4, false, Refinery.class);
recipe.addInput(SolidBiofuel, 6); recipe.addInput(SolidBiofuel, 6);
recipe.addInput(Water, 3); recipe.addInput(Water, 3);
LiquidBiofuel.add(recipe, 4); LiquidBiofuel.add(recipe, 4);
} }
{ {
// Plastic // Plastic
Recipe recipe = new Recipe(6, false); Recipe recipe = new Recipe(6, false, Refinery.class);
recipe.addInput(CrudeOil, 3); recipe.addInput(CrudeOil, 3);
recipe.addOutput(HeavyOilResidue, 1); recipe.addOutput(HeavyOilResidue, 1);
Plastic.add(recipe, 2); Plastic.add(recipe, 2);
Recipe residualPlastic = new Recipe(6, "Residual Plastic", false); Recipe residualPlastic = new Recipe(6, "Residual Plastic", false, Refinery.class);
residualPlastic.addInput(PolymerResin, 6); residualPlastic.addInput(PolymerResin, 6);
residualPlastic.addInput(Water, 2); residualPlastic.addInput(Water, 2);
Plastic.add(residualPlastic, 2); Plastic.add(residualPlastic, 2);
@ -391,11 +426,11 @@ public class Database {
} }
{ {
// Rubber // Rubber
Recipe recipe = new Recipe(6, false); Recipe recipe = new Recipe(6, false, Refinery.class);
recipe.addInput(CrudeOil, 3); recipe.addInput(CrudeOil, 3);
recipe.addOutput(HeavyOilResidue, 2); recipe.addOutput(HeavyOilResidue, 2);
Rubber.add(recipe, 2); Rubber.add(recipe, 2);
Recipe residualRubber = new Recipe(6, "Residual Rubber", false); Recipe residualRubber = new Recipe(6, "Residual Rubber", false, Refinery.class);
residualRubber.addInput(PolymerResin, 6); residualRubber.addInput(PolymerResin, 6);
residualRubber.addInput(Water, 4); residualRubber.addInput(Water, 4);
Rubber.add(residualRubber, 2); Rubber.add(residualRubber, 2);
@ -404,56 +439,129 @@ public class Database {
} }
{ {
// Petroleum Coke // Petroleum Coke
Recipe recipe = new Recipe(6, false); Recipe recipe = new Recipe(6, false, Refinery.class);
recipe.addInput(HeavyOilResidue, 4); recipe.addInput(HeavyOilResidue, 4);
PetroleumCoke.add(recipe, 12); PetroleumCoke.add(recipe, 12);
} }
// TODO: verify below! // TODO: verify below!
{ {
Recipe recipe = new Recipe(6, AluminumIngot, 3); Recipe recipe = new Recipe(6, AluminumIngot, 3, Assembler.class);
recipe.addInput(CopperIngot, 1); recipe.addInput(CopperIngot, 1);
AlcladAluminumSheet.add(recipe, 3); AlcladAluminumSheet.add(recipe, 3);
} }
{ {
Recipe recipe = new Recipe(120, QuartzCristal, 36); Recipe recipe = new Recipe(120, QuartzCristal, 36, Manufacturer.class);
recipe.addInput(Cable, 28); recipe.addInput(Cable, 28);
recipe.addInput(ReinforcedIronPlate, 5); recipe.addInput(ReinforcedIronPlate, 5);
CrystalOscillator.add(recipe, 2); CrystalOscillator.add(recipe, 2);
} }
{ {
Recipe recipe = new Recipe(48, AluminumCasing, 32); Recipe recipe = new Recipe(48, AluminumCasing, 32, Manufacturer.class);
recipe.addInput(CrystalOscillator, 1); recipe.addInput(CrystalOscillator, 1);
recipe.addInput(Computer, 1); recipe.addInput(Computer, 1);
RadioControlUnit.add(recipe, 2); RadioControlUnit.add(recipe, 2);
} }
{ {
Recipe recipe = new Recipe(2, AluminumIngot, 3); Recipe recipe = new Recipe(2, AluminumIngot, 3, Constructor.class);
AluminumCasing.add(recipe, 2); AluminumCasing.add(recipe, 2);
} }
{ {
Recipe recipe = new Recipe(8, RawQuartz, 5); Recipe recipe = new Recipe(8, RawQuartz, 5, Constructor.class);
QuartzCristal.add(recipe, 3); QuartzCristal.add(recipe, 3);
} }
{ {
Recipe recipe = new Recipe(4, AluminumScrap, 6); Recipe recipe = new Recipe(8, RawQuartz, 3, Constructor.class);
Silica.add(recipe, 5);
}
{
Recipe recipe = new Recipe(4, AluminumScrap, 6, Foundry.class);
recipe.addInput(Silica, 5); recipe.addInput(Silica, 5);
recipe.addOutput(AluminumIngot, 4); recipe.addOutput(AluminumIngot, 4);
} }
{ {
Recipe recipe = new Recipe(6); Recipe recipe = new Recipe(6, Refinery.class);
recipe.addInput(Bauxite, 12); recipe.addInput(Bauxite, 12);
recipe.addInput(Water, 18); recipe.addInput(Water, 18);
recipe.addOutput(Silica, 5); recipe.addOutput(Silica, 5);
recipe.addOutput(AluminaSolution, 12); recipe.addOutput(AluminaSolution, 12);
} }
{ {
Recipe recipe = new Recipe(1); Recipe recipe = new Recipe(1, Refinery.class);
recipe.addInput(AluminaSolution, 4); recipe.addInput(AluminaSolution, 4);
recipe.addInput(Coal, 2); recipe.addInput(Coal, 2);
recipe.addOutput(AluminumScrap,6); recipe.addOutput(AluminumScrap, 6);
recipe.addOutput(Water,2); recipe.addOutput(Water, 2);
}
{
Recipe recipe = new Recipe(6, Refinery.class);
recipe.addInput(Sulfur,5);
recipe.addInput(Water,5);
recipe.addOutput(SulfuricAcid, 5);
}
{
Recipe recipe = new Recipe(150,Manufacturer.class);
recipe.addInput(EncasedUraniumCell, 50);
recipe.addInput(EncasedIndustrialBeam,3);
recipe.addInput(ElectromagneticControlRod, 5);
recipe.addOutput(UraniumFuelRod,1);
}
{
Recipe recipe = new Recipe(12, Blender.class);
recipe.addInput(Uranium, 10);
recipe.addInput(Concrete,3);
recipe.addInput(SulfuricAcid, 8);
recipe.addOutput(EncasedUraniumCell, 5);
recipe.addOutput(SulfuricAcid, 2);
}
{
Recipe recipe = new Recipe(120,Manufacturer.class);
recipe.addInput(VersatileFrameWork,5);
recipe.addInput(ElectromagneticControlRod, 5);
recipe.addInput(Battery, 10);
recipe.addOutput(MagneticFieldGenerator,2);
}
{
Recipe recipe = new Recipe(3, Blender.class);
recipe.addInput(SulfuricAcid,2.5);
recipe.addInput(AluminaSolution,2);
recipe.addInput(AluminumCasing,1);
recipe.addOutput(Battery, 1);
recipe.addOutput(Water, 1.5);
}
{
Recipe recipe = new Recipe(8, Assembler.class);
recipe.addInput(AlcladAluminumSheet,5);
recipe.addInput(CopperSheet,3);
recipe.addOutput(HeatSink, 1);
}
{
Recipe recipe = new Recipe(80, Assembler.class);
recipe.addInput(AdaptiveControlUnit,2);
recipe.addInput(SuperComputer,1);
recipe.addOutput(AssemblyDirectorSystem,1);
}
{
Recipe recipe = new Recipe(30,Assembler.class);
recipe.addInput(Stator,3);
recipe.addInput(AILimiter,2);
recipe.addOutput(ElectromagneticControlRod,2);
}
{
Recipe recipe = new Recipe(10, Blender.class);
recipe.addInput(HeatSink,2);
recipe.addInput(Rubber,2);
recipe.addInput(Water,5);
recipe.addInput(NitrogenGas,25);
recipe.addOutput(CoolingSystem,1);
}
{
Recipe recipe = new Recipe(40, Blender.class);
recipe.addInput(HeavyModularFrame,1);
recipe.addInput(AluminumCasing,50);
recipe.addInput(NitrogenGas,25);
recipe.addOutput(FusedModularFrame,1);
} }
} }

View File

@ -117,6 +117,19 @@ public class Test {
//plot(i, "rcu_hierarchy",1); //plot(i, "rcu_hierarchy",1);
SumResult s = SumResult.sum(new Production(Database.RadioControlUnit, 2)); SumResult s = SumResult.sum(new Production(Database.RadioControlUnit, 2));
plot2(s.getProduction(), "rcu"); plot2(s.getProduction(), "rcu");
SumResult alclad = SumResult.sum(new Production(Database.AlcladAluminumSheet,100));
plot2(alclad.getProduction(), "alclad");
javaPlot("alclad");
SumResult fuelrod = SumResult.sum(new Production(Database.UraniumFuelRod,100));
plot2(fuelrod.getProduction(), "fuelrod");
javaPlot("fuelrod");
SumResult fusedFrame = SumResult.sum(new Production(Database.FusedModularFrame,100));
plot2(fusedFrame.getProduction(), "fusedFrame");
javaPlot("fusedFrame");
} }
private static void plot(Item target, String name, int amount) { private static void plot(Item target, String name, int amount) {

View File

@ -100,7 +100,10 @@ public class Utils {
if (item.isRaw()) { if (item.isRaw()) {
m.put("peripheries", DefaultAttribute.createAttribute(2)); m.put("peripheries", DefaultAttribute.createAttribute(2));
} }
m.put("label", DefaultAttribute.createAttribute(item.getName())); String label = item.getName();
label = label.replace(".", "_");
label = label.replace("#", "_");
m.put("label", DefaultAttribute.createAttribute(label));
return m; return m;
}); });
de.exportGraph(sum, new File(PLOTS +filename + ".dot")); de.exportGraph(sum, new File(PLOTS +filename + ".dot"));

View File

@ -0,0 +1,6 @@
package satisfactory.buildings.production;
import satisfactory.buildings.Building;
public class Blender extends Building {
}

View File

@ -0,0 +1,6 @@
package satisfactory.buildings.production;
import satisfactory.buildings.Building;
public class ResourceWellExtractor extends Building {
}

View File

@ -35,6 +35,11 @@ public abstract class Item {
add(recipe, 1); add(recipe, 1);
} }
public void add(Recipe recipe, double output) {
recipes.add(recipe);
recipe.checkOutput(this, output);
}
public void add(Recipe recipe, int output) { public void add(Recipe recipe, int output) {
recipes.add(recipe); recipes.add(recipe);
recipe.checkOutput(this, output); recipe.checkOutput(this, output);
@ -99,7 +104,7 @@ public abstract class Item {
} }
public String ID() { public String ID() {
return getName().replace(" ", ""); return getName().replace(" ", "").replace(".", "_");
} }
public Recipe getPreference() { public Recipe getPreference() {

View File

@ -4,6 +4,8 @@ import org.jgrapht.Graph;
import org.jgrapht.Graphs; import org.jgrapht.Graphs;
import org.jgrapht.graph.DefaultDirectedWeightedGraph; import org.jgrapht.graph.DefaultDirectedWeightedGraph;
import org.jgrapht.graph.DefaultWeightedEdge; import org.jgrapht.graph.DefaultWeightedEdge;
import satisfactory.buildings.Building;
import satisfactory.buildings.production.Assembler;
import satisfactory.items.requirements.RateAccumulator; import satisfactory.items.requirements.RateAccumulator;
import satisfactory.items.requirements.TotalAccumulator; import satisfactory.items.requirements.TotalAccumulator;
@ -11,36 +13,36 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Recipe { public class Recipe {
private final Map<Item, Integer> inputs; private final Map<Item, Double> inputs;
private final Map<Item, Integer> outputs; private final Map<Item, Double> outputs;
private boolean isHandCraftable = true; private boolean isHandCraftable = true;
private String name; private String name;
private final int duration; private final int duration;
public Recipe(int duration) { public Recipe(int duration, Class<? extends Building> building) {
inputs = new HashMap<>(); inputs = new HashMap<>();
outputs = new HashMap<>(); outputs = new HashMap<>();
this.duration = duration; this.duration = duration;
} }
public Recipe(int duration, boolean isHandCraftable) { public Recipe(int duration, boolean isHandCraftable, Class<? extends Building> building) {
this(duration); this(duration, building);
this.isHandCraftable = isHandCraftable; this.isHandCraftable = isHandCraftable;
} }
public Recipe(int duration, Item item, int input) { public Recipe(int duration, Item item, int input, Class<? extends Building> building) {
this(duration); this(duration, building);
addInput(item, input); addInput(item, input);
} }
public Recipe(int duration, Map<Item, Integer> inputs, Map<Item, Integer> outputs) { public Recipe(int duration, Map<Item, Double> inputs, Map<Item, Double> outputs, Class<? extends Building> building) {
this.duration = duration; this.duration = duration;
this.inputs = inputs; this.inputs = inputs;
this.outputs = outputs; this.outputs = outputs;
} }
public Recipe(int duration, String name, boolean isHandCraftable) { public Recipe(int duration, String name, boolean isHandCraftable, Class<? extends Building> building) {
this(duration); this(duration, building);
this.name = name; this.name = name;
this.isHandCraftable = isHandCraftable; this.isHandCraftable = isHandCraftable;
} }
@ -54,6 +56,10 @@ public class Recipe {
} }
public void addInput(Item item, int amount) { public void addInput(Item item, int amount) {
inputs.put(item, (double) amount);
}
public void addInput(Item item, double amount) {
inputs.put(item, amount); inputs.put(item, amount);
} }
@ -73,41 +79,52 @@ public class Recipe {
} }
public void addOutput(Item item, int amount) { public void addOutput(Item item, int amount) {
this.outputs.put(item, (double) amount);
item.add(this, amount);
}
public void addOutput(Item item, double amount) {
this.outputs.put(item, amount); this.outputs.put(item, amount);
item.add(this, amount); item.add(this, amount);
} }
public void checkOutput(Item item, int amount) { public void checkOutput(Item item, int amount) {
if (!(outputs.containsKey(item) && outputs.get(item) == amount)) {
outputs.put(item, (double) amount);
}
}
public void checkOutput(Item item, double amount) {
if (!(outputs.containsKey(item) && outputs.get(item) == amount)) { if (!(outputs.containsKey(item) && outputs.get(item) == amount)) {
outputs.put(item, amount); outputs.put(item, amount);
} }
} }
private String formatIO(Map<Item, Integer> map) { private String formatIO(Map<Item, Double> map) {
StringBuilder sb = new StringBuilder("{"); StringBuilder sb = new StringBuilder("{");
map.forEach((item, integer) -> sb.append(item.getName()).append(": ").append(integer).append(", ")); map.forEach((item, integer) -> sb.append(item.getName()).append(": ").append(integer).append(", "));
return sb.append("}").toString(); return sb.append("}").toString();
} }
public Map<Item, Integer> getTotalRequirements() { public Map<Item, Double> getTotalRequirements() {
return new TotalAccumulator(inputs).accumulate(); return new TotalAccumulator(inputs).accumulate();
} }
public float getProductionRate(Item item) { public float getProductionRate(Item item) {
float production = outputs.get(item); double production = outputs.get(item);
return (float) (production / (duration / 60.0)); return (float) (production / (duration / 60.0));
} }
public Map<Item, Float> getRequirementRates(Item item) { public Map<Item, Double> getRequirementRates(Item item) {
float rate = getProductionRate(item); float rate = getProductionRate(item);
return new RateAccumulator(this, item).accumulate(); return new RateAccumulator(this, item).accumulate();
} }
public Map<Item, Integer> getInputs() { public Map<Item, Double> getInputs() {
return inputs; return inputs;
} }
public Map<Item,Integer> getByProducts(Item reference){ public Map<Item,Double> getByProducts(Item reference){
if (!outputs.containsKey(reference)){ if (!outputs.containsKey(reference)){
return null; return null;
} }
@ -122,7 +139,7 @@ public class Recipe {
Graph<Item, DefaultWeightedEdge> graph = new DefaultDirectedWeightedGraph<>(DefaultWeightedEdge.class); Graph<Item, DefaultWeightedEdge> graph = new DefaultDirectedWeightedGraph<>(DefaultWeightedEdge.class);
graph.addVertex(target); graph.addVertex(target);
target.sum += 1; target.sum += 1;
Map<Item, Integer> output = outputs.entrySet().stream() Map<Item, Double> output = outputs.entrySet().stream()
.filter(itemIntegerEntry -> itemIntegerEntry.getKey() != target) .filter(itemIntegerEntry -> itemIntegerEntry.getKey() != target)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
output.forEach((item, integer) -> { output.forEach((item, integer) -> {
@ -150,7 +167,7 @@ public class Recipe {
} }
private double getRequiredProcessRuns(Item product, Double productWantedPerMinute) { private double getRequiredProcessRuns(Item product, Double productWantedPerMinute) {
int productPerProcess = product.getRecipe().outputs.get(product); double productPerProcess = product.getRecipe().outputs.get(product);
return productWantedPerMinute / productPerProcess; return productWantedPerMinute / productPerProcess;
} }

View File

@ -6,29 +6,29 @@ import satisfactory.items.Recipe;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class RateAccumulator extends Accumulator<Float> { public class RateAccumulator extends Accumulator<Double> {
private Item item; private Item item;
public RateAccumulator(Recipe recipe, Item item) { public RateAccumulator(Recipe recipe, Item item) {
super(new HashMap<>()); super(new HashMap<>());
recipe.getInputs().forEach((item1, integer) -> inputs.put(item1, Float.valueOf(integer))); recipe.getInputs().forEach((item1, integer) -> inputs.put(item1, integer));
this.item = item; this.item = item;
} }
@Override @Override
protected Float calculate(Item i, Float subAmount, Float amount, Map<Item, Float> total) { protected Double calculate(Item i, Double subAmount, Double amount, Map<Item, Double> total) {
Float base = total.getOrDefault(i, 0f); Double base = total.getOrDefault(i, 0.0);
float additional = subAmount * amount * i.getProductionRate(); double additional = subAmount * amount * i.getProductionRate();
return base + additional; return base + additional;
} }
@Override @Override
protected Float dequeue(Item item, Float amount, Map<Item, Float> totals) { protected Double dequeue(Item item, Double amount, Map<Item, Double> totals) {
return totals.getOrDefault(item, 0f) + amount; return totals.getOrDefault(item, 0.0) + amount;
} }
@Override @Override
protected Map<Item, Float> getRequirements(Recipe r, Item i) { protected Map<Item, Double> getRequirements(Recipe r, Item i) {
return r.getRequirementRates(i); return r.getRequirementRates(i);
} }
} }

View File

@ -5,25 +5,25 @@ import satisfactory.items.Recipe;
import java.util.Map; import java.util.Map;
public class TotalAccumulator extends Accumulator<Integer>{ public class TotalAccumulator extends Accumulator<Double>{
public TotalAccumulator(Map<Item, Integer> inputs) { public TotalAccumulator(Map<Item, Double> inputs) {
super(inputs); super(inputs);
} }
@Override @Override
protected Integer calculate(Item i, Integer subAmount, Integer amount, Map<Item, Integer> total) { protected Double calculate(Item i, Double subAmount, Double amount, Map<Item, Double> total) {
return total.getOrDefault(i, 0) + subAmount * amount; return total.getOrDefault(i, 0.0) + subAmount * amount;
} }
@Override @Override
protected Integer dequeue(Item item, Integer amount, Map<Item, Integer> totals) { protected Double dequeue(Item item, Double amount, Map<Item, Double> totals) {
return totals.getOrDefault(item, 0) + amount; return totals.getOrDefault(item, 0.0) + amount;
} }
@Override @Override
protected Map<Item, Integer> getRequirements(Recipe r, Item i) { protected Map<Item, Double> getRequirements(Recipe r, Item i) {
return r.getTotalRequirements(); return r.getTotalRequirements();
} }
} }

View File

@ -0,0 +1,18 @@
package satisfactory.items.type;
import satisfactory.items.Item;
import satisfactory.items.Recipe;
public class Gas extends Item {
public Gas(String name, Recipe... recipes) {
super(name, recipes);
setIsRaw();
}
public Gas(String name) {
super(name);
setIsRaw();
}
}