forked from Mirrors/openclonk
Ignore SetAI(..., true) if an AI already exists
Can happen e.g. in multiplayer editingqteditor
parent
5a9e608f55
commit
656aa303f9
|
@ -20,9 +20,16 @@ static const AI_DefMaxAggroDistance = 200, // lose sight to target if it is this
|
|||
func SetAI(object clonk, bool has_ai)
|
||||
{
|
||||
if (has_ai)
|
||||
return AddAI(clonk);
|
||||
{
|
||||
// Only add if it doesn't have the effect yet
|
||||
var ai = GetAI(clonk);
|
||||
if (!ai) ai = AddAI(clonk);
|
||||
return ai;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RemoveEffect("AI", clonk);
|
||||
}
|
||||
}
|
||||
|
||||
// Add AI execution timer to target Clonk
|
||||
|
|
Loading…
Reference in New Issue