mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-21 12:03:29 -08:00
Merge 8db13b6866 into 9150360f74
This commit is contained in:
commit
3a0900bea2
4 changed files with 40 additions and 10 deletions
|
|
@ -3646,18 +3646,21 @@ public class Blocks{
|
|||
}};
|
||||
|
||||
parallax = new TractorBeamTurret("parallax"){{
|
||||
requirements(Category.turret, with(Items.silicon, 160, Items.titanium, 110, Items.graphite, 50));
|
||||
requirements(Category.turret, with(Items.silicon, 160, Items.titanium, 100, Items.graphite, 80));
|
||||
|
||||
hasPower = true;
|
||||
size = 2;
|
||||
force = 16f;
|
||||
scaledForce = 9f;
|
||||
force = 9f;
|
||||
scaledForce = 3f;
|
||||
range = 300f;
|
||||
damage = 0.5f;
|
||||
damage = 0.2f;
|
||||
scaledHealth = 160;
|
||||
rotateSpeed = 12;
|
||||
rotateSpeed = 18;
|
||||
|
||||
status = StatusEffects.sapped;
|
||||
statusDuration = 60f * 6f;
|
||||
|
||||
consumePower(3.3f);
|
||||
consumePower(6f);
|
||||
}};
|
||||
|
||||
swarmer = new ItemTurret("swarmer"){{
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public class StatusEffects{
|
|||
|
||||
slow = new StatusEffect("slow"){{
|
||||
color = Pal.lightishGray;
|
||||
effect = Fx.freezing;
|
||||
speedMultiplier = 0.4f;
|
||||
|
||||
init(() -> opposite(fast));
|
||||
|
|
|
|||
|
|
@ -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, cpriority;
|
||||
private static float cdist, cpriority, chealth, cspeedMultiplier, chealthMultiplier;
|
||||
private static int intResult;
|
||||
private static Building buildResult;
|
||||
|
||||
|
|
@ -298,6 +298,32 @@ public class Units{
|
|||
return result;
|
||||
}
|
||||
|
||||
/** Returns the nominal enemy of this team. Filter by predicate. */
|
||||
public static Unit nominalEnemy(Team team, float x, float y, float range, Boolf<Unit> predicate){
|
||||
if(team == Team.derelict) return null;
|
||||
|
||||
result = null;
|
||||
cpriority = -99999f;
|
||||
chealth = -2f;
|
||||
cspeedMultiplier = 0.1f;
|
||||
chealthMultiplier = 0.1f;
|
||||
|
||||
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.targetable(team) || e.inFogTo(team)) return;
|
||||
|
||||
float dst2 = e.dst2(x, y) - (e.hitSize * e.hitSize);
|
||||
if(dst2 < range*range && (result == null || e.health >= chealth ||e.type.targetPriority > cpriority) && e.type.targetPriority >= cpriority && e.healthMultiplier >= chealthMultiplier && e.speedMultiplier >= cspeedMultiplier){
|
||||
result = e;
|
||||
chealth = e.health;
|
||||
chealthMultiplier = e.healthMultiplier;
|
||||
cspeedMultiplier = e.speedMultiplier;
|
||||
cpriority = e.type.targetPriority;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Returns the closest enemy of this team using a custom comparison function. Filter by predicate. */
|
||||
public static Unit bestEnemy(Team team, float x, float y, float range, Boolf<Unit> predicate, Sortf sort){
|
||||
if(team == Team.derelict) return null;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import static mindustry.Vars.*;
|
|||
|
||||
public class TractorBeamTurret extends BaseTurret{
|
||||
public final int timerTarget = timers++;
|
||||
public float retargetTime = 5f;
|
||||
public float retargetTime = 15f;
|
||||
|
||||
public float shootCone = 6f;
|
||||
public float shootLength = 5f;
|
||||
|
|
@ -29,7 +29,7 @@ public class TractorBeamTurret extends BaseTurret{
|
|||
public boolean targetAir = true, targetGround = false;
|
||||
public Color laserColor = Color.white;
|
||||
public StatusEffect status = StatusEffects.none;
|
||||
public float statusDuration = 300;
|
||||
public float statusDuration = 360;
|
||||
|
||||
public Sound shootSound = Sounds.beamParallax;
|
||||
public float shootSoundVolume = 0.9f;
|
||||
|
|
@ -85,7 +85,7 @@ public class TractorBeamTurret extends BaseTurret{
|
|||
|
||||
//retarget
|
||||
if(timer(timerTarget, retargetTime)){
|
||||
target = Units.closestEnemy(team, x, y, range, u -> u.checkTarget(targetAir, targetGround));
|
||||
target = Units.nominalEnemy(team, x, y, range, u -> u.checkTarget(targetAir, targetGround));
|
||||
}
|
||||
|
||||
//consume coolant
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue