Fixed #11636
This commit is contained in:
@@ -284,8 +284,6 @@ public class Turret extends ReloadTurret{
|
|||||||
public @Nullable float[] curRecoils;
|
public @Nullable float[] curRecoils;
|
||||||
public float shootWarmup, charge, warmupHold = 0f;
|
public float shootWarmup, charge, warmupHold = 0f;
|
||||||
public int totalShots, barrelCounter;
|
public int totalShots, barrelCounter;
|
||||||
public float excessReload = 0;
|
|
||||||
public int reloadShots = 0;
|
|
||||||
public boolean logicShooting = false;
|
public boolean logicShooting = false;
|
||||||
public @Nullable Posc target;
|
public @Nullable Posc target;
|
||||||
public Vec2 targetPos = new Vec2();
|
public Vec2 targetPos = new Vec2();
|
||||||
@@ -491,6 +489,8 @@ public class Turret extends ReloadTurret{
|
|||||||
shootWarmup = Mathf.lerpDelta(shootWarmup, warmupTarget, shootWarmupSpeed * (warmupTarget > 0 ? efficiency : 1f));
|
shootWarmup = Mathf.lerpDelta(shootWarmup, warmupTarget, shootWarmupSpeed * (warmupTarget > 0 ? efficiency : 1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wasShooting = false;
|
||||||
|
|
||||||
curRecoil = Mathf.approachDelta(curRecoil, 0, 1 / recoilTime);
|
curRecoil = Mathf.approachDelta(curRecoil, 0, 1 / recoilTime);
|
||||||
if(recoils > 0){
|
if(recoils > 0){
|
||||||
if(curRecoils == null) curRecoils = new float[recoils];
|
if(curRecoils == null) curRecoils = new float[recoils];
|
||||||
@@ -523,11 +523,8 @@ public class Turret extends ReloadTurret{
|
|||||||
if(reloadWhileCharging || !charging()){
|
if(reloadWhileCharging || !charging()){
|
||||||
updateReload();
|
updateReload();
|
||||||
updateCooling();
|
updateCooling();
|
||||||
capReload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wasShooting = false;
|
|
||||||
|
|
||||||
if(state.rules.fog){
|
if(state.rules.fog){
|
||||||
float newRange = hasAmmo() ? peekAmmo().rangeChange : 0f;
|
float newRange = hasAmmo() ? peekAmmo().rangeChange : 0f;
|
||||||
if(newRange != lastRangeChange){
|
if(newRange != lastRangeChange){
|
||||||
@@ -694,30 +691,11 @@ public class Turret extends ReloadTurret{
|
|||||||
return queuedBullets > 0 && shoot.firstShotDelay > 0;
|
return queuedBullets > 0 && shoot.firstShotDelay > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canReload(){
|
|
||||||
//keep reloading as the turret keeps shooting
|
|
||||||
return reloadShots < 1 || wasShooting;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateReload(){
|
protected void updateReload(){
|
||||||
if(!canReload()) return;
|
|
||||||
reloadCounter += delta() * ammoReloadMultiplier() * baseReloadSpeed();
|
reloadCounter += delta() * ammoReloadMultiplier() * baseReloadSpeed();
|
||||||
}
|
|
||||||
|
|
||||||
protected void capReload(){
|
//cap reload for visual reasons
|
||||||
//cap reload for visual reasons, need to store the excess reload to keep the firerate consistent
|
|
||||||
if(canReload() && reloadCounter >= reload){
|
|
||||||
reloadShots += (int)(reloadCounter / reload);
|
|
||||||
excessReload += reloadCounter % reload;
|
|
||||||
}
|
|
||||||
reloadCounter = Math.min(reloadCounter, reload);
|
reloadCounter = Math.min(reloadCounter, reload);
|
||||||
reloadShots = Math.min(reloadShots, 5);
|
|
||||||
|
|
||||||
if(!wasShooting){
|
|
||||||
reloadShots = 0;
|
|
||||||
excessReload = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -727,14 +705,12 @@ public class Turret extends ReloadTurret{
|
|||||||
|
|
||||||
protected void updateShooting(){
|
protected void updateShooting(){
|
||||||
|
|
||||||
if(reloadShots > 0 && !charging() && shootWarmup >= minWarmup){
|
if(reloadCounter >= reload && !charging() && shootWarmup >= minWarmup){
|
||||||
BulletType type = peekAmmo();
|
BulletType type = peekAmmo();
|
||||||
|
|
||||||
shoot(type);
|
shoot(type);
|
||||||
|
|
||||||
reloadCounter = excessReload;
|
reloadCounter %= reload;
|
||||||
excessReload = 0;
|
|
||||||
reloadShots--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ platforms.each{ platform ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//packr is broken and won't let me add one hyphen,so I have to do that myself later
|
//packr is broken and won't let me add one hyphen, so I have to do that myself later
|
||||||
outputJsonFile.text = outputJsonFile.text.replace("-enable-native-access=ALL-UNNAMED", "--enable-native-access=ALL-UNNAMED")
|
outputJsonFile.text = outputJsonFile.text.replace("-enable-native-access=ALL-UNNAMED", "--enable-native-access=ALL-UNNAMED")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user