Unhardcode frag offsets (#9543)

This commit is contained in:
Elixias
2024-02-13 06:24:47 -07:00
committed by GitHub
parent 8f231febb8
commit 15f9854427

View File

@@ -174,6 +174,8 @@ public class BulletType extends Content implements Cloneable{
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f;
/** Random range of frag lifetime as a multiplier. */
public float fragLifeMin = 1f, fragLifeMax = 1f;
/** Random offset of frag bullets from the parent bullet. */
public float fragOffsetMin = 1f, fragOffsetMax = 7f;
/** Bullet that is created at a fixed interval. */
public @Nullable BulletType intervalBullet;
@@ -509,7 +511,7 @@ public class BulletType extends Content implements Cloneable{
public void createFrags(Bullet b, float x, float y){
if(fragBullet != null && (fragOnAbsorb || !b.absorbed)){
for(int i = 0; i < fragBullets; i++){
float len = Mathf.random(1f, 7f);
float len = Mathf.random(fragOffsetMin, fragOffsetMax);
float a = b.rotation() + Mathf.range(fragRandomSpread / 2) + fragAngle + ((i - fragBullets/2) * fragSpread);
fragBullet.create(b, x + Angles.trnsx(a, len), y + Angles.trnsy(a, len), a, Mathf.random(fragVelocityMin, fragVelocityMax), Mathf.random(fragLifeMin, fragLifeMax));
}