Merge pull request #2807 from MEEPofFaith/patch-1

Define payload capacity of payload conveyors on the conveyor itself.
This commit is contained in:
Anuken 2020-10-03 10:37:41 -04:00 committed by GitHub
commit 9a92e0246e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -20,6 +20,7 @@ public class PayloadConveyor extends Block{
public @Load("@-top") TextureRegion topRegion;
public @Load("@-edge") TextureRegion edgeRegion;
public Interp interp = Interp.pow5;
public float payloadLimit = 2.5f;
public PayloadConveyor(String name){
super(name);
@ -216,10 +217,10 @@ public class PayloadConveyor extends Block{
@Override
public boolean acceptPayload(Building source, Payload payload){
if(source == this){
return this.item == null && payload.fits();
return this.item == null && payload.fits(payloadLimit);
}
//accepting payloads from units isn't supported
return this.item == null && progress <= 5f && payload.fits();
return this.item == null && progress <= 5f && payload.fits(payloadLimit);
}
@Override

View File

@ -25,9 +25,9 @@ public interface Payload{
return false;
}
/** @return whether this payload fits on a standard 3x3 conveyor. */
default boolean fits(){
return size() / tilesize <= 2.5f;
/** @return whether this payload fits in a given size. 2.5 is the max for a standard 3x3 conveyor. */
default boolean fits(float s){
return size() / tilesize <= s;
}
/** writes the payload for saving. */