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