diff --git a/core/src/mindustry/entities/effect/ParticleEffect.java b/core/src/mindustry/entities/effect/ParticleEffect.java index 477e52e19a..7fedbe189e 100644 --- a/core/src/mindustry/entities/effect/ParticleEffect.java +++ b/core/src/mindustry/entities/effect/ParticleEffect.java @@ -32,6 +32,8 @@ public class ParticleEffect extends Effect{ public float spin = 0f; /** Controls the initial and final sprite sizes. */ public float sizeFrom = 2f, sizeTo = 0f; + /** Whether the rotation adds with the parent */ + public boolean useRotation = true; /** Rotation offset. */ public float offset = 0; /** Sprite to draw. */ @@ -53,10 +55,11 @@ public class ParticleEffect extends Effect{ public void render(EffectContainer e){ if(tex == null) tex = Core.atlas.find(region); + float realRotation = (useRotation ? e.rotation : baseRotation); float rawfin = e.fin(); float fin = e.fin(interp); float rad = sizeInterp.apply(sizeFrom, sizeTo, rawfin) * 2; - float ox = e.x + Angles.trnsx(e.rotation, offsetX, offsetY), oy = e.y + Angles.trnsy(e.rotation, offsetX, offsetY); + float ox = e.x + Angles.trnsx(realRotation, offsetX, offsetY), oy = e.y + Angles.trnsy(realRotation, offsetX, offsetY); Draw.color(colorFrom, colorTo, fin); Color lightColor = this.lightColor == null ? Draw.getColor() : this.lightColor; @@ -68,7 +71,7 @@ public class ParticleEffect extends Effect{ rand.setSeed(e.id); for(int i = 0; i < particles; i++){ float l = length * fin + baseLength; - rv.trns(e.rotation + rand.range(cone), !randLength ? l : rand.random(l)); + rv.trns(realRotation + rand.range(cone), !randLength ? l : rand.random(l)); float x = rv.x, y = rv.y; Lines.lineAngle(ox + x, oy + y, Mathf.angle(x, y), len); @@ -78,10 +81,10 @@ public class ParticleEffect extends Effect{ rand.setSeed(e.id); for(int i = 0; i < particles; i++){ float l = length * fin + baseLength; - rv.trns(e.rotation + rand.range(cone), !randLength ? l : rand.random(l)); + rv.trns(realRotation + rand.range(cone), !randLength ? l : rand.random(l)); float x = rv.x, y = rv.y; - Draw.rect(tex, ox + x, oy + y, rad, rad, e.rotation + offset + e.time * spin); + Draw.rect(tex, ox + x, oy + y, rad, rad, realRotation + offset + e.time * spin); Drawf.light(ox + x, oy + y, rad * lightScl, lightColor, lightOpacity * Draw.getColor().a); } }