This commit is contained in:
Frolonov 2026-01-20 09:08:50 -03:00 committed by GitHub
commit 3a0900bea2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 10 deletions

View file

@ -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"){{

View file

@ -59,6 +59,7 @@ public class StatusEffects{
slow = new StatusEffect("slow"){{
color = Pal.lightishGray;
effect = Fx.freezing;
speedMultiplier = 0.4f;
init(() -> opposite(fast));

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, 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;

View file

@ -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