Skip to content

Commit f25c455

Browse files
committed
Update asw_concommands.cpp
1 parent f1ed077 commit f25c455

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

src/game/server/swarm/asw_concommands.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,36 @@ void rd_addbotf(const CCommand &args)
681681
}
682682
}
683683
}
684-
ConCommand rd_botadd("rd_botadd", rd_addbotf, "Adds a bot by index from 1 to 8, where index is the character of bot", FCVAR_NONE);
684+
ConCommand rd_botadd("rd_botadd", rd_addbotf, "Adds a bot by index from 1 to 8, where index is the character of bot (leader only)", FCVAR_NONE);
685+
686+
void rd_addbot_svf(const CCommand& args) {
687+
if (args.ArgC() < 2) {
688+
Msg("Please supply the value from 1 to 8\n");
689+
return;
690+
}
691+
692+
int iRosterIndex = atoi(args[1]);
693+
if (iRosterIndex < 1 || iRosterIndex > 8) {
694+
Msg("Please supply the value from 1 to 8\n");
695+
return;
696+
}
697+
--iRosterIndex;
698+
699+
CASW_Player* pLeader = ASWGameResource() ? ASWGameResource()->GetLeader() : NULL;
700+
if (pLeader && ASWGameResource() && ASWGameRules()) {
701+
if (!rd_player_bots_allowed.GetBool()) {
702+
ClientPrint(pLeader, HUD_PRINTTALK, "#rd_no_bots_allowed");
703+
return;
704+
}
705+
706+
if (ASWGameRules()->RosterSelect(pLeader, iRosterIndex, -1)) {
707+
DevMsg("Added bot %i \n", iRosterIndex);
708+
} else {
709+
Msg("Failed to add bot %i \n", iRosterIndex);
710+
}
711+
}
712+
}
713+
ConCommand rd_botadd_sv("rd_botadd_sv", rd_addbot_svf, "Adds a bot by index from 1 to 8 (server-side)", FCVAR_CHEAT);
685714

686715
void RdBotsKickF()
687716
{

0 commit comments

Comments
 (0)