From 4cb3bef1a7cf651f8c0d67d6759c79d8f8d6fdaf Mon Sep 17 00:00:00 2001 From: Matthew Peng <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 14 Sep 2021 11:24:19 -0700 Subject: [PATCH] Parentize Vela and Corvus shoot effects (#5997) --- core/src/mindustry/content/Fx.java | 4 ++-- core/src/mindustry/content/UnitTypes.java | 2 ++ core/src/mindustry/type/Weapon.java | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 1a07adb56f..6a7f67ef7a 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -362,13 +362,13 @@ public class Fx{ Fill.circle(e.x, e.y, e.fin() * 10); Drawf.light(e.x, e.y, e.fin() * 20f, Pal.heal, 0.7f); - }), + }).followParent(true), greenLaserChargeSmall = new Effect(40f, 100f, e -> { color(Pal.heal); stroke(e.fin() * 2f); Lines.circle(e.x, e.y, e.fout() * 50f); - }), + }).followParent(true), greenCloud = new Effect(80f, e -> { color(Pal.heal); diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 4968177e84..89aad70b9e 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -446,6 +446,7 @@ public class UnitTypes implements ContentList{ x = y = 0f; firstShotDelay = Fx.greenLaserChargeSmall.lifetime - 1f; + parentizeEffects = true; reload = 155f; recoil = 0f; @@ -535,6 +536,7 @@ public class UnitTypes implements ContentList{ shootStatusDuration = 60f * 2f; shootStatus = StatusEffects.unmoving; firstShotDelay = Fx.greenLaserCharge.lifetime; + parentizeEffects = true; bullet = new LaserBulletType(){{ length = 460f; diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index d3a29943bb..f72e60f3a3 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -91,6 +91,8 @@ public class Weapon implements Cloneable{ public boolean ignoreRotation = false; /** min velocity required for this weapon to shoot */ public float minShootVelocity = -1f; + /** should the shoot effects follow the unit (effects need followParent set to true for this to work) */ + public boolean parentizeEffects; /** internal value used for alternation - do not change! */ public int otherSide = -1; /** sound used for shooting */ @@ -333,7 +335,7 @@ public class Weapon implements Cloneable{ Angles.shotgun(shots, spacing, rotation, f -> mount.bullet = bullet(unit, shootX, shootY, f + Mathf.range(inaccuracy), lifeScl)); } - boolean parentize = ammo.keepVelocity; + boolean parentize = ammo.keepVelocity || parentizeEffects; if(delay){ Time.run(firstShotDelay, () -> {