openclonk/planet/Objects.ocd/Effects.ocd/Flame.ocd/Script.c

43 lines
689 B
C
Raw Normal View History

/**
Flame
Spreads fire.
@author Maikel
*/
2011-09-18 08:59:38 +00:00
protected func Initialize()
2011-09-18 08:59:38 +00:00
{
Incinerate();
AddTimer("Burning");
return;
2011-09-18 08:59:38 +00:00
}
public func Burning()
2011-09-18 08:59:38 +00:00
{
// Split the flame if it is large enough.
if (GetCon() > 50 && !Random(3))
2011-09-18 08:59:38 +00:00
{
var x = Random(15);
var new_flame = CreateObjectAbove(GetID(), 0, 0, GetOwner());
new_flame->SetSpeed(x, -7);
new_flame->SetCon(GetCon() / 2);
2011-09-18 08:59:38 +00:00
SetSpeed(-x, -7);
SetCon(GetCon() / 2);
2011-09-18 08:59:38 +00:00
}
return;
}
// Don't incinerate twice in saved scenarios.
func SaveScenarioObject(props)
{
if (!inherited(props, ...)) return false;
props->Remove("Fire");
return true;
}
/*-- Properties --*/
local Name = "$Name$";
local Description = "$Description$";