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;
import satisfactory.buildings.production.*;
import satisfactory.items.Item;
import satisfactory.items.Recipe;
import satisfactory.items.type.*;
@ -12,27 +13,27 @@ public class Database {
// Items & recipes
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 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 SteelIngot = new Ingot("Steel Ingot");
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 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 ReinforcedIronPlate = new Part("Reinforced Iron Plate");
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 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 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 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 CircuitBoard = new Part("Circuit Board");
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 Sulfur = new Ore("Sulfur");
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 ColorCatridge = new Part("Color Catridge");
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 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 {
{
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?
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);
Recipe mk2 = new Recipe(1, "Miner MK2", false);
Recipe mk2 = new Recipe(1, "Miner MK2", false, Miner.class);
ore.add(mk2, 2);
ore.setPreference(mk2);
}
// fluids
Set<Item> rawFluids = new HashSet<>(Arrays.asList(CrudeOil, Water));
// 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();
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.setPreference(water);
// gases
NitrogenGas.add(new Recipe(1,"pressure thingy", false, ResourceWellExtractor.class));
}
{
// Steel Ingot
Recipe recipe = new Recipe(4);
Recipe recipe = new Recipe(4, Foundry.class);
recipe.addInput(IronOre, 3);
recipe.addInput(Coal, 3);
SteelIngot.add(recipe, 3);
}
{
// Iron Plate
Recipe recipe = new Recipe(6, IronIngot, 3);
Recipe recipe = new Recipe(6, IronIngot, 3, Constructor.class);
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.add(new Recipe(6, IronRod, 1), 4);
Screw.add(new Recipe(6, IronRod, 1, Constructor.class), 4);
}
{
// Reinforced Iron Plate
Recipe recipe = new Recipe(12);
Recipe recipe = new Recipe(12, Assembler.class);
recipe.addInput(IronPlate, 6);
recipe.addInput(Screw, 12);
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(Screw, 50);
ReinforcedIronPlate.add(bolted, 3);
@ -142,27 +177,27 @@ public class Database {
}
{
// Modular Frame
Recipe recipe = new Recipe(60);
Recipe recipe = new Recipe(60, Assembler.class);
recipe.addInput(ReinforcedIronPlate, 3);
recipe.addInput(IronRod, 12);
ModularFrame.add(recipe, 2);
}
{
// Steel Pipe
Recipe recipe = new Recipe(6);
Recipe recipe = new Recipe(6, Constructor.class);
recipe.addInput(SteelIngot, 3);
SteelPipe.add(recipe, 2);
}
{
// Encased Industrial Beam
Recipe recipe = new Recipe(10);
Recipe recipe = new Recipe(10, Assembler.class);
recipe.addInput(SteelBeam, 4);
recipe.addInput(Concrete, 5);
EncasedIndustrialBeam.add(recipe);
}
{
// Heavy Modular Frame
Recipe recipe = new Recipe(30);
Recipe recipe = new Recipe(30, Manufacturer.class);
recipe.addInput(ModularFrame, 5);
recipe.addInput(SteelPipe, 15);
recipe.addInput(EncasedIndustrialBeam, 5);
@ -171,15 +206,15 @@ public class Database {
}
{
// Wire
Wire.add(new Recipe(4, CopperIngot, 1), 2);
Wire.add(new Recipe(4, CopperIngot, 1, Constructor.class), 2);
}
{
// Quickwire
Quickwire.add(new Recipe(5, CateriumIngot, 1), 5);
Quickwire.add(new Recipe(5, CateriumIngot, 1, Constructor.class), 5);
}
{
// Circuit Board
Recipe recipe = new Recipe(8);
Recipe recipe = new Recipe(8, Assembler.class);
recipe.addInput(CopperSheet, 2);
recipe.addInput(Plastic, 4);
CircuitBoard.add(recipe);
@ -187,14 +222,14 @@ public class Database {
}
{
// A.I. Limiter
Recipe recipe = new Recipe(12);
Recipe recipe = new Recipe(12, Assembler.class);
recipe.addInput(CopperSheet, 5);
recipe.addInput(Quickwire, 20);
AILimiter.add(recipe);
}
{
// High Speed Connector
Recipe recipe = new Recipe(16);
Recipe recipe = new Recipe(16, Manufacturer.class);
recipe.addInput(Quickwire, 56);
recipe.addInput(Cable, 10);
recipe.addInput(CircuitBoard, 1);
@ -202,64 +237,64 @@ public class Database {
}
{
// Biomass
Biomass.add(new Recipe(5, Leaves, 10), 5);
Biomass.add(new Recipe(4, Wood, 4), 20);
Biomass.add(new Recipe(4, Mycelia, 10), 10);
Biomass.add(new Recipe(4, AlienCarapace, 1), 100);
Biomass.add(new Recipe(8, AlienOrgans, 1), 200);
Biomass.add(new Recipe(5, Leaves, 10, Constructor.class), 5);
Biomass.add(new Recipe(4, Wood, 4, Constructor.class), 20);
Biomass.add(new Recipe(4, Mycelia, 10, Constructor.class), 10);
Biomass.add(new Recipe(4, AlienCarapace, 1, Constructor.class), 100);
Biomass.add(new Recipe(8, AlienOrgans, 1, Constructor.class), 200);
}
{
// Fabric
Recipe recipe = new Recipe(4);
Recipe recipe = new Recipe(4, Assembler.class);
recipe.addInput(Mycelia);
recipe.addInput(Biomass, 5);
Fabric.add(recipe);
}
{
// Solid Biofuel
SolidBiofuel.add(new Recipe(4, Biomass, 8), 4);
SolidBiofuel.add(new Recipe(4, Biomass, 8, Constructor.class), 4);
}
{
// Rotator
Recipe recipe = new Recipe(15);
// Rotor
Recipe recipe = new Recipe(15, Assembler.class);
recipe.addInput(IronRod, 5);
recipe.addInput(Screw, 25);
Rotor.add(recipe);
}
{
// Stator
Recipe recipe = new Recipe(12);
Recipe recipe = new Recipe(12, Assembler.class);
recipe.addInput(SteelPipe, 3);
recipe.addInput(Wire, 8);
Stator.add(recipe);
}
{
// Motor
Recipe recipe = new Recipe(12);
Recipe recipe = new Recipe(12, Assembler.class);
recipe.addInput(Rotor, 2);
recipe.addInput(Stator, 2);
Motor.add(recipe);
}
{
// Power Shard
PowerShard.add(new Recipe(8, GreenPowerSlug, 1));
PowerShard.add(new Recipe(12, YellowPowerSlug, 1), 2);
PowerShard.add(new Recipe(24, PurplePowerSlug, 1), 5);
PowerShard.add(new Recipe(8, GreenPowerSlug, 1, Constructor.class));
PowerShard.add(new Recipe(12, YellowPowerSlug, 1, Constructor.class), 2);
PowerShard.add(new Recipe(24, PurplePowerSlug, 1, Constructor.class), 5);
}
{
// Black Powder
Recipe recipe = new Recipe(8);
Recipe recipe = new Recipe(8, Assembler.class);
recipe.addInput(Coal);
recipe.addInput(Sulfur, 2);
BlackPowder.add(recipe);
}
{
// Color Catridge
ColorCatridge.add(new Recipe(8, FlowerPetals, 5), 10);
ColorCatridge.add(new Recipe(8, FlowerPetals, 5, Constructor.class), 10);
}
{
// Rifle Catridge
Recipe recipe = new Recipe(20);
Recipe recipe = new Recipe(20, Manufacturer.class);
recipe.addInput(Beacon, 1);
recipe.addInput(SteelPipe, 10);
recipe.addInput(BlackPowder, 10);
@ -268,7 +303,7 @@ public class Database {
}
{
// Gas Filter
Recipe recipe = new Recipe(8);
Recipe recipe = new Recipe(8, Manufacturer.class);
recipe.addInput(Coal, 5);
recipe.addInput(Rubber, 2);
recipe.addInput(Fabric, 2);
@ -276,13 +311,13 @@ public class Database {
}
{
// Computer
Recipe recipe = new Recipe(24);
Recipe recipe = new Recipe(24, Manufacturer.class);
recipe.addInput(CircuitBoard, 10);
recipe.addInput(Cable, 9);
recipe.addInput(Plastic, 18);
recipe.addInput(Screw, 52);
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(Quickwire, 28);
alternative.addInput(Rubber, 12);
@ -292,7 +327,7 @@ public class Database {
}
{
// Super Computer
Recipe recipe = new Recipe(32);
Recipe recipe = new Recipe(32, Manufacturer.class);
recipe.addInput(Computer, 2);
recipe.addInput(AILimiter, 2);
recipe.addInput(HighSpeedConnector, 3);
@ -301,11 +336,11 @@ public class Database {
}
{
// Empty Canister
EmptyCanister.add(new Recipe(4, Plastic, 2), 4);
EmptyCanister.add(new Recipe(4, Plastic, 2, Constructor.class), 4);
}
{
// Beacon
Recipe recipe = new Recipe(8);
Recipe recipe = new Recipe(8, Manufacturer.class);
recipe.addInput(IronPlate, 3);
recipe.addInput(IronRod);
recipe.addInput(Wire, 15);
@ -314,7 +349,7 @@ public class Database {
}
{
// Modular Engine
Recipe recipe = new Recipe(60, false);
Recipe recipe = new Recipe(60, false, Manufacturer.class);
recipe.addInput(Motor, 2);
recipe.addInput(Rubber, 15);
recipe.addInput(SmartPlating, 2);
@ -322,7 +357,7 @@ public class Database {
}
{
// Adaptive Control Unit
Recipe recipe = new Recipe(120, false);
Recipe recipe = new Recipe(120, false, Manufacturer.class);
recipe.addInput(AutomatedWiring, 15);
recipe.addInput(CircuitBoard, 10);
recipe.addInput(HeavyModularFrame, 2);
@ -331,38 +366,38 @@ public class Database {
}
{
// Nobelisk
Recipe recipe = new Recipe(20, false);
Recipe recipe = new Recipe(20, false, Assembler.class);
recipe.addInput(BlackPowder, 5);
recipe.addInput(SteelPipe, 10);
Nobelisk.add(recipe);
}
{
// Smart Plating
Recipe recipe = new Recipe(30, false);
Recipe recipe = new Recipe(30, false, Assembler.class);
recipe.addInput(ReinforcedIronPlate);
recipe.addInput(Rotor);
SmartPlating.add(recipe);
}
{
// Automated Wiring
Recipe recipe = new Recipe(24, false);
Recipe recipe = new Recipe(24, false, Assembler.class);
recipe.addInput(Stator);
recipe.addInput(Cable, 20);
AutomatedWiring.add(recipe);
}
{
// Versatile Framework
Recipe recipe = new Recipe(24, false);
Recipe recipe = new Recipe(24, false, Assembler.class);
recipe.addInput(ModularFrame);
recipe.addInput(SteelBeam, 12);
VersatileFrameWork.add(recipe, 2);
}
{
// Fuel
Recipe residualFuel = new Recipe(6, "Residual Fuel", false);
Recipe residualFuel = new Recipe(6, "Residual Fuel", false, Refinery.class);
residualFuel.addInput(HeavyOilResidue, 6);
Fuel.add(residualFuel, 4);
Recipe recipe = new Recipe(6, false);
Recipe recipe = new Recipe(6, false, Refinery.class);
recipe.addInput(CrudeOil, 6);
recipe.addOutput(PolymerResin, 3);
Fuel.add(recipe, 4);
@ -371,18 +406,18 @@ public class Database {
}
{
// Liquid Biofuel
Recipe recipe = new Recipe(4, false);
Recipe recipe = new Recipe(4, false, Refinery.class);
recipe.addInput(SolidBiofuel, 6);
recipe.addInput(Water, 3);
LiquidBiofuel.add(recipe, 4);
}
{
// Plastic
Recipe recipe = new Recipe(6, false);
Recipe recipe = new Recipe(6, false, Refinery.class);
recipe.addInput(CrudeOil, 3);
recipe.addOutput(HeavyOilResidue, 1);
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(Water, 2);
Plastic.add(residualPlastic, 2);
@ -391,11 +426,11 @@ public class Database {
}
{
// Rubber
Recipe recipe = new Recipe(6, false);
Recipe recipe = new Recipe(6, false, Refinery.class);
recipe.addInput(CrudeOil, 3);
recipe.addOutput(HeavyOilResidue, 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(Water, 4);
Rubber.add(residualRubber, 2);
@ -404,56 +439,129 @@ public class Database {
}
{
// Petroleum Coke
Recipe recipe = new Recipe(6, false);
Recipe recipe = new Recipe(6, false, Refinery.class);
recipe.addInput(HeavyOilResidue, 4);
PetroleumCoke.add(recipe, 12);
}
// TODO: verify below!
{
Recipe recipe = new Recipe(6, AluminumIngot, 3);
Recipe recipe = new Recipe(6, AluminumIngot, 3, Assembler.class);
recipe.addInput(CopperIngot, 1);
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(ReinforcedIronPlate, 5);
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(Computer, 1);
RadioControlUnit.add(recipe, 2);
}
{
Recipe recipe = new Recipe(2, AluminumIngot, 3);
Recipe recipe = new Recipe(2, AluminumIngot, 3, Constructor.class);
AluminumCasing.add(recipe, 2);
}
{
Recipe recipe = new Recipe(8, RawQuartz, 5);
Recipe recipe = new Recipe(8, RawQuartz, 5, Constructor.class);
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.addOutput(AluminumIngot, 4);
}
{
Recipe recipe = new Recipe(6);
Recipe recipe = new Recipe(6, Refinery.class);
recipe.addInput(Bauxite, 12);
recipe.addInput(Water, 18);
recipe.addOutput(Silica, 5);
recipe.addOutput(AluminaSolution, 12);
}
{
Recipe recipe = new Recipe(1);
Recipe recipe = new Recipe(1, Refinery.class);
recipe.addInput(AluminaSolution, 4);
recipe.addInput(Coal, 2);
recipe.addOutput(AluminumScrap,6);
recipe.addOutput(Water,2);
recipe.addOutput(AluminumScrap, 6);
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);
SumResult s = SumResult.sum(new Production(Database.RadioControlUnit, 2));
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) {

View File

@ -100,7 +100,10 @@ public class Utils {
if (item.isRaw()) {
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;
});
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);
}
public void add(Recipe recipe, double output) {
recipes.add(recipe);
recipe.checkOutput(this, output);
}
public void add(Recipe recipe, int output) {
recipes.add(recipe);
recipe.checkOutput(this, output);
@ -99,7 +104,7 @@ public abstract class Item {
}
public String ID() {
return getName().replace(" ", "");
return getName().replace(" ", "").replace(".", "_");
}
public Recipe getPreference() {

View File

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

View File

@ -6,29 +6,29 @@ import satisfactory.items.Recipe;
import java.util.HashMap;
import java.util.Map;
public class RateAccumulator extends Accumulator<Float> {
public class RateAccumulator extends Accumulator<Double> {
private Item item;
public RateAccumulator(Recipe recipe, Item item) {
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;
}
@Override
protected Float calculate(Item i, Float subAmount, Float amount, Map<Item, Float> total) {
Float base = total.getOrDefault(i, 0f);
float additional = subAmount * amount * i.getProductionRate();
protected Double calculate(Item i, Double subAmount, Double amount, Map<Item, Double> total) {
Double base = total.getOrDefault(i, 0.0);
double additional = subAmount * amount * i.getProductionRate();
return base + additional;
}
@Override
protected Float dequeue(Item item, Float amount, Map<Item, Float> totals) {
return totals.getOrDefault(item, 0f) + amount;
protected Double dequeue(Item item, Double amount, Map<Item, Double> totals) {
return totals.getOrDefault(item, 0.0) + amount;
}
@Override
protected Map<Item, Float> getRequirements(Recipe r, Item i) {
protected Map<Item, Double> getRequirements(Recipe r, Item i) {
return r.getRequirementRates(i);
}
}

View File

@ -5,25 +5,25 @@ import satisfactory.items.Recipe;
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);
}
@Override
protected Integer calculate(Item i, Integer subAmount, Integer amount, Map<Item, Integer> total) {
return total.getOrDefault(i, 0) + subAmount * amount;
protected Double calculate(Item i, Double subAmount, Double amount, Map<Item, Double> total) {
return total.getOrDefault(i, 0.0) + subAmount * amount;
}
@Override
protected Integer dequeue(Item item, Integer amount, Map<Item, Integer> totals) {
return totals.getOrDefault(item, 0) + amount;
protected Double dequeue(Item item, Double amount, Map<Item, Double> totals) {
return totals.getOrDefault(item, 0.0) + amount;
}
@Override
protected Map<Item, Integer> getRequirements(Recipe r, Item i) {
protected Map<Item, Double> getRequirements(Recipe r, Item i) {
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();
}
}