Exemplo n.º 1
0
/*
==================
BotMatch_GetFlag
==================
*/
void BotMatch_GetFlag(bot_state_t *bs, bot_match_t *match) {
	char netname[MAX_MESSAGE_SIZE];
	int client;

	if (gametype == GT_CTF) {
		if (!ctf_redflag.areanum || !ctf_blueflag.areanum)
			return;
	}
#ifdef MISSIONPACK
	else if (gametype == GT_1FCTF) {
		if (!ctf_neutralflag.areanum || !ctf_redflag.areanum || !ctf_blueflag.areanum)
			return;
	}
#endif
	else {
		return;
	}
	//if not addressed to this bot
	if (!BotAddressedToBot(bs, match)) return;
	//
	trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
	//
	client = FindClientByName(netname);
	//
	bs->decisionmaker = client;
	bs->ordered = qtrue;
	bs->order_time = FloatTime();
	//set the time to send a message to the team mates
	bs->teammessage_time = FloatTime() + 2 * random();
	//set the ltg type
	bs->ltgtype = LTG_GETFLAG;
	//set the team goal time
	bs->teamgoal_time = FloatTime() + CTF_GETFLAG_TIME;
	// get an alternate route in ctf
	if (gametype == GT_CTF) {
		//get an alternative route goal towards the enemy base
		BotGetAlternateRouteGoal(bs, BotOppositeTeam(bs));
	}
	//
	BotSetTeamStatus(bs);
	// remember last ordered task
	BotRememberLastOrderedTask(bs);
#ifdef DEBUG
	BotPrintTeamGoal(bs);
#endif //DEBUG
}
Exemplo n.º 2
0
/*
==================
BotVoiceChat_GetFlag
==================
*/
void
BotVoiceChat_GetFlag(bot_state_t * bs, int client, int mode)
{
  //
  if (gametype == GT_CTF)
  {
    if (!ctf_redflag.areanum || !ctf_blueflag.areanum)
      return;
  }
#ifdef MISSIONPACK
  else if (gametype == GT_1FCTF)
  {
    if (!ctf_neutralflag.areanum || !ctf_redflag.areanum
	|| !ctf_blueflag.areanum)
      return;
  }
#endif
  else
  {
    return;
  }
  //
  bs->decisionmaker = client;
  bs->ordered = qtrue;
  bs->order_time = FloatTime();
  //set the time to send a message to the team mates
  bs->teammessage_time = FloatTime() + 2 * random();
  //set the ltg type
  bs->ltgtype = LTG_GETFLAG;
  //set the team goal time
  bs->teamgoal_time = FloatTime() + CTF_GETFLAG_TIME;
  // get an alternate route in ctf
  if (gametype == GT_CTF)
  {
    //get an alternative route goal towards the enemy base
    BotGetAlternateRouteGoal(bs, BotOppositeTeam(bs));
  }
  //
  BotSetTeamStatus(bs);
  // remember last ordered task
  BotRememberLastOrderedTask(bs);
#ifdef DEBUG
  BotPrintTeamGoal(bs);
#endif //DEBUG
}