forked from Mirrors/openclonk
flame: option to make eternal for editor mode
parent
f81d41ba84
commit
6efb292fa7
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
protected func Initialize()
|
public func Initialize()
|
||||||
{
|
{
|
||||||
Incinerate(100, GetController());
|
Incinerate(100, GetController());
|
||||||
AddTimer("Burning", RandomX(24, 26));
|
AddTimer("Burning", RandomX(24, 26));
|
||||||
|
@ -15,16 +15,20 @@ protected func Initialize()
|
||||||
|
|
||||||
public func Burning()
|
public func Burning()
|
||||||
{
|
{
|
||||||
if (!OnFire()) return RemoveObject();
|
if (!OnFire())
|
||||||
|
return RemoveObject();
|
||||||
// Consume inflammable material and make the flame a little bigger.
|
// Consume inflammable material and make the flame a little bigger.
|
||||||
if (FlameConsumeMaterial() && GetCon() <= 80)
|
if (FlameConsumeMaterial() && GetCon() <= 80)
|
||||||
{
|
{
|
||||||
DoCon(6);
|
if (!this.NoBurnDecay)
|
||||||
SetXDir(RandomX(-8, 8));
|
{
|
||||||
|
DoCon(6);
|
||||||
|
SetXDir(RandomX(-8, 8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Split the flame if it is large enough and not too many flames are nearby.
|
// Split the flame if it is large enough and not too many flames are nearby.
|
||||||
var amount = ObjectCount(Find_ID(GetID()), Find_Distance(10));
|
var amount = ObjectCount(Find_ID(GetID()), Find_Distance(10));
|
||||||
if (amount < 5 && GetCon() > 50 && !Random(4))
|
if (amount < 5 && GetCon() > 50 && !this.NoBurnDecay && !Random(4))
|
||||||
{
|
{
|
||||||
var x = Random(15);
|
var x = Random(15);
|
||||||
var new_flame = CreateObjectAbove(GetID());
|
var new_flame = CreateObjectAbove(GetID());
|
||||||
|
@ -36,17 +40,59 @@ public func Burning()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't incinerate twice in saved scenarios.
|
public func DoCon(...)
|
||||||
func SaveScenarioObject(props)
|
|
||||||
{
|
{
|
||||||
if (!inherited(props, ...)) return false;
|
var res = _inherited(...);
|
||||||
|
// Update any existing fire effect, because it does not do it internally when NoBurnDecay is active.
|
||||||
|
var fire_fx = GetEffect("Fire", this);
|
||||||
|
if (fire_fx)
|
||||||
|
EffectCall(this, fire_fx, "UpdateEffectProperties");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public func SetCon(...)
|
||||||
|
{
|
||||||
|
var res = _inherited(...);
|
||||||
|
// Update any existing fire effect, because it does not do it internally when NoBurnDecay is active.
|
||||||
|
var fire_fx = GetEffect("Fire", this);
|
||||||
|
if (fire_fx)
|
||||||
|
EffectCall(this, fire_fx, "UpdateEffectProperties");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-- Saving --*/
|
||||||
|
|
||||||
|
public func SaveScenarioObject(proplist props)
|
||||||
|
{
|
||||||
|
if (!inherited(props, ...))
|
||||||
|
return false;
|
||||||
|
// Don't incinerate twice in saved scenarios.
|
||||||
props->Remove("Fire");
|
props->Remove("Fire");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-- Editor --*/
|
||||||
|
|
||||||
|
public func EditorInitialize()
|
||||||
|
{
|
||||||
|
// Assume the flame is eternal when placed in the editor
|
||||||
|
this.NoBurnDecay = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public func Definition(proplist def)
|
||||||
|
{
|
||||||
|
if (!def.EditorProps)
|
||||||
|
def.EditorProps = {};
|
||||||
|
def.EditorProps.NoBurnDecay = { Name = "$EditorEternal$", EditorHelp = "$EditorEternalHelp$", Type = "enum", Options = [{ Name = "$EditorEternalOff$", Value = false }, { Name = "$EditorEternalOn$", Value = true }] };
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-- Properties --*/
|
/*-- Properties --*/
|
||||||
|
|
||||||
local Name = "$Name$";
|
local Name = "$Name$";
|
||||||
local Description = "$Description$";
|
local Description = "$Description$";
|
||||||
local Plane = 500;
|
local Plane = 500;
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
Name=Flamme
|
Name=Flamme
|
||||||
Description=Brennt.
|
Description=Brennt.
|
||||||
|
EditorEternal=Eternal
|
||||||
|
EditorEternalHelp=When active this flame burns eternally.
|
||||||
|
EditorEternalOn=Eternal
|
||||||
|
EditorEternalOff=Finite
|
|
@ -1,2 +1,6 @@
|
||||||
Name=Flame
|
Name=Flame
|
||||||
Description=Burning.
|
Description=Burning.
|
||||||
|
EditorEternal=Eternal
|
||||||
|
EditorEternalHelp=When active this flame burns eternally.
|
||||||
|
EditorEternalOn=Eternal
|
||||||
|
EditorEternalOff=Finite
|
Loading…
Reference in New Issue