Fixed missile distraction / Easier three

This commit is contained in:
Anuken 2022-02-04 19:48:17 -05:00
parent 48538d28b8
commit 46a58c7965
4 changed files with 7 additions and 2 deletions

Binary file not shown.

View File

@ -19,7 +19,7 @@ import static mindustry.Vars.*;
public class Units{
private static final Rect hitrect = new Rect();
private static Unit result;
private static float cdist;
private static float cdist, cpriority;
private static boolean boolResult;
private static int intResult;
private static Building buildResult;
@ -271,14 +271,16 @@ public class Units{
result = null;
cdist = 0f;
cpriority = -99999f;
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.within(x, y, range + e.hitSize/2f)) return;
float cost = sort.cost(e, x, y);
if(result == null || cost < cdist){
if((result == null || cost < cdist) && e.type.targetPriority >= cpriority){
result = e;
cdist = cost;
cpriority = e.type.targetPriority;
}
});

View File

@ -79,6 +79,8 @@ public class UnitType extends UnlockableContent{
public float payloadCapacity = 8;
public float aimDst = -1f;
public float buildBeamOffset = 3.8f;
/** WIP: Units of low priority will always be ignored in favor of those with higher priority, regardless of distance. */
public float targetPriority = 0f;
public boolean drawBuildBeam = true;
public boolean rotateToBuilding = true;
public int commandLimit = 8;

View File

@ -30,6 +30,7 @@ public class MissileUnitType extends UnitType{
lifetime = 60f * 1.7f;
rotateSpeed = 2.5f;
range = 30f;
targetPriority = -1f;
//TODO weapons, etc
}
}