From e3b0614afc21cbafb3fc7bea5d9b67b4a6fccecf Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 9 Oct 2025 13:44:29 -0400 Subject: [PATCH] v3.3.0: improved how Goo's sprite emitters handle Goo being pushed --- .../sprites/GooSprite.java | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java index e364856d2..b089f00c9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java @@ -43,6 +43,9 @@ public class GooSprite extends MobSprite { private Animation pumpAttack; private Emitter spray; + + private int pumpUpEmitterDist = 0; + private int lastPumpUpPos = -1; private ArrayList pumpUpEmitters = new ArrayList<>(); public GooSprite() { @@ -88,20 +91,27 @@ public class GooSprite extends MobSprite { } public void pumpUp( int warnDist ) { - if (warnDist == 0){ - clearEmitters(); - } else { + pumpUpEmitterDist = warnDist; + if (warnDist > 0){ play(pump); Sample.INSTANCE.play( Assets.Sounds.CHARGEUP, 1f, warnDist == 1 ? 0.8f : 1f ); - if (ch.fieldOfView == null || ch.fieldOfView.length != Dungeon.level.length()){ + } + updateEmitters(); + } + + public void updateEmitters( ){ + clearEmitters(); + if (pumpUpEmitterDist > 0 && ch != null) { + lastPumpUpPos = ch.pos; + if (ch.fieldOfView == null || ch.fieldOfView.length != Dungeon.level.length()) { ch.fieldOfView = new boolean[Dungeon.level.length()]; - Dungeon.level.updateFieldOfView( ch, ch.fieldOfView ); + Dungeon.level.updateFieldOfView(ch, ch.fieldOfView); } - for (int i = 0; i < Dungeon.level.length(); i++){ + for (int i = 0; i < Dungeon.level.length(); i++) { if (ch.fieldOfView != null && ch.fieldOfView[i] - && Dungeon.level.distance(i, ch.pos) <= warnDist - && new Ballistica( ch.pos, i, Ballistica.STOP_TARGET | Ballistica.STOP_SOLID | Ballistica.IGNORE_SOFT_SOLID).collisionPos == i - && new Ballistica( i, ch.pos, Ballistica.STOP_TARGET | Ballistica.STOP_SOLID | Ballistica.IGNORE_SOFT_SOLID).collisionPos == ch.pos){ + && Dungeon.level.distance(i, ch.pos) <= pumpUpEmitterDist + && new Ballistica(ch.pos, i, Ballistica.STOP_TARGET | Ballistica.STOP_SOLID | Ballistica.IGNORE_SOFT_SOLID).collisionPos == i + && new Ballistica(i, ch.pos, Ballistica.STOP_TARGET | Ballistica.STOP_SOLID | Ballistica.IGNORE_SOFT_SOLID).collisionPos == ch.pos) { Emitter e = CellEmitter.get(i); e.pour(GooParticle.FACTORY, 0.04f); pumpUpEmitters.add(e); @@ -122,6 +132,7 @@ public class GooSprite extends MobSprite { e.burst(ElmoParticle.FACTORY, 10); } Sample.INSTANCE.play( Assets.Sounds.BURNING ); + pumpUpEmitterDist = 0; pumpUpEmitters.clear(); } @@ -130,6 +141,7 @@ public class GooSprite extends MobSprite { @Override public void play(Animation anim) { if (anim != pump && anim != pumpAttack){ + pumpUpEmitterDist = 0; clearEmitters(); } super.play(anim); @@ -151,6 +163,9 @@ public class GooSprite extends MobSprite { spray.pos(center()); spray.visible = visible; } + if (pumpUpEmitterDist > 0 && ch != null && ch.pos != lastPumpUpPos){ + updateEmitters(); + } } public static class GooParticle extends PixelParticle.Shrinking {