From ad856dcb8b48bda4711c80a363b1cf0f5d341c6b Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:21:55 -0700 Subject: [PATCH] Less cursed shenanigans --- src/progressed/content/bullets/PMBullets.java | 20 +------------------ .../entities/effect/RepeatEffect.java | 14 ++++--------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/progressed/content/bullets/PMBullets.java b/src/progressed/content/bullets/PMBullets.java index f20064b1..baccd642 100644 --- a/src/progressed/content/bullets/PMBullets.java +++ b/src/progressed/content/bullets/PMBullets.java @@ -2,7 +2,6 @@ import arc.graphics.*; import blackhole.entities.bullet.*; -import blackhole.entities.effect.SwirlEffect.*; import mindustry.content.*; import mindustry.entities.bullet.*; import mindustry.entities.effect.*; @@ -117,24 +116,7 @@ public static void load(){ float life = EnergyFx.kugelblitzGrow.lifetime; chargeEffect = new MultiEffect( new WrapEffect( - new RepeatEffect(EnergyFx.kugelblitzCharge, (life - EnergyFx.kugelblitzCharge.lifetime - 1f) / times, times){ - @Override - protected void add(float x, float y, float rotation, Color color, Object data){ - var entity = BlackHoleEffectState.create(); - entity.effect = this; - entity.rotation = baseRotation + rotation; - entity.data = data; - entity.lifetime = lifetime; - entity.set(x, y); - entity.color.set(color); - if(followParent && data instanceof Posc p){ - entity.parent = p; - entity.rotWithParent = rotWithParent; - } - entity.add(); - } - }.followParent(true).rotWithParent(true), - Color.black, 48f + new RepeatEffect(EnergyFx.kugelblitzCharge, (life - EnergyFx.kugelblitzCharge.lifetime - 1f) / times, times), Color.black, 48f ), EnergyFx.kugelblitzGrow ); diff --git a/src/progressed/entities/effect/RepeatEffect.java b/src/progressed/entities/effect/RepeatEffect.java index f69ef3b0..95184b05 100644 --- a/src/progressed/entities/effect/RepeatEffect.java +++ b/src/progressed/entities/effect/RepeatEffect.java @@ -1,6 +1,7 @@ package progressed.entities.effect; -import arc.graphics.g2d.*; +import arc.graphics.*; +import arc.util.*; import mindustry.entities.*; public class RepeatEffect extends Effect{ @@ -21,16 +22,9 @@ public void init(){ } @Override - public void render(EffectContainer e){ - var cont = e.inner(); - float life = e.time; + public void create(float x, float y, float rotation, Color color, Object data){ for(int i = 0; i < times; i++){ - float del = i * interval; - if(life > del && life <= del + effect.lifetime){ - cont.set(e.id + i, e.color, life - del, effect.lifetime, e.rotation, e.x, e.y, e.data); - Draw.z(effect.layer); - effect.render(cont); - } + Time.run(i * interval, () -> effect.create(x, y, rotation, color, data)); } } }