/*
==============================================================================

BOT EXTENSIONS

==============================================================================
*/

// Prototypes

void	()		bot_counter_use;
void	()		bot_trigger_onlyregistered_touch;


void() bot_counter_use =
{
	local string junk;

	self.count = self.count - 1;
	if (self.count < 0)
		return;
	
	if (self.count != 0)
	{
		if ((self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
		{
			sprint (other.owner, "Incoming message from bot:\n");
			if (self.count >= 4)
				centerprint (activator.owner, "There are more to go...");
			else if (self.count == 3)
				centerprint (activator.owner, "Only 3 more to go...");
			else if (self.count == 2)
				centerprint (activator.owner, "Only 2 more to go...");
			else
				centerprint (activator.owner, "Only 1 more to go...");
		}
		return;
	}
	
// New code
	if ((self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
	{
		sprint (other.owner, "Incoming message from bot:\n");
		centerprint(activator.owner, "Sequence completed!");
	}
	self.enemy = activator;
	multi_trigger ();
};


void() bot_trigger_onlyregistered_touch =
{
	if (self.attack_finished > time)
		return;

	self.attack_finished = time + 2;
	if (cvar("registered"))
	{
		self.message = "";
		SUB_UseTargets ();
		remove (self);
	}
	else
	{
		if (self.message != "")
		{
			sprint (other.owner, "Incoming message from bot:\n");
			centerprint (other.owner, self.message);
			sound (other.owner, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
		}
	}
};

