mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-25 22:17:59 +07:00
Fixed missile distraction / Easier three
This commit is contained in:
parent
48538d28b8
commit
46a58c7965
Binary file not shown.
@ -19,7 +19,7 @@ import static mindustry.Vars.*;
|
|||||||
public class Units{
|
public class Units{
|
||||||
private static final Rect hitrect = new Rect();
|
private static final Rect hitrect = new Rect();
|
||||||
private static Unit result;
|
private static Unit result;
|
||||||
private static float cdist;
|
private static float cdist, cpriority;
|
||||||
private static boolean boolResult;
|
private static boolean boolResult;
|
||||||
private static int intResult;
|
private static int intResult;
|
||||||
private static Building buildResult;
|
private static Building buildResult;
|
||||||
@ -271,14 +271,16 @@ public class Units{
|
|||||||
|
|
||||||
result = null;
|
result = null;
|
||||||
cdist = 0f;
|
cdist = 0f;
|
||||||
|
cpriority = -99999f;
|
||||||
|
|
||||||
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
|
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;
|
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);
|
float cost = sort.cost(e, x, y);
|
||||||
if(result == null || cost < cdist){
|
if((result == null || cost < cdist) && e.type.targetPriority >= cpriority){
|
||||||
result = e;
|
result = e;
|
||||||
cdist = cost;
|
cdist = cost;
|
||||||
|
cpriority = e.type.targetPriority;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,6 +79,8 @@ public class UnitType extends UnlockableContent{
|
|||||||
public float payloadCapacity = 8;
|
public float payloadCapacity = 8;
|
||||||
public float aimDst = -1f;
|
public float aimDst = -1f;
|
||||||
public float buildBeamOffset = 3.8f;
|
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 drawBuildBeam = true;
|
||||||
public boolean rotateToBuilding = true;
|
public boolean rotateToBuilding = true;
|
||||||
public int commandLimit = 8;
|
public int commandLimit = 8;
|
||||||
|
@ -30,6 +30,7 @@ public class MissileUnitType extends UnitType{
|
|||||||
lifetime = 60f * 1.7f;
|
lifetime = 60f * 1.7f;
|
||||||
rotateSpeed = 2.5f;
|
rotateSpeed = 2.5f;
|
||||||
range = 30f;
|
range = 30f;
|
||||||
|
targetPriority = -1f;
|
||||||
//TODO weapons, etc
|
//TODO weapons, etc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user