mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-19 16:57:15 +07:00
changes (#7089)
* a * i guess so * despawnUnitCount, which i forgot to include * changes + despawnUnitRadius field * enter? * no * can you not
This commit is contained in:
parent
a5cb7b09eb
commit
1c1b1295d1
@ -143,3 +143,4 @@ BlueWolf
|
||||
[Error_27]
|
||||
code-explorer786
|
||||
KayAyeAre
|
||||
SMOLKEYS
|
@ -188,6 +188,8 @@ public class BulletType extends Content implements Cloneable{
|
||||
public @Nullable UnitType despawnUnit;
|
||||
/** Amount of units spawned when this bullet despawns. */
|
||||
public int despawnUnitCount = 1;
|
||||
/** Random offset distance from the original bullet despawn/hit coordinate. */
|
||||
public float despawnUnitRadius = 0.1f;
|
||||
|
||||
/** Color of trail behind bullet. */
|
||||
public Color trailColor = Pal.missileYellowBack;
|
||||
@ -377,6 +379,7 @@ public class BulletType extends Content implements Cloneable{
|
||||
}
|
||||
createPuddles(b, x, y);
|
||||
createIncend(b, x, y);
|
||||
createUnits(b, x, y);
|
||||
|
||||
if(suppressionRange > 0){
|
||||
//bullets are pooled, require separate Vec2 instance
|
||||
@ -436,23 +439,26 @@ public class BulletType extends Content implements Cloneable{
|
||||
}
|
||||
}
|
||||
|
||||
public void createUnits(Bullet b, float x, float y){
|
||||
if(despawnUnit != null){
|
||||
for(int i = 0; i < despawnUnitCount; i++){
|
||||
despawnUnit.spawn(b.team, x + Mathf.range(despawnUnitRadius), y + Mathf.range(despawnUnitRadius));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when the bullet reaches the end of its lifetime or is destroyed by something external. */
|
||||
public void despawned(Bullet b){
|
||||
if(despawnHit){
|
||||
hit(b);
|
||||
}else{
|
||||
createUnits(b, b.x, b.y);
|
||||
}
|
||||
|
||||
if(!fragOnHit){
|
||||
createFrags(b, b.x, b.y);
|
||||
}
|
||||
|
||||
if(despawnUnit != null){
|
||||
for(int i = 0; i < despawnUnitCount; i++){
|
||||
despawnUnit.spawn(b.team, b.x + Mathf.range(0.1f), b.y);
|
||||
}
|
||||
}
|
||||
|
||||
despawnEffect.at(b.x, b.y, b.rotation(), hitColor);
|
||||
despawnSound.at(b);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user