Payload loader tweaks
This commit is contained in:
@@ -50,6 +50,7 @@ public class Block extends UnlockableContent{
|
||||
public boolean outputsPayload = false;
|
||||
public boolean acceptsPayload = false;
|
||||
public boolean acceptsItems = false;
|
||||
public boolean separateItemCapacity = false;
|
||||
|
||||
public int itemCapacity = 10;
|
||||
public float liquidCapacity = 10f;
|
||||
|
||||
@@ -22,7 +22,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class Conveyor extends Block implements Autotiler{
|
||||
private static final float itemSpace = 0.4f;
|
||||
private static final int capacity = 4;
|
||||
private static final int capacity = 3;
|
||||
|
||||
final Vec2 tr1 = new Vec2();
|
||||
final Vec2 tr2 = new Vec2();
|
||||
@@ -40,7 +40,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
update = true;
|
||||
group = BlockGroup.transportation;
|
||||
hasItems = true;
|
||||
itemCapacity = 4;
|
||||
itemCapacity = capacity;
|
||||
conveyorPlacement = true;
|
||||
|
||||
ambientSound = Sounds.conveyor;
|
||||
@@ -323,7 +323,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public void handleStack(Item item, int amount, Teamc source){
|
||||
amount = Math.min(amount, itemCapacity - len);
|
||||
amount = Math.min(amount, capacity - len);
|
||||
|
||||
for(int i = amount - 1; i >= 0; i--){
|
||||
add(0);
|
||||
|
||||
@@ -87,7 +87,7 @@ public class PayloadDeconstructor extends PayloadBlock{
|
||||
|
||||
@Override
|
||||
public boolean acceptUnitPayload(Unit unit){
|
||||
return payload == null && !unit.spawnedByCore && unit.type.getTotalRequirements().length > 0 && unit.hitSize / tilesize <= maxPayloadSize;
|
||||
return payload == null && deconstructing == null && !unit.spawnedByCore && unit.type.getTotalRequirements().length > 0 && unit.hitSize / tilesize <= maxPayloadSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -148,7 +148,10 @@ public class PayloadLoader extends PayloadBlock{
|
||||
public boolean shouldExport(){
|
||||
return payload != null && (
|
||||
(payload.block().hasLiquids && payload.build.liquids.total() >= payload.block().liquidCapacity - 0.001f) ||
|
||||
(payload.block().hasItems && payload.build.items.total() >= payload.block().itemCapacity));
|
||||
(payload.block().hasItems &&
|
||||
payload.block().separateItemCapacity ?
|
||||
content.items().contains(i -> payload.build.items.get(i) >= payload.block().itemCapacity) :
|
||||
payload.build.items.total() >= payload.block().itemCapacity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public class StorageBlock extends Block{
|
||||
solid = true;
|
||||
update = false;
|
||||
destructible = true;
|
||||
separateItemCapacity = true;
|
||||
group = BlockGroup.transportation;
|
||||
flags = EnumSet.of(BlockFlag.storage);
|
||||
allowResupply = true;
|
||||
|
||||
Reference in New Issue
Block a user