Add Decay function to Objects.ocg\System.ocg

liquid_container
Armin Schäfer 2016-02-08 00:04:37 +01:00 committed by David Dormagen
parent 1ab375488f
commit 2893b22551
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
/**
Animals can use Decay() in their Death() function so they will slowly decay and spawn a few temporary flies.
*/
global func Decay()
{
AddEffect("Decaying", this, 1, 500);
if (!GBackSemiSolid())
{
var rnd = Random(4);
for (var i = 0; i < rnd; i++)
{
var mos = CreateObject(Mosquito);
ScheduleCall(mos, "RemoveObject", 9000 + Random(300));
}
}
}
global func FxDecayingTimer(object target)
{
if (target->GetCon() < 20)
target->RemoveObject();
else
target->DoCon(-5);
return true;
}