forked from Mirrors/openclonk
improve friendly fire rule to allow inclusion of objects
parent
d1c0750095
commit
1f5f34b559
|
@ -10,6 +10,8 @@ public func Construction()
|
|||
{
|
||||
SetAction("Fly");
|
||||
SetComDir(COMD_None);
|
||||
// Notify friendly fire rule.
|
||||
GameCallEx("OnCreationRuleNoFF", this);
|
||||
// Add flight effects.
|
||||
CreateEffect(FxFlightRotation, 100, 1);
|
||||
CreateEffect(FxFlight, 100, 10);
|
||||
|
@ -145,6 +147,12 @@ private func DoFireworks(int killed_by)
|
|||
return;
|
||||
}
|
||||
|
||||
public func Destruction()
|
||||
{
|
||||
// Notify friendly fire rule.
|
||||
GameCallEx("OnDestructionRuleNoFF", this);
|
||||
}
|
||||
|
||||
public func HasNoNeedForAI() { return true; }
|
||||
|
||||
|
||||
|
@ -166,3 +174,4 @@ local Name = "$Name$";
|
|||
local Description = "$Description$";
|
||||
local ContactCalls = true;
|
||||
local FlySpeed = 100;
|
||||
local HasNoFriendlyFire = true;
|
||||
|
|
|
@ -14,7 +14,7 @@ public func Initialize()
|
|||
return;
|
||||
|
||||
// Find all crew members and protect them from friendly fire.
|
||||
for (var crew in FindObjects(Find_OCF(OCF_CrewMember)))
|
||||
for (var crew in FindObjects(Find_Or(Find_OCF(OCF_CrewMember), Find_Property("HasNoFriendlyFire"))))
|
||||
DisableFriendlyFire(crew);
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public func Destruction()
|
|||
return;
|
||||
|
||||
// Find all crew members and allow friendly fire.
|
||||
for (var crew in FindObjects(Find_OCF(OCF_CrewMember)))
|
||||
for (var crew in FindObjects(Find_Or(Find_OCF(OCF_CrewMember), Find_Property("HasNoFriendlyFire"))))
|
||||
EnableFriendlyFire(crew);
|
||||
return;
|
||||
}
|
||||
|
@ -37,6 +37,12 @@ public func OnClonkRecruitment(object clonk, int plr)
|
|||
return;
|
||||
}
|
||||
|
||||
public func OnCreationRuleNoFF(object obj)
|
||||
{
|
||||
DisableFriendlyFire(obj);
|
||||
return;
|
||||
}
|
||||
|
||||
public func OnClonkDerecruitment(object clonk, int plr)
|
||||
{
|
||||
EnableFriendlyFire(clonk);
|
||||
|
@ -49,6 +55,12 @@ public func OnClonkDeath(object clonk, int killed_by)
|
|||
return;
|
||||
}
|
||||
|
||||
public func OnDestructionRuleNoFF(object obj)
|
||||
{
|
||||
EnableFriendlyFire(obj);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*-- Friendly Fire --*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue