Less frequent Erekir turret retargeting when valid target is present

This commit is contained in:
Anuken
2024-05-27 18:12:21 -04:00
parent a260710ee6
commit 4d2163d248
3 changed files with 14 additions and 2 deletions

View File

@@ -4152,6 +4152,7 @@ public class Blocks{
liquidConsumed = 10f / 60f; liquidConsumed = 10f / 60f;
targetInterval = 5f; targetInterval = 5f;
newTargetInterval = 30f;
targetUnderBlocks = false; targetUnderBlocks = false;
float r = range = 130f; float r = range = 130f;
@@ -4242,6 +4243,8 @@ public class Blocks{
shootY = 7f; shootY = 7f;
rotateSpeed = 1.4f; rotateSpeed = 1.4f;
minWarmup = 0.85f; minWarmup = 0.85f;
newTargetInterval = 40f;
shootWarmupSpeed = 0.07f; shootWarmupSpeed = 0.07f;
coolant = consume(new ConsumeLiquid(Liquids.water, 30f / 60f)); coolant = consume(new ConsumeLiquid(Liquids.water, 30f / 60f));
@@ -4462,6 +4465,8 @@ public class Blocks{
heatRequirement = 10f; heatRequirement = 10f;
maxHeatEfficiency = 2f; maxHeatEfficiency = 2f;
newTargetInterval = 40f;
inaccuracy = 1f; inaccuracy = 1f;
shake = 2f; shake = 2f;
shootY = 4; shootY = 4;
@@ -4684,6 +4689,8 @@ public class Blocks{
shootSound = Sounds.missileLaunch; shootSound = Sounds.missileLaunch;
minWarmup = 0.94f; minWarmup = 0.94f;
newTargetInterval = 40f;
unitSort = UnitSorts.strongest;
shootWarmupSpeed = 0.03f; shootWarmupSpeed = 0.03f;
targetAir = false; targetAir = false;
targetUnderBlocks = false; targetUnderBlocks = false;

View File

@@ -36,6 +36,8 @@ public class Turret extends ReloadTurret{
public final int timerTarget = timers++; public final int timerTarget = timers++;
/** Ticks between attempt at finding a target. */ /** Ticks between attempt at finding a target. */
public float targetInterval = 20; 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. */ /** Maximum ammo units stored. */
public int maxAmmo = 30; public int maxAmmo = 30;
@@ -176,6 +178,7 @@ public class Turret extends ReloadTurret{
if(elevation < 0) elevation = size / 2f; if(elevation < 0) elevation = size / 2f;
if(recoilTime < 0f) recoilTime = reload; if(recoilTime < 0f) recoilTime = reload;
if(cooldownTime < 0f) cooldownTime = reload; if(cooldownTime < 0f) cooldownTime = reload;
if(newTargetInterval <= 0f) newTargetInterval = targetInterval;
super.init(); super.init();
} }
@@ -405,7 +408,7 @@ public class Turret extends ReloadTurret{
if(hasAmmo()){ if(hasAmmo()){
if(Float.isNaN(reloadCounter)) reloadCounter = 0; if(Float.isNaN(reloadCounter)) reloadCounter = 0;
if(timer(timerTarget, targetInterval)){ if(timer(timerTarget, target == null ? newTargetInterval : targetInterval)){
findTarget(); findTarget();
} }
@@ -438,6 +441,8 @@ public class Turret extends ReloadTurret{
wasShooting = true; wasShooting = true;
updateShooting(); updateShooting();
} }
}else{
target = null;
} }
if(alwaysShooting){ if(alwaysShooting){

View File

@@ -25,4 +25,4 @@ org.gradle.caching=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000 org.gradle.internal.http.connectionTimeout=100000
archash=30a01a48a1 archash=2126b31154