Make sure LargeCaveMushroom does not burn forever

stable-5.4
Maikel de Vries 2014-02-22 15:08:05 +01:00
parent 1066c4a4b3
commit df1d93992f
1 changed files with 29 additions and 0 deletions

View File

@ -135,10 +135,39 @@ func Damage()
{
SetClrModulation(RGB(100, 100, 100));
RemoveTimer("Growing");
if (GetDamage() > 3 * MaxDamage())
BurstIntoAshes();
return;
}
}
func BurstIntoAshes()
{
var particles =
{
Prototype = Particles_Dust(),
R = 50, G = 50, B = 50,
Size = PV_KeyFrames(0, 0, 0, 200, PV_Random(2, 10), 1000, 0),
};
var r = GetR();
var size = GetCon() * 110 / 100;
for(var cnt = 0; cnt < 10; ++cnt)
{
var distance = Random(size/2);
var x = Sin(r, distance);
var y = -Cos(r, distance);
for(var mirror = -1; mirror <= 1; mirror += 2)
{
CreateParticle("Dust", x * mirror, y * mirror, PV_Random(-3, 3), PV_Random(-3, -3), PV_Random(18, 1 * 36), particles, 2);
CastPXS("Ashes", 5, 30, x * mirror, y * mirror);
}
}
RemoveObject();
}
// called from the plant library
func Seed()
{