Unit requirements for payloads
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 711 B |
BIN
core/assets-raw/sprites/units/weapons/stell-weapon.png
Normal file
BIN
core/assets-raw/sprites/units/weapons/stell-weapon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 707 B |
@@ -140,7 +140,6 @@ public class Blocks{
|
|||||||
tankAssembler, shipAssembler, mechAssembler,
|
tankAssembler, shipAssembler, mechAssembler,
|
||||||
//TODO maybe making it 5x5 would be more appropriate, seems kinda cheap.
|
//TODO maybe making it 5x5 would be more appropriate, seems kinda cheap.
|
||||||
basicAssemblerModule,
|
basicAssemblerModule,
|
||||||
primeControlCore,
|
|
||||||
|
|
||||||
//TODO remove
|
//TODO remove
|
||||||
droneCenter,
|
droneCenter,
|
||||||
@@ -3592,13 +3591,6 @@ public class Blocks{
|
|||||||
//endregion
|
//endregion
|
||||||
//region units - erekir
|
//region units - erekir
|
||||||
|
|
||||||
primeControlCore = new ControlCore("prime-control-core"){{
|
|
||||||
requirements(Category.units, with(Items.silicon, 120, Items.oxide, 30));
|
|
||||||
size = 2;
|
|
||||||
placeablePlayer = false;
|
|
||||||
researchCostMultiplier = 0f;
|
|
||||||
}};
|
|
||||||
|
|
||||||
fabricator = new UnitFactory("fabricator"){{
|
fabricator = new UnitFactory("fabricator"){{
|
||||||
requirements(Category.units, with(Items.silicon, 200, Items.beryllium, 250));
|
requirements(Category.units, with(Items.silicon, 200, Items.beryllium, 250));
|
||||||
size = 3;
|
size = 3;
|
||||||
@@ -3611,7 +3603,7 @@ public class Blocks{
|
|||||||
requirements(Category.units, with(Items.graphite, 600, Items.beryllium, 600, Items.oxide, 250, Items.tungsten, 400, Items.silicon, 500));
|
requirements(Category.units, with(Items.graphite, 600, Items.beryllium, 600, Items.oxide, 250, Items.tungsten, 400, Items.silicon, 500));
|
||||||
size = 5;
|
size = 5;
|
||||||
//TODO remove ducts and crushers, replace with 2-3 high cost special blocks with silicon requirements
|
//TODO remove ducts and crushers, replace with 2-3 high cost special blocks with silicon requirements
|
||||||
plans.add(new AssemblerUnitPlan(UnitTypes.vanquish, 60f * 50f, BlockStack.list(Blocks.tungstenWallLarge, 10, Blocks.primeControlCore, 2)));
|
plans.add(new AssemblerUnitPlan(UnitTypes.vanquish, 60f * 50f, PayloadStack.list(UnitTypes.stell, 4, Blocks.tungstenWallLarge, 12)));
|
||||||
consumePower(3f);
|
consumePower(3f);
|
||||||
areaSize = 13;
|
areaSize = 13;
|
||||||
researchCostMultiplier = 0.4f;
|
researchCostMultiplier = 0.4f;
|
||||||
@@ -3623,7 +3615,8 @@ public class Blocks{
|
|||||||
shipAssembler = new UnitAssembler("ship-assembler"){{
|
shipAssembler = new UnitAssembler("ship-assembler"){{
|
||||||
requirements(Category.units, with(Items.beryllium, 700, Items.oxide, 300, Items.tungsten, 500, Items.silicon, 800));
|
requirements(Category.units, with(Items.beryllium, 700, Items.oxide, 300, Items.tungsten, 500, Items.silicon, 800));
|
||||||
size = 5;
|
size = 5;
|
||||||
plans.add(new AssemblerUnitPlan(UnitTypes.quell, 60f * 60f, BlockStack.list(Blocks.berylliumWallLarge, 20, Blocks.primeControlCore, 2)));
|
//TODO not stell
|
||||||
|
plans.add(new AssemblerUnitPlan(UnitTypes.quell, 60f * 60f, PayloadStack.list(Blocks.berylliumWallLarge, 20, UnitTypes.stell, 2)));
|
||||||
consumePower(3f);
|
consumePower(3f);
|
||||||
areaSize = 13;
|
areaSize = 13;
|
||||||
researchCostMultiplier = 0.4f;
|
researchCostMultiplier = 0.4f;
|
||||||
@@ -3636,7 +3629,8 @@ public class Blocks{
|
|||||||
requirements(Category.units, with(Items.graphite, 500, Items.thorium, 600, Items.oxide, 200, Items.tungsten, 500, Items.silicon, 900));
|
requirements(Category.units, with(Items.graphite, 500, Items.thorium, 600, Items.oxide, 200, Items.tungsten, 500, Items.silicon, 900));
|
||||||
size = 5;
|
size = 5;
|
||||||
//TODO different reqs
|
//TODO different reqs
|
||||||
plans.add(new AssemblerUnitPlan(UnitTypes.bulwark, 60f * 60f, BlockStack.list(Blocks.tungstenWallLarge, 12, Blocks.primeControlCore, 2)));
|
//TODO not stell
|
||||||
|
plans.add(new AssemblerUnitPlan(UnitTypes.bulwark, 60f * 60f, PayloadStack.list(Blocks.tungstenWallLarge, 12, UnitTypes.stell, 2)));
|
||||||
consumePower(3f);
|
consumePower(3f);
|
||||||
areaSize = 13;
|
areaSize = 13;
|
||||||
researchCostMultiplier = 0.4f;
|
researchCostMultiplier = 0.4f;
|
||||||
@@ -3739,7 +3733,7 @@ public class Blocks{
|
|||||||
consumePower(2f);
|
consumePower(2f);
|
||||||
size = 3;
|
size = 3;
|
||||||
//TODO expand this list
|
//TODO expand this list
|
||||||
filter = Seq.with(Blocks.primeControlCore, Blocks.tungstenWallLarge, Blocks.berylliumWallLarge, Blocks.reinforcedLiquidContainer, Blocks.beamNode);
|
filter = Seq.with(Blocks.tungstenWallLarge, Blocks.berylliumWallLarge, Blocks.reinforcedLiquidContainer, Blocks.beamNode);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//yes this block is pretty much useless
|
//yes this block is pretty much useless
|
||||||
|
|||||||
@@ -220,11 +220,6 @@ public class ErekirTechTree{
|
|||||||
});
|
});
|
||||||
|
|
||||||
node(tankAssembler, Seq.with(new OnSector(four), new Research(constructor), new Research(atmosphericConcentrator)), () -> {
|
node(tankAssembler, Seq.with(new OnSector(four), new Research(constructor), new Research(atmosphericConcentrator)), () -> {
|
||||||
//auto-unlock?
|
|
||||||
node(primeControlCore, () -> {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
node(UnitTypes.vanquish, () -> {
|
node(UnitTypes.vanquish, () -> {
|
||||||
node(UnitTypes.conquer, Seq.with(tmpNever), () -> {
|
node(UnitTypes.conquer, Seq.with(tmpNever), () -> {
|
||||||
|
|
||||||
|
|||||||
@@ -253,9 +253,14 @@ public class Fx{
|
|||||||
float x = Tmp.v1.x, y = Tmp.v1.y;
|
float x = Tmp.v1.x, y = Tmp.v1.y;
|
||||||
|
|
||||||
scl(e.fout(Interp.pow3Out) * 1.05f);
|
scl(e.fout(Interp.pow3Out) * 1.05f);
|
||||||
Drawf.squareShadow(x, y, data.block.size * tilesize * 1.85f, 1f);
|
if(data.item instanceof Block block){
|
||||||
|
Drawf.squareShadow(x, y, block.size * tilesize * 1.85f, 1f);
|
||||||
|
}else if(data.item instanceof UnitType unit){
|
||||||
|
unit.drawSoftShadow(e.x, e.y, e.rotation, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
mixcol(Pal.accent, e.fin());
|
mixcol(Pal.accent, e.fin());
|
||||||
rect(data.block.fullIcon, x, y);
|
rect(data.item.fullIcon, x, y, data.item instanceof Block ? 0f : e.rotation - 90f);
|
||||||
}).layer(Layer.flyingUnitLow - 5f),
|
}).layer(Layer.flyingUnitLow - 5f),
|
||||||
|
|
||||||
select = new Effect(23, e -> {
|
select = new Effect(23, e -> {
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ public class SuppressionFieldAbility extends Ability{
|
|||||||
Draw.color(color);
|
Draw.color(color);
|
||||||
Fill.circle(rx, ry, rad * orbMidScl);
|
Fill.circle(rx, ry, rad * orbMidScl);
|
||||||
|
|
||||||
|
if(active){
|
||||||
|
//TODO draw range when selected?
|
||||||
|
}
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -828,7 +828,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable BlockSeq getBlockPayloads(){
|
public @Nullable
|
||||||
|
PayloadSeq getBlockPayloads(){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mindustry.mod;
|
package mindustry.mod;
|
||||||
|
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
|
import mindustry.type.*;
|
||||||
import mindustry.world.blocks.legacy.*;
|
import mindustry.world.blocks.legacy.*;
|
||||||
import mindustry.world.consumers.*;
|
import mindustry.world.consumers.*;
|
||||||
|
|
||||||
@@ -75,8 +76,8 @@ public class ClassMap{
|
|||||||
classes.put("Research", mindustry.game.Objectives.Research.class);
|
classes.put("Research", mindustry.game.Objectives.Research.class);
|
||||||
classes.put("SectorComplete", mindustry.game.Objectives.SectorComplete.class);
|
classes.put("SectorComplete", mindustry.game.Objectives.SectorComplete.class);
|
||||||
classes.put("AmmoType", mindustry.type.AmmoType.class);
|
classes.put("AmmoType", mindustry.type.AmmoType.class);
|
||||||
classes.put("BlockSeq", mindustry.type.BlockSeq.class);
|
classes.put("BlockSeq", PayloadSeq.class);
|
||||||
classes.put("BlockStack", mindustry.type.BlockStack.class);
|
classes.put("BlockStack", PayloadStack.class);
|
||||||
classes.put("Category", mindustry.type.Category.class);
|
classes.put("Category", mindustry.type.Category.class);
|
||||||
classes.put("CellLiquid", mindustry.type.CellLiquid.class);
|
classes.put("CellLiquid", mindustry.type.CellLiquid.class);
|
||||||
classes.put("ErrorContent", mindustry.type.ErrorContent.class);
|
classes.put("ErrorContent", mindustry.type.ErrorContent.class);
|
||||||
|
|||||||
@@ -458,6 +458,11 @@ public class ContentParser{
|
|||||||
value.remove("controller");
|
value.remove("controller");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(value.has("unitBasedController")){
|
||||||
|
unit.unitBasedDefaultController = u -> supply(resolve(value.getString("unitBasedController"), FlyingAI.class)).get();
|
||||||
|
value.remove("unitBasedController");
|
||||||
|
}
|
||||||
|
|
||||||
//read extra default waves
|
//read extra default waves
|
||||||
if(value.has("waves")){
|
if(value.has("waves")){
|
||||||
JsonValue waves = value.remove("waves");
|
JsonValue waves = value.remove("waves");
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
package mindustry.type;
|
|
||||||
|
|
||||||
import arc.struct.*;
|
|
||||||
import mindustry.content.*;
|
|
||||||
import mindustry.world.*;
|
|
||||||
|
|
||||||
public class BlockStack implements Comparable<BlockStack>{
|
|
||||||
public Block block = Blocks.router;
|
|
||||||
public int amount = 1;
|
|
||||||
|
|
||||||
public BlockStack(Block block, int amount){
|
|
||||||
this.block = block;
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockStack(Block block){
|
|
||||||
this.block = block;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockStack(){
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockStack[] with(Object... items){
|
|
||||||
var stacks = new BlockStack[items.length / 2];
|
|
||||||
for(int i = 0; i < items.length; i += 2){
|
|
||||||
stacks[i / 2] = new BlockStack((Block)items[i], ((Number)items[i + 1]).intValue());
|
|
||||||
}
|
|
||||||
return stacks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Seq<BlockStack> list(Object... items){
|
|
||||||
Seq<BlockStack> stacks = new Seq<>(items.length / 2);
|
|
||||||
for(int i = 0; i < items.length; i += 2){
|
|
||||||
stacks.add(new BlockStack((Block)items[i], ((Number)items[i + 1]).intValue()));
|
|
||||||
}
|
|
||||||
return stacks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(BlockStack stack){
|
|
||||||
return block.compareTo(stack.block);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o){
|
|
||||||
return this == o || (o instanceof BlockStack stack && stack.amount == amount && block == stack.block);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString(){
|
|
||||||
return "BlockStack{" +
|
|
||||||
"block=" + block +
|
|
||||||
", amount=" + amount +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,10 +3,10 @@ package mindustry.type;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.world.*;
|
import mindustry.ctype.*;
|
||||||
|
|
||||||
public class BlockSeq{
|
public class PayloadSeq{
|
||||||
private ObjectIntMap<Block> blocks = new ObjectIntMap<>();
|
private ObjectIntMap<UnlockableContent> blocks = new ObjectIntMap<>();
|
||||||
private int total;
|
private int total;
|
||||||
|
|
||||||
public boolean isEmpty(){
|
public boolean isEmpty(){
|
||||||
@@ -21,25 +21,25 @@ public class BlockSeq{
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Block block){
|
public void add(UnlockableContent block){
|
||||||
add(block, 1);
|
add(block, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Block block, int amount){
|
public void add(UnlockableContent block, int amount){
|
||||||
blocks.increment(block, amount);
|
blocks.increment(block, amount);
|
||||||
total += amount;
|
total += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Block block){
|
public void remove(UnlockableContent block){
|
||||||
add(block, -1);
|
add(block, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Block block, int amount){
|
public void remove(UnlockableContent block, int amount){
|
||||||
add(block, -amount);
|
add(block, -amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Seq<BlockStack> stacks){
|
public void remove(Seq<PayloadStack> stacks){
|
||||||
stacks.each(b -> remove(b.block, b.amount));
|
stacks.each(b -> remove(b.item, b.amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear(){
|
public void clear(){
|
||||||
@@ -47,24 +47,24 @@ public class BlockSeq{
|
|||||||
total = 0;
|
total = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int get(Block block){
|
public int get(UnlockableContent block){
|
||||||
return blocks.get(block);
|
return blocks.get(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(Seq<BlockStack> stacks){
|
public boolean contains(Seq<PayloadStack> stacks){
|
||||||
return !stacks.contains(b -> get(b.block) < b.amount);
|
return !stacks.contains(b -> get(b.item) < b.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(Block block, int amount){
|
public boolean contains(UnlockableContent block, int amount){
|
||||||
return get(block) >= amount;
|
return get(block) >= amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(Block block){
|
public boolean contains(UnlockableContent block){
|
||||||
return get(block) >= 1;
|
return get(block) >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(BlockStack stack){
|
public boolean contains(PayloadStack stack){
|
||||||
return get(stack.block) >= stack.amount;
|
return get(stack.item) >= stack.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(Writes write){
|
public void write(Writes write){
|
||||||
56
core/src/mindustry/type/PayloadStack.java
Normal file
56
core/src/mindustry/type/PayloadStack.java
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package mindustry.type;
|
||||||
|
|
||||||
|
import arc.struct.*;
|
||||||
|
import mindustry.content.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
|
|
||||||
|
public class PayloadStack implements Comparable<PayloadStack>{
|
||||||
|
public UnlockableContent item = Blocks.router;
|
||||||
|
public int amount = 1;
|
||||||
|
|
||||||
|
public PayloadStack(UnlockableContent item, int amount){
|
||||||
|
this.item = item;
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayloadStack(UnlockableContent item){
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayloadStack(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PayloadStack[] with(Object... items){
|
||||||
|
var stacks = new PayloadStack[items.length / 2];
|
||||||
|
for(int i = 0; i < items.length; i += 2){
|
||||||
|
stacks[i / 2] = new PayloadStack((UnlockableContent)items[i], ((Number)items[i + 1]).intValue());
|
||||||
|
}
|
||||||
|
return stacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Seq<PayloadStack> list(Object... items){
|
||||||
|
Seq<PayloadStack> stacks = new Seq<>(items.length / 2);
|
||||||
|
for(int i = 0; i < items.length; i += 2){
|
||||||
|
stacks.add(new PayloadStack((UnlockableContent)items[i], ((Number)items[i + 1]).intValue()));
|
||||||
|
}
|
||||||
|
return stacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(PayloadStack stack){
|
||||||
|
return item.compareTo(stack.item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o){
|
||||||
|
return this == o || (o instanceof PayloadStack stack && stack.amount == amount && item == stack.item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return "BlockStack{" +
|
||||||
|
"item=" + item +
|
||||||
|
", amount=" + amount +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -112,9 +112,11 @@ public class UnitType extends UnlockableContent{
|
|||||||
/** Target items to mine. Used in MinerAI */
|
/** Target items to mine. Used in MinerAI */
|
||||||
public Seq<Item> mineItems = Seq.with(Items.copper, Items.lead, Items.titanium, Items.thorium);
|
public Seq<Item> mineItems = Seq.with(Items.copper, Items.lead, Items.titanium, Items.thorium);
|
||||||
|
|
||||||
|
//TODO different names for these fields.
|
||||||
/** The default AI controller to assign on creation. */
|
/** The default AI controller to assign on creation. */
|
||||||
public Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
|
public Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
|
||||||
/** Function that chooses AI controller based on unit entity. */
|
/** Function that chooses AI controller based on unit entity. */
|
||||||
|
//TODO -name is too long
|
||||||
public Func<Unit, ? extends UnitController> unitBasedDefaultController = u -> !playerControllable || u.team.isAI() ? defaultController.get() : new CommandAI();
|
public Func<Unit, ? extends UnitController> unitBasedDefaultController = u -> !playerControllable || u.team.isAI() ? defaultController.get() : new CommandAI();
|
||||||
|
|
||||||
public Color outlineColor = Pal.darkerMetal;
|
public Color outlineColor = Pal.darkerMetal;
|
||||||
@@ -713,8 +715,14 @@ public class UnitType extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
ItemSeq reqs = new ItemSeq();
|
ItemSeq reqs = new ItemSeq();
|
||||||
for(var bstack : plan.requirements){
|
for(var bstack : plan.requirements){
|
||||||
for(var stack : bstack.block.requirements){
|
if(bstack.item instanceof Block block){
|
||||||
reqs.add(stack.item, stack.amount * bstack.amount);
|
for(var stack : block.requirements){
|
||||||
|
reqs.add(stack.item, stack.amount * bstack.amount);
|
||||||
|
}
|
||||||
|
}else if(bstack.item instanceof UnitType unit){
|
||||||
|
for(var stack : unit.getTotalRequirements()){
|
||||||
|
reqs.add(stack.item, stack.amount * bstack.amount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return reqs.toArray();
|
return reqs.toArray();
|
||||||
@@ -911,10 +919,14 @@ public class UnitType extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawSoftShadow(Unit unit, float alpha){
|
public void drawSoftShadow(Unit unit, float alpha){
|
||||||
|
drawSoftShadow(unit.x, unit.y, unit.rotation, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawSoftShadow(float x, float y, float rotation, float alpha){
|
||||||
Draw.color(0, 0, 0, 0.4f * alpha);
|
Draw.color(0, 0, 0, 0.4f * alpha);
|
||||||
float rad = 1.6f;
|
float rad = 1.6f;
|
||||||
float size = Math.max(region.width, region.height) * Draw.scl;
|
float size = Math.max(region.width, region.height) * Draw.scl;
|
||||||
Draw.rect(softShadowRegion, unit, size * rad * Draw.xscl, size * rad * Draw.yscl, unit.rotation - 90);
|
Draw.rect(softShadowRegion, x, y, size * rad * Draw.xscl, size * rad * Draw.yscl, rotation - 90);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ItemImage extends Stack{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemImage(BlockStack stack){
|
public ItemImage(PayloadStack stack){
|
||||||
this(stack.block.uiIcon, stack.amount);
|
this(stack.item.uiIcon, stack.amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import arc.scene.ui.*;
|
|||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.bullet.*;
|
import mindustry.entities.bullet.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@@ -18,9 +19,9 @@ import static mindustry.Vars.*;
|
|||||||
|
|
||||||
//TODO visuals!
|
//TODO visuals!
|
||||||
public class PayloadTurret extends Turret{
|
public class PayloadTurret extends Turret{
|
||||||
public ObjectMap<Block, BulletType> ammoTypes = new ObjectMap<>();
|
public ObjectMap<UnlockableContent, BulletType> ammoTypes = new ObjectMap<>();
|
||||||
|
|
||||||
protected Block[] ammoKeys;
|
protected UnlockableContent[] ammoKeys;
|
||||||
|
|
||||||
public PayloadTurret(String name){
|
public PayloadTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -62,7 +63,7 @@ public class PayloadTurret extends Turret{
|
|||||||
public void build(Building build, Table table){
|
public void build(Building build, Table table){
|
||||||
MultiReqImage image = new MultiReqImage();
|
MultiReqImage image = new MultiReqImage();
|
||||||
content.blocks().each(i -> filter.get(i) && i.unlockedNow(), block -> image.add(new ReqImage(new Image(block.uiIcon),
|
content.blocks().each(i -> filter.get(i) && i.unlockedNow(), block -> image.add(new ReqImage(new Image(block.uiIcon),
|
||||||
() -> build instanceof PayloadTurretBuild it && !it.blocks.isEmpty() && it.currentBlock() == block)));
|
() -> build instanceof PayloadTurretBuild it && !it.payloads.isEmpty() && it.currentBlock() == block)));
|
||||||
|
|
||||||
table.add(image).size(8 * 4);
|
table.add(image).size(8 * 4);
|
||||||
}
|
}
|
||||||
@@ -70,7 +71,7 @@ public class PayloadTurret extends Turret{
|
|||||||
@Override
|
@Override
|
||||||
public boolean valid(Building build){
|
public boolean valid(Building build){
|
||||||
//valid when there's any ammo in the turret
|
//valid when there's any ammo in the turret
|
||||||
return build instanceof PayloadTurretBuild it && it.blocks.any();
|
return build instanceof PayloadTurretBuild it && it.payloads.any();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,11 +86,11 @@ public class PayloadTurret extends Turret{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class PayloadTurretBuild extends TurretBuild{
|
public class PayloadTurretBuild extends TurretBuild{
|
||||||
public BlockSeq blocks = new BlockSeq();
|
public PayloadSeq payloads = new PayloadSeq();
|
||||||
|
|
||||||
public Block currentBlock(){
|
public UnlockableContent currentBlock(){
|
||||||
for(Block block : ammoKeys){
|
for(var block : ammoKeys){
|
||||||
if(blocks.contains(block)){
|
if(payloads.contains(block)){
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,25 +99,25 @@ public class PayloadTurret extends Turret{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptPayload(Building source, Payload payload){
|
public boolean acceptPayload(Building source, Payload payload){
|
||||||
return payload instanceof BuildPayload build && blocks.total() < maxAmmo && ammoTypes.containsKey(build.block());
|
return payload instanceof BuildPayload build && payloads.total() < maxAmmo && ammoTypes.containsKey(build.block());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePayload(Building source, Payload payload){
|
public void handlePayload(Building source, Payload payload){
|
||||||
blocks.add(((BuildPayload)payload).block());
|
payloads.add(((BuildPayload)payload).block());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasAmmo(){
|
public boolean hasAmmo(){
|
||||||
return blocks.total() > 0;
|
return payloads.total() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BulletType useAmmo(){
|
public BulletType useAmmo(){
|
||||||
ejectEffects();
|
ejectEffects();
|
||||||
for(Block block : ammoKeys){
|
for(var block : ammoKeys){
|
||||||
if(blocks.contains(block)){
|
if(payloads.contains(block)){
|
||||||
blocks.remove(block);
|
payloads.remove(block);
|
||||||
return ammoTypes.get(block);
|
return ammoTypes.get(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,8 +126,8 @@ public class PayloadTurret extends Turret{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BulletType peekAmmo(){
|
public BulletType peekAmmo(){
|
||||||
for(Block block : ammoKeys){
|
for(var block : ammoKeys){
|
||||||
if(blocks.contains(block)){
|
if(payloads.contains(block)){
|
||||||
return ammoTypes.get(block);
|
return ammoTypes.get(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,13 +135,13 @@ public class PayloadTurret extends Turret{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockSeq getBlockPayloads(){
|
public PayloadSeq getBlockPayloads(){
|
||||||
return blocks;
|
return payloads;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
totalAmmo = blocks.total();
|
totalAmmo = payloads.total();
|
||||||
unit.ammo((float)unit.type().ammoCapacity * totalAmmo / maxAmmo);
|
unit.ammo((float)unit.type().ammoCapacity * totalAmmo / maxAmmo);
|
||||||
|
|
||||||
super.updateTile();
|
super.updateTile();
|
||||||
@@ -157,13 +158,13 @@ public class PayloadTurret extends Turret{
|
|||||||
@Override
|
@Override
|
||||||
public void write(Writes write){
|
public void write(Writes write){
|
||||||
super.write(write);
|
super.write(write);
|
||||||
blocks.write(write);
|
payloads.write(write);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(Reads read, byte revision){
|
public void read(Reads read, byte revision){
|
||||||
super.read(read, revision);
|
super.read(read, revision);
|
||||||
blocks.read(read);
|
payloads.read(read);
|
||||||
//TODO remove invalid ammo
|
//TODO remove invalid ammo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package mindustry.world.blocks.payloads;
|
|||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@@ -36,6 +37,11 @@ public class BuildPayload implements Payload{
|
|||||||
build.dropped();
|
build.dropped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UnlockableContent content(){
|
||||||
|
return build.block;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(boolean inUnit){
|
public void update(boolean inUnit){
|
||||||
if(inUnit && !build.block.updateInUnits) return;
|
if(inUnit && !build.block.updateInUnits) return;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import arc.graphics.g2d.*;
|
|||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
@@ -60,6 +61,9 @@ public interface Payload extends Position{
|
|||||||
/** @return icon describing the contents. */
|
/** @return icon describing the contents. */
|
||||||
TextureRegion icon();
|
TextureRegion icon();
|
||||||
|
|
||||||
|
/** @return content describing this payload (block or unit) */
|
||||||
|
UnlockableContent content();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default float getX(){
|
default float getX(){
|
||||||
return x();
|
return x();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import arc.util.*;
|
|||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.core.*;
|
import mindustry.core.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.EntityCollisions.*;
|
import mindustry.entities.EntityCollisions.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
@@ -40,6 +41,11 @@ public class UnitPayload implements Payload{
|
|||||||
showOverlay(icon.getRegion());
|
showOverlay(icon.getRegion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UnlockableContent content(){
|
||||||
|
return unit.type;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] requirements(){
|
public ItemStack[] requirements(){
|
||||||
return unit.type.getTotalRequirements();
|
return unit.type.getTotalRequirements();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
public float itemDuration = 120f;
|
public float itemDuration = 120f;
|
||||||
|
|
||||||
public float effectChance = 0.01f;
|
public float effectChance = 0.01f;
|
||||||
public Effect generateEffect = Fx.none;
|
public Effect generateEffect = Fx.none, consumeEffect = Fx.none;
|
||||||
public float generateEffectRange = 3f;
|
public float generateEffectRange = 3f;
|
||||||
|
|
||||||
public @Nullable LiquidStack liquidOutput;
|
public @Nullable LiquidStack liquidOutput;
|
||||||
@@ -79,6 +79,7 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
//take in items periodically
|
//take in items periodically
|
||||||
if(hasItems && valid && generateTime <= 0f && items.any()){
|
if(hasItems && valid && generateTime <= 0f && items.any()){
|
||||||
consume();
|
consume();
|
||||||
|
consumeEffect.at(x + Mathf.range(generateEffectRange), y + Mathf.range(generateEffectRange));
|
||||||
generateTime = 1f;
|
generateTime = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +93,10 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
generateTime -= Math.min(1f / itemDuration * delta(), generateTime);
|
generateTime -= Math.min(1f / itemDuration * delta(), generateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getEfficiencyMultiplier(){
|
||||||
|
return 1f;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean consumeTriggerValid(){
|
public boolean consumeTriggerValid(){
|
||||||
return generateTime > 0;
|
return generateTime > 0;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import arc.util.io.*;
|
|||||||
import mindustry.ai.types.*;
|
import mindustry.ai.types.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
@@ -50,6 +51,7 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
flags = EnumSet.of(BlockFlag.unitAssembler);
|
flags = EnumSet.of(BlockFlag.unitAssembler);
|
||||||
regionRotated1 = 1;
|
regionRotated1 = 1;
|
||||||
sync = true;
|
sync = true;
|
||||||
|
group = BlockGroup.units;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rect getRect(Rect rect, float x, float y, int rotation){
|
public Rect getRect(Rect rect, float x, float y, int rotation){
|
||||||
@@ -148,10 +150,10 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
|
|
||||||
public static class AssemblerUnitPlan{
|
public static class AssemblerUnitPlan{
|
||||||
public UnitType unit;
|
public UnitType unit;
|
||||||
public Seq<BlockStack> requirements;
|
public Seq<PayloadStack> requirements;
|
||||||
public float time;
|
public float time;
|
||||||
|
|
||||||
public AssemblerUnitPlan(UnitType unit, float time, Seq<BlockStack> requirements){
|
public AssemblerUnitPlan(UnitType unit, float time, Seq<PayloadStack> requirements){
|
||||||
this.unit = unit;
|
this.unit = unit;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.requirements = requirements;
|
this.requirements = requirements;
|
||||||
@@ -163,11 +165,11 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
/** hbgwerjhbagjegwg */
|
/** hbgwerjhbagjegwg */
|
||||||
public static class YeetData{
|
public static class YeetData{
|
||||||
public Vec2 target;
|
public Vec2 target;
|
||||||
public Block block;
|
public UnlockableContent item;
|
||||||
|
|
||||||
public YeetData(Vec2 target, Block block){
|
public YeetData(Vec2 target, UnlockableContent item){
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.block = block;
|
this.item = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,14 +185,14 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
build.droneSpawned(id);
|
build.droneSpawned(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UnitAssemblerBuild extends PayloadBlockBuild<BuildPayload>{
|
public class UnitAssemblerBuild extends PayloadBlockBuild<Payload>{
|
||||||
protected IntSeq readUnits = new IntSeq();
|
protected IntSeq readUnits = new IntSeq();
|
||||||
//holds drone IDs that have been sent, but not synced yet - add to list as soon as possible
|
//holds drone IDs that have been sent, but not synced yet - add to list as soon as possible
|
||||||
protected IntSeq whenSyncedUnits = new IntSeq();
|
protected IntSeq whenSyncedUnits = new IntSeq();
|
||||||
|
|
||||||
public Seq<Unit> units = new Seq<>();
|
public Seq<Unit> units = new Seq<>();
|
||||||
public Seq<UnitAssemblerModuleBuild> modules = new Seq<>();
|
public Seq<UnitAssemblerModuleBuild> modules = new Seq<>();
|
||||||
public BlockSeq blocks = new BlockSeq();
|
public PayloadSeq blocks = new PayloadSeq();
|
||||||
public float progress, warmup, droneWarmup, powerWarmup, sameTypeWarmup;
|
public float progress, warmup, droneWarmup, powerWarmup, sameTypeWarmup;
|
||||||
public float invalidWarmup = 0f;
|
public float invalidWarmup = 0f;
|
||||||
public int currentTier = 0;
|
public int currentTier = 0;
|
||||||
@@ -518,12 +520,12 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
return consValid() && !wasOccupied;
|
return consValid() && !wasOccupied;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void yeetPayload(BuildPayload payload){
|
public void yeetPayload(Payload payload){
|
||||||
var spawn = getUnitSpawn();
|
var spawn = getUnitSpawn();
|
||||||
blocks.add(payload.block(), 1);
|
blocks.add(payload.content(), 1);
|
||||||
float rot = payload.angleTo(spawn);
|
float rot = payload.angleTo(spawn);
|
||||||
Fx.shootPayloadDriver.at(payload.x(), payload.y(), rot);
|
Fx.shootPayloadDriver.at(payload.x(), payload.y(), rot);
|
||||||
Fx.payloadDeposit.at(payload.x(), payload.y(), rot, new YeetData(spawn.cpy(), payload.block()));
|
Fx.payloadDeposit.at(payload.x(), payload.y(), rot, new YeetData(spawn.cpy(), payload.content()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -533,7 +535,7 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockSeq getBlockPayloads(){
|
public PayloadSeq getBlockPayloads(){
|
||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,7 +543,7 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
public boolean acceptPayload(Building source, Payload payload){
|
public boolean acceptPayload(Building source, Payload payload){
|
||||||
var plan = plan();
|
var plan = plan();
|
||||||
return (this.payload == null || source instanceof UnitAssemblerModuleBuild) &&
|
return (this.payload == null || source instanceof UnitAssemblerModuleBuild) &&
|
||||||
payload instanceof BuildPayload bp && plan.requirements.contains(b -> b.block == bp.block() && blocks.get(bp.block()) < b.amount);
|
plan.requirements.contains(b -> b.item == payload.content() && blocks.get(payload.content()) < b.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class UnitAssemblerModule extends PayloadBlock{
|
|||||||
return results.find(b -> b.moduleFits(this, x * tilesize + offset, y * tilesize + offset, rotation));
|
return results.find(b -> b.moduleFits(this, x * tilesize + offset, y * tilesize + offset, rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UnitAssemblerModuleBuild extends PayloadBlockBuild<BuildPayload>{
|
public class UnitAssemblerModuleBuild extends PayloadBlockBuild<Payload>{
|
||||||
public UnitAssemblerBuild link;
|
public UnitAssemblerBuild link;
|
||||||
public int lastChange = -2;
|
public int lastChange = -2;
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import mindustry.ui.*;
|
|||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
public class ConsumePayloadDynamic extends Consume{
|
public class ConsumePayloadDynamic extends Consume{
|
||||||
public final Func<Building, Seq<BlockStack>> payloads;
|
public final Func<Building, Seq<PayloadStack>> payloads;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Building> ConsumePayloadDynamic(Func<T, Seq<BlockStack>> payloads){
|
public <T extends Building> ConsumePayloadDynamic(Func<T, Seq<PayloadStack>> payloads){
|
||||||
this.payloads = (Func<Building, Seq<BlockStack>>)payloads;
|
this.payloads = (Func<Building, Seq<PayloadStack>>)payloads;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,8 +54,8 @@ public class ConsumePayloadDynamic extends Consume{
|
|||||||
table.table(c -> {
|
table.table(c -> {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(var stack : pay){
|
for(var stack : pay){
|
||||||
c.add(new ReqImage(new ItemImage(stack.block.uiIcon, stack.amount),
|
c.add(new ReqImage(new ItemImage(stack.item.uiIcon, stack.amount),
|
||||||
() -> inv.contains(stack.block, stack.amount))).padRight(8);
|
() -> inv.contains(stack.item, stack.amount))).padRight(8);
|
||||||
if(++i % 4 == 0) c.row();
|
if(++i % 4 == 0) c.row();
|
||||||
}
|
}
|
||||||
}).left();
|
}).left();
|
||||||
|
|||||||
@@ -2,23 +2,25 @@ package mindustry.world.consumers;
|
|||||||
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.struct.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class ConsumePayloadFilter extends Consume{
|
public class ConsumePayloadFilter extends Consume{
|
||||||
//cache fitting blocks to prevent search over all blocks later
|
//cache fitting blocks to prevent search over all blocks later
|
||||||
protected final Block[] fitting;
|
protected final UnlockableContent[] fitting;
|
||||||
|
|
||||||
public Boolf<Block> filter;
|
public Boolf<UnlockableContent> filter;
|
||||||
|
|
||||||
public ConsumePayloadFilter(Boolf<Block> filter){
|
public ConsumePayloadFilter(Boolf<UnlockableContent> filter){
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
this.fitting = Vars.content.blocks().select(filter).toArray(Block.class);
|
this.fitting = Vars.content.blocks().copy().<UnlockableContent>as().and(content.units().as())
|
||||||
|
.select(filter).toArray(UnlockableContent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,7 +47,7 @@ public class ConsumePayloadFilter extends Consume{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void display(Stats stats){
|
public void display(Stats stats){
|
||||||
stats.add(booster ? Stat.booster : Stat.input, StatValues.blocks(filter));
|
stats.add(booster ? Stat.booster : Stat.input, StatValues.content(new Seq<>(fitting)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import mindustry.ui.*;
|
|||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
public class ConsumePayloads extends Consume{
|
public class ConsumePayloads extends Consume{
|
||||||
public Seq<BlockStack> payloads;
|
public Seq<PayloadStack> payloads;
|
||||||
|
|
||||||
public ConsumePayloads(Seq<BlockStack> payloads){
|
public ConsumePayloads(Seq<PayloadStack> payloads){
|
||||||
this.payloads = payloads;
|
this.payloads = payloads;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public class ConsumePayloads extends Consume{
|
|||||||
for(var stack : payloads){
|
for(var stack : payloads){
|
||||||
stats.add(Stat.input, t -> {
|
stats.add(Stat.input, t -> {
|
||||||
t.add(new ItemImage(stack));
|
t.add(new ItemImage(stack));
|
||||||
t.add(stack.block.localizedName).padLeft(4).padRight(4);
|
t.add(stack.item.localizedName).padLeft(4).padRight(4);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,8 +43,8 @@ public class ConsumePayloads extends Consume{
|
|||||||
table.table(c -> {
|
table.table(c -> {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(var stack : payloads){
|
for(var stack : payloads){
|
||||||
c.add(new ReqImage(new ItemImage(stack.block.uiIcon, stack.amount),
|
c.add(new ReqImage(new ItemImage(stack.item.uiIcon, stack.amount),
|
||||||
() -> inv.contains(stack.block, stack.amount))).padRight(8);
|
() -> inv.contains(stack.item, stack.amount))).padRight(8);
|
||||||
if(++i % 4 == 0) c.row();
|
if(++i % 4 == 0) c.row();
|
||||||
}
|
}
|
||||||
}).left();
|
}).left();
|
||||||
|
|||||||
@@ -197,16 +197,12 @@ public class StatValues{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StatValue blocks(Boolf<Block> pred){
|
public static StatValue content(Seq<UnlockableContent> list){
|
||||||
return blocks(content.blocks().select(pred));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static StatValue blocks(Seq<Block> list){
|
|
||||||
return table -> table.table(l -> {
|
return table -> table.table(l -> {
|
||||||
l.left();
|
l.left();
|
||||||
|
|
||||||
for(int i = 0; i < list.size; i++){
|
for(int i = 0; i < list.size; i++){
|
||||||
Block item = list.get(i);
|
var item = list.get(i);
|
||||||
|
|
||||||
l.image(item.uiIcon).size(iconSmall).padRight(2).padLeft(2).padTop(3).padBottom(3);
|
l.image(item.uiIcon).size(iconSmall).padRight(2).padLeft(2).padTop(3).padBottom(3);
|
||||||
l.add(item.localizedName).left().padLeft(1).padRight(4);
|
l.add(item.localizedName).left().padLeft(1).padRight(4);
|
||||||
@@ -217,6 +213,14 @@ public class StatValues{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static StatValue blocks(Boolf<Block> pred){
|
||||||
|
return blocks(content.blocks().select(pred));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatValue blocks(Seq<Block> list){
|
||||||
|
return content(list.as());
|
||||||
|
}
|
||||||
|
|
||||||
public static StatValue boosters(float reload, float maxUsed, float multiplier, boolean baseReload, Boolf<Liquid> filter){
|
public static StatValue boosters(float reload, float maxUsed, float multiplier, boolean baseReload, Boolf<Liquid> filter){
|
||||||
return table -> {
|
return table -> {
|
||||||
table.row();
|
table.row();
|
||||||
|
|||||||
Reference in New Issue
Block a user