Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: bot/ac_bot.cpp
- ===================================================================
- --- bot/ac_bot.cpp (revision 7508)
- +++ bot/ac_bot.cpp (working copy)
- @@ -24,7 +24,7 @@
- void CACBot::Spawn()
- {
- // Init all bot variabeles
- - m_pMyEnt->nextprimary = 2 + rnd(5); // 2011jan18:ft: 2 == GUN_CARBINE, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT - if CPISTOL is activated this needs a FIXME to rnd(6)
- + m_pMyEnt->nextprimary = (m_iSpawnPrimary >= 2 && m_iSpawnPrimary <= 6) ? m_iSpawnPrimary : (2 + rnd(5)); // 2011jan18:ft: 2 == GUN_CARBINE, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT - if CPISTOL is activated this needs a FIXME to rnd(6)
- m_pMyEnt->targetyaw = m_pMyEnt->targetpitch = 0.0f;
- m_pMyEnt->pBot = this;
- Index: bot/bot.cpp
- ===================================================================
- --- bot/bot.cpp (revision 7508)
- +++ bot/bot.cpp (working copy)
- @@ -100,7 +100,7 @@
- m_pMyEnt->move = 0;
- moveplayer(m_pMyEnt, 1, true);
- }
- - else if (!m_arena && lastmillis-m_pMyEnt->respawnoffset>5000) Spawn();
- + else if (!m_arena && lastmillis-m_pMyEnt->respawnoffset>5000 && m_bAutoRespawn) Spawn();
- SendBotInfo();
- return;
- }
- Index: bot/bot.h
- ===================================================================
- --- bot/bot.h (revision 7508)
- +++ bot/bot.h (working copy)
- @@ -226,6 +226,12 @@
- bot_skill_s *m_pBotSkill; // Pointer to current bot skill
- short m_sSkillNr; // Skill number, 0 == best 4 == worst
- + // user-defined variables
- + int m_iSpawnPrimary; // Preferred primary weapon
- + vec m_vSpawnPos; // spawn position
- + bool m_bAutoRespawn; // respawn after death ?
- + bool m_bAttackBots; // does this bot attack other bots, or just humans ?
- +
- void AimToVec(const vec &o);
- void AimToIdeal(void);
- float ChangeAngle(float speed, float ideal, float current);
- Index: bot/bot_ai.cpp
- ===================================================================
- --- bot/bot_ai.cpp (revision 7508)
- +++ bot/bot_ai.cpp (working copy)
- @@ -108,7 +108,7 @@
- // WIP
- bool CBot::BotsAgainstHumans()
- {
- - return false;
- + return !m_bAttackBots;
- }
- bool CBot::DetectEnemy(playerent *p)
- Index: bot/botmanager.cpp
- ===================================================================
- --- bot/botmanager.cpp (revision 7508)
- +++ bot/botmanager.cpp (working copy)
- @@ -971,7 +971,12 @@
- m->pBot->m_pBotSkill = &BotManager.m_BotSkills[m->pBot->m_sSkillNr];
- // Sync waypoints
- m->pBot->SyncWaypoints();
- - m->pBot->Spawn();
- +
- + m->pBot->m_iSpawnPrimary = -1;
- + m->pBot->m_vSpawnPos = vec(0, 0, 0);
- + m->pBot->m_bAutoRespawn = true;
- + m->pBot->m_bAttackBots = true;
- +
- bots.add(m);
- return m;
- }
- @@ -985,30 +990,47 @@
- // Bot manager class end
- -void addbot(char *arg1, char *arg2, char *arg3)
- +void addbot(char *team, char *skill, char *name)
- {
- - if(!botmode()) return;
- - botent *b = BotManager.CreateBot(arg1, arg2, arg3);
- - if (b) conoutf("Bot connected: %s", b->name);
- - else { conoutf("Error: Couldn't create bot!"); return; }
- + botent *b = BotManager.CreateBot(team, skill, name);
- + if (b)
- + {
- + conoutf("connected: %s", b->name);
- + b->pBot->Spawn();
- + }
- + else conoutf("Error: Couldn't create bot!");
- }
- COMMAND(addbot, "sss");
- -void addnbot(char *arg1, char *arg2, char *arg3)
- +void addnbot(int *count, char *team, char *skill)
- {
- if(!botmode()) return;
- - if (!arg1 || !arg1[0]) return;
- + loopi(*count) addbot(team, skill, NULL);
- +}
- +COMMAND(addnbot, "iss");
- - int i = atoi(arg1);
- -
- - while(i > 0)
- +void spawnbot(char *team, char *skill, char *name, int *primary, int *attackbots, int *autorespawn, int *x, int *y)
- +{
- + if(!botmode()) return;
- + botent *b = BotManager.CreateBot(team, skill, name);
- + conoutf("creating bot");
- + if (b)
- {
- - addbot(arg2, arg3, NULL);
- - i--;
- - }
- + b->pBot->m_iSpawnPrimary = *primary;
- + b->pBot->m_vSpawnPos = vec(*x, *y, S(*x, *y)->floor);
- + b->pBot->m_bAutoRespawn = *autorespawn ? true : false;
- + b->pBot->m_bAttackBots = *attackbots ? true : false;
- + b->pBot->Spawn();
- + }
- + else conoutf("Error: Couldn't create bot!");
- }
- -COMMAND(addnbot, "sss");
- +COMMAND(spawnbot, "sssiiiii");
- +
- +COMMANDF(respawnbot, "i", (int *cn) {
- + loopv(bots) if(bots[i] && bots[i]->clientnum == *cn && bots[i]->state == CS_DEAD) { bots[i]->pBot->Spawn(); return; }
- +});
- +
- void botsshoot(int *Shoot)
- {
- switch(*Shoot)
- Index: clientgame.cpp
- ===================================================================
- --- clientgame.cpp (revision 7508)
- +++ clientgame.cpp (working copy)
- @@ -661,7 +661,9 @@
- {
- int r = fixspawn-->0 ? 4 : rnd(10)+1;
- entity *e = NULL;
- - if(!mapcenter)
- + bool predefinedspawn = d->type == ENT_BOT && !((botent *)d)->pBot->m_vSpawnPos.iszero();
- +
- + if(!mapcenter && !predefinedspawn)
- {
- int type = m_teammode ? team_base(d->team) : 100;
- if(m_arena && arenaspawn >= 0)
- @@ -699,6 +701,10 @@
- d->pitch = 0;
- d->roll = 0;
- }
- + else if(predefinedspawn)
- + {
- + d->o = ((botent *)d)->pBot->m_vSpawnPos;
- + }
- else
- {
- d->o.x = d->o.y = (float)ssize/2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement