// Proceeds if given actor count is in defined range
class ACTION_IfActorCount extends ScriptedAction;

var(Action) class<Actor> ActorClass;
var(Action) name ActorTag;
var(Action) int MinCount;
var(Action) int MaxCount;


function ProceedToNextAction(ScriptedController C)
{
	local Actor Other;
	local int ActorCount;
	
	C.ActionNum += 1;

	foreach C.DynamicActors(ActorClass, Other, ActorTag)
		ActorCount++;
		
	if ( ActorCount < MinCount || (MaxCount != 0 && ActorCount > MaxCount) )
		ProceedToSectionEnd(C);
}

function bool StartsSection()
{
	return true;
}

function string GetActionString()
{
	if ( MaxCount == 0 )
		return ActionString $ " > " $ MinCount;
	return ActionString @ "["$MinCount$".."$MaxCount$"]";
}

defaultproperties
{
     ActionString="If actor count"
}
