Payload system rework (#2485)

This commit is contained in:
Anuken
2020-09-06 17:13:14 -04:00
parent 27d9f965be
commit 7b18389d45
7 changed files with 38 additions and 27 deletions
@@ -35,8 +35,8 @@ public class BlockPayload implements Payload{
}
@Override
public boolean canBeTaken(Payloadc picker){
return entity.block.size <= 2;
public float size(){
return entity.block.size * tilesize;
}
@Override
@@ -17,6 +17,9 @@ public interface Payload{
/** draws this payload at a position. */
void draw();
/** @return hitbox size of the payload. */
float size();
/** @return whether this payload was dumped. */
default boolean dump(){
return false;
@@ -27,11 +30,6 @@ 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);
@@ -20,11 +20,6 @@ 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);
@@ -38,6 +33,11 @@ public class UnitPayload implements Payload{
unit.rotation(rotation);
}
@Override
public float size(){
return unit.hitSize;
}
@Override
public boolean dump(){
//no client dumping