Fix negative recoil (#6107)

This commit is contained in:
Matthew Peng 2021-10-05 20:05:33 -07:00 committed by GitHub
parent df5c31a0e7
commit a4963f351d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,7 +200,7 @@ public class Weapon implements Cloneable{
boolean can = unit.canShoot();
float lastReload = mount.reload;
mount.reload = Math.max(mount.reload - Time.delta * unit.reloadMultiplier, 0);
mount.recoil = Math.max(mount.recoil - (Time.delta * recoil * unit.reloadMultiplier) / recoilTime, 0);
mount.recoil = Mathf.approachDelta(mount.recoil, 0, (recoil * unit.reloadMultiplier) / recoilTime);
//rotate if applicable
if(rotate && (mount.rotate || mount.shoot) && can){