Dynamic resupply check (#6338)
This commit is contained in:
@@ -434,6 +434,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
return block.unloadable;
|
return block.unloadable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canResupply(){
|
||||||
|
return block.allowResupply;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean payloadCheck(int conveyorRotation){
|
public boolean payloadCheck(int conveyorRotation){
|
||||||
return block.rotate && (rotation + 2) % 4 == conveyorRotation;
|
return block.rotate && (rotation + 2) % 4 == conveyorRotation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ItemAmmoType implements AmmoType{
|
|||||||
|
|
||||||
float range = unit.hitSize + this.range;
|
float range = unit.hitSize + this.range;
|
||||||
|
|
||||||
Building build = Units.closestBuilding(unit.team, unit.x, unit.y, range, u -> u.block.allowResupply && u.items.has(item));
|
Building build = Units.closestBuilding(unit.team, unit.x, unit.y, range, u -> u.canResupply() && u.items.has(item));
|
||||||
|
|
||||||
if(build != null){
|
if(build != null){
|
||||||
Fx.itemTransfer.at(build.x, build.y, ammoPerItem / 2f, item.color, unit);
|
Fx.itemTransfer.at(build.x, build.y, ammoPerItem / 2f, item.color, unit);
|
||||||
|
|||||||
Reference in New Issue
Block a user