Here's the stock Aircraft.doExplosion() method. Pretty basic! It calls just the one and same method for each of water crashes, land crashes and air explosions. (For the surface crashes, they're considered to be so when the plane's position has it no farther above the surface than 1/2 the plane's length as specified in the FM. Any higher and the air explosion effect set is utilized.)
protected void doExplosion()
{
if(FM.Loc.z < Engine.cur.land.HQ_Air(FM.Loc.x, FM.Loc.y) + (double)(FM.Length / 2.0F))
{
World.cur();
if(World.land().isWater(FM.Loc.x, FM.Loc.y))
Explosions.AirDrop_Water(FM.Loc);
else
Explosions.AirDrop_Land(FM.Loc);
} else
{
Explosions.ExplodeFuel(FM.Loc);
}
}
Here's the current state of the new treatment. It utilizes new methods elsewhere, such as in Explosions.class. I should point out that not just these new explosions are part of the new treatement. The 'basic' crash effects have variation as well, based on the number of engines (as a measure of size) and with some randomness.
protected void doExplosion()
{
Vector3d vector3d = new Vector3d();
vector3d.set(FM.Vwld);
if(FM.Loc.z < Engine.cur.land.HQ_Air(FM.Loc.x, FM.Loc.y) + (double)(FM.Length / 2.0F))
{
iEng = FM.EI.getNum();
iExplode = 0;
World.cur();
if(World.land().isWater(FM.Loc.x, FM.Loc.y))
{
if(FM.CT.getWeaponMass() > 10F)
{
if(FM.CT.getWeaponMass() > 500F)
{
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB1000a_Object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 1000F, 500F, 1, 200F);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmo(FM.Loc, 2);
iExplode = 2;
}
}
else
if(FM.CT.getWeaponMass() > 100F)
{
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmo(FM.Loc, 2);
iExplode = 2;
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 2);
iExplode = 1;
}
}
else
{
if(TrueRandom.nextFloat() < 0.5F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 2);
iExplode = 1;
}
}
}
else
{
if(iEng > 1 && TrueRandom.nextFloat() < 0.25F)
{
if(TrueRandom.nextFloat() < 0.1F + cvt((float) vector3d.z, -10F, -50F, 0F, 0.15F))
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
else
if(TrueRandom.nextFloat() < 0.3F)
{
Explosions.ExplodeAmmo(FM.Loc, 2);
iExplode = 2;
}
else
{
Explosions.ExplodeAmmoSmall(FM.Loc, 2);
iExplode = 1;
}
}
if(iEng == 1 && TrueRandom.nextFloat() < 0.2F)
{
if(TrueRandom.nextFloat() < 0.1F + cvt((float) vector3d.z, -20F, -75F, 0F, 0.1F))
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
else
if(TrueRandom.nextFloat() < 0.5F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 2);
iExplode = 1;
}
}
}
Explosions.AirDrop_Water(FM.Loc, iEng, iExplode);
}
else //if land =========================================================================
{
if(FM.CT.getWeaponMass() > 10F)
{
if(FM.CT.getWeaponMass() > 500F)
{
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB1000a_Land(FM.Loc, 4.0F, 1.0F, false, true);
MsgExplosion.send(null, null, FM.Loc, null, 1000F, 500F, 1, 200F);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB250_Land(FM.Loc, 4.0F, 1.0F, false, true);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmo(FM.Loc, 0);
iExplode = 2;
}
}
else
if(FM.CT.getWeaponMass() > 100F)
{
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB250_Land(FM.Loc, 4.0F, 1.0F, false, true);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmo(FM.Loc, 0);
iExplode = 2;
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 0);
iExplode = 1;
}
}
else
{
if(TrueRandom.nextFloat() < 0.5F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 0);
iExplode = 1;
}
}
}
else
{
if(iEng > 1 && TrueRandom.nextFloat() < 0.25F)
{
if(TrueRandom.nextFloat() < 0.2F + cvt((float) vector3d.z, -10F, -50F, 0F, 0.3F))
{
Explosions.BOMB250_Land(FM.Loc, 4.0F, 1.0F, false, true);
}
else
if(TrueRandom.nextFloat() < 0.3F)
{
Explosions.ExplodeAmmo(FM.Loc, 0);
iExplode = 2;
}
else
{
Explosions.ExplodeAmmoSmall(FM.Loc, 0);
iExplode = 1;
}
}
if(iEng == 1 && TrueRandom.nextFloat() < 0.2F)
{
if(TrueRandom.nextFloat() < 0.2F + cvt((float) vector3d.z, -20F, -75F, 0F, 0.3F))
{
Explosions.BOMB250_Land(FM.Loc, 4.0F, 1.0F, false, true);
}
else
if(TrueRandom.nextFloat() < 0.5F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 0);
iExplode = 1;
}
}
}
Explosions.AirDrop_Land(FM.Loc, iEng, iExplode);
}
} else
{
Explosions.ExplodeFuel(FM.Loc, iEng);
if(FM.CT.getWeaponMass() > 500F && TrueRandom.nextFloat() < 0.2F)
{
Explosions.BOMB1000a_Object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 1000F, 500F, 1, 200F);
}
else
if(FM.CT.getWeaponMass() > 100F && TrueRandom.nextFloat() < 0.2F)
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
}
}