//=============================================================================
// UseTriggerSE: prevents message spamming and using by monsters
//=============================================================================
class UseTriggerSE extends UseTrigger;

var(UseTrigger) float MessageCooldown;
var(UseTrigger) bool bAllowUsingByAI;
var transient float NextMessageTime;

function bool SelfTriggered()
{
	return true;
}

function UsedBy( Pawn user )
{
	TriggerEvent(Event, self, user);
}

function Touch( Actor Other )
{
	if ( Pawn(Other) != None ) {
	    // Send a string message to the toucher.
	    if( Message != ""  && Level.TimeSeconds > NextMessageTime ) {
		    Pawn(Other).ClientMessage( Message );
            NextMessageTime = Level.TimeSeconds + MessageCooldown;
        }

		if ( bAllowUsingByAI && AIController(Pawn(Other).Controller) != None )
			UsedBy(Pawn(Other));
	}
}

defaultproperties
{
     MessageCooldown=5.000000
     Texture=Texture'Engine.SubActionTrigger'
}
