Less frequent Erekir turret retargeting when valid target is present
This commit is contained in:
@@ -36,6 +36,8 @@ public class Turret extends ReloadTurret{
|
||||
public final int timerTarget = timers++;
|
||||
/** Ticks between attempt at finding a target. */
|
||||
public float targetInterval = 20;
|
||||
/** Target interval for when this turret already has a valid target. -1 = targetInterval */
|
||||
public float newTargetInterval = -1f;
|
||||
|
||||
/** Maximum ammo units stored. */
|
||||
public int maxAmmo = 30;
|
||||
@@ -176,6 +178,7 @@ public class Turret extends ReloadTurret{
|
||||
if(elevation < 0) elevation = size / 2f;
|
||||
if(recoilTime < 0f) recoilTime = reload;
|
||||
if(cooldownTime < 0f) cooldownTime = reload;
|
||||
if(newTargetInterval <= 0f) newTargetInterval = targetInterval;
|
||||
|
||||
super.init();
|
||||
}
|
||||
@@ -405,7 +408,7 @@ public class Turret extends ReloadTurret{
|
||||
if(hasAmmo()){
|
||||
if(Float.isNaN(reloadCounter)) reloadCounter = 0;
|
||||
|
||||
if(timer(timerTarget, targetInterval)){
|
||||
if(timer(timerTarget, target == null ? newTargetInterval : targetInterval)){
|
||||
findTarget();
|
||||
}
|
||||
|
||||
@@ -438,6 +441,8 @@ public class Turret extends ReloadTurret{
|
||||
wasShooting = true;
|
||||
updateShooting();
|
||||
}
|
||||
}else{
|
||||
target = null;
|
||||
}
|
||||
|
||||
if(alwaysShooting){
|
||||
|
||||
Reference in New Issue
Block a user