This commit is contained in:
Anuken
2020-07-18 09:36:43 -04:00
parent 6b3039dba2
commit 870f06218b
10 changed files with 39 additions and 11 deletions

View File

@@ -88,6 +88,11 @@ public class PayloadConveyor extends Block{
blocked = (next != null && next.solid()) || (this.next != null && (this.next.rotation() + 2)%4 == rotation());
}
@Override
public Payload getPayload(){
return item;
}
@Override
public void updateTile(){
progress = Time.time() % moveTime;

View File

@@ -33,6 +33,11 @@ public class BlockPayload implements Payload{
tile.setBlock(entity.block(), entity.team(), rotation, () -> entity);
}
@Override
public boolean canBeTaken(Payloadc picker){
return entity.block.size <= 2;
}
@Override
public boolean fits(){
return entity.block().size < 3;

View File

@@ -27,6 +27,11 @@ public interface Payload{
return true;
}
/** @return whether the unit can pick up this payload. */
default boolean canBeTaken(Payloadc picker){
return true;
}
/** writes the payload for saving. */
void write(Writes write);

View File

@@ -20,6 +20,11 @@ public class UnitPayload implements Payload{
return unit.hitSize <= 16f;
}
@Override
public boolean canBeTaken(Payloadc picker){
return unit.hitSize < picker.hitSize();
}
@Override
public void write(Writes write){
write.b(payloadUnit);

View File

@@ -65,6 +65,11 @@ public class PayloadAcceptor extends Block{
updatePayload();
}
@Override
public Payload getPayload(){
return payload;
}
@Override
public Payload takePayload(){
T t = payload;