From a04b385f56efb8832319bcce982b4fab479b1876 Mon Sep 17 00:00:00 2001 From: Matthew Peng <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 29 Sep 2021 05:38:51 -0700 Subject: [PATCH] Fix spread + burst turrets (#6069) * Fix spread + burst turrets * spread is 4 by default set salvo spread to 0 * damnit --- core/src/mindustry/content/Blocks.java | 1 + core/src/mindustry/world/blocks/defense/turrets/Turret.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 295977b2ed..c2697d7487 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1675,6 +1675,7 @@ public class Blocks implements ContentList{ recoilAmount = 3f; shootShake = 1f; burstSpacing = 3f; + spread = 0f; shots = 4; ammoUseEffect = Fx.casing2; health = 240 * size * size; diff --git a/core/src/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/mindustry/world/blocks/defense/turrets/Turret.java index 99412528dc..fc64c37c7d 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java @@ -426,13 +426,14 @@ public class Turret extends ReloadTurret{ //when burst spacing is enabled, use the burst pattern }else if(burstSpacing > 0.0001f){ for(int i = 0; i < shots; i++){ + int ii = i; Time.run(burstSpacing * i, () -> { if(!isValid() || !hasAmmo()) return; recoil = recoilAmount; tr.trns(rotation, shootLength, Mathf.range(xRand)); - bullet(type, rotation + Mathf.range(inaccuracy)); + bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (ii - (int)(shots / 2f)) * spread); effects(); useAmmo(); recoil = recoilAmount;