OP4CTFRules: handle bots joining teams
This commit is contained in:
parent
5bb2984df5
commit
213aa0371f
2 changed files with 30 additions and 0 deletions
|
@ -23,6 +23,7 @@ class OP4CTFRules:HLMultiplayerRules
|
|||
virtual void PlayerDeath(NSClientPlayer);
|
||||
virtual void PlayerConnect(NSClientPlayer);
|
||||
virtual void PlayerDisconnect(NSClientPlayer);
|
||||
virtual bool ConsoleCommand(NSClientPlayer, string);
|
||||
|
||||
nonvirtual void CharacterSpawn(NSClientPlayer, string);
|
||||
nonvirtual void CaptureFlag(NSClientPlayer);
|
||||
|
|
|
@ -73,6 +73,35 @@ OP4CTFRules::PlayerSpawn(NSClientPlayer pp)
|
|||
CharacterSpawn(pp, pl.m_oldModel);
|
||||
}
|
||||
|
||||
void CSEv_TeamJoin_f(float);
|
||||
void CSEv_ClassJoin_f(float);
|
||||
|
||||
bool
|
||||
OP4CTFRules::ConsoleCommand(NSClientPlayer pp, string cmd)
|
||||
{
|
||||
static void OP4CTFRules_BotJoin(void) {
|
||||
float tag = (random() < 0.5) ? 1 : 2;
|
||||
CSEv_TeamJoin_f(tag);
|
||||
CSEv_ClassJoin_f(0);
|
||||
}
|
||||
|
||||
tokenize(cmd);
|
||||
|
||||
switch (argv(0)) {
|
||||
case "bot_add":
|
||||
entity bot_ent = Bot_AddQuick();
|
||||
if (bot_ent) {
|
||||
bot_ent.think = OP4CTFRules_BotJoin;
|
||||
bot_ent.nextthink = time;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return (false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
void
|
||||
OP4CTFRules::CharacterSpawn(NSClientPlayer playerEnt, string playerModel)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue