Partial impl of #2923

This commit is contained in:
Anuken
2021-07-20 13:17:18 -04:00
parent b28aff4a7b
commit 0f199fa4b4
4 changed files with 45 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.payloads.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
@@ -178,6 +179,14 @@ public class AIController implements UnitController{
return Geometry.findClosest(unit.x, unit.y, Vars.spawner.getSpawns());
}
protected void unloadPayloads(){
if(unit instanceof Payloadc pay && pay.hasPayload() && target instanceof Building && pay.payloads().peek() instanceof UnitPayload){
if(target.within(unit, Math.max(unit.type().range + 1f, 75f))){
pay.dropLastPayload();
}
}
}
protected void circle(Position target, float circleLength){
circle(target, circleLength, unit.speed());
}