BulletType delayFrags workaround

This commit is contained in:
Anuken 2023-11-17 19:12:56 -05:00
parent 60c05587a7
commit 5d1ec319bc
3 changed files with 9 additions and 1 deletions

View File

@ -160,6 +160,8 @@ public class BulletType extends Content implements Cloneable{
/** Bullet type that is created when this bullet expires. */
public @Nullable BulletType fragBullet = null;
/** If true, frag bullets are delayed to the next frame. Fixes obscure bugs with piercing bullet types spawning frags immediately and screwing up the Damage temporary variables. */
public boolean delayFrags = false;
/** Degree spread range of fragmentation bullets. */
public float fragRandomSpread = 360f;
/** Uniform spread between each frag bullet in degrees. */
@ -446,7 +448,11 @@ public class BulletType extends Content implements Cloneable{
Effect.shake(hitShake, hitShake, b);
if(fragOnHit){
createFrags(b, x, y);
if(delayFrags && fragBullet != null && fragBullet.delayFrags){
Core.app.post(() -> createFrags(b, x, y));
}else{
createFrags(b, x, y);
}
}
createPuddles(b, x, y);
createIncend(b, x, y);

View File

@ -38,6 +38,7 @@ public class LaserBulletType extends BulletType{
hittable = false;
absorbable = false;
removeAfterPierce = false;
delayFrags = true;
}
public LaserBulletType(){

View File

@ -24,6 +24,7 @@ public class RailBulletType extends BulletType{
collides = false;
keepVelocity = false;
lifetime = 1f;
delayFrags = true;
}
@Override