]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
move shotgun melee sound to CH_WEAPON_A; add bot_cmd setbots command to set bot count
authorRudolf Polzer <divverent@xonotic.org>
Sat, 15 Oct 2011 12:37:26 +0000 (14:37 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 15 Oct 2011 12:37:41 +0000 (14:37 +0200)
qcsrc/server/bot/bot.qc
qcsrc/server/gamecommand.qc
qcsrc/server/w_shotgun.qc

index 1b6d8eb4ea440fed2954148d180b317469972203..7bb507579a529f618e8a8c3ea45c38c17eba1291 100644 (file)
@@ -537,28 +537,10 @@ void bot_calculate_stepheightvec(void)
                // 0.75 factor is for safety to make the jumps easy
 }
 
-void bot_serverframe()
+float bot_fixcount()
 {
-       float realplayers, bots, activerealplayers;
        entity head;
-
-       if (intermission_running)
-               return;
-
-       if (time < 2)
-               return;
-
-       bot_calculate_stepheightvec();
-       bot_navigation_movemode = ((autocvar_bot_navigation_ignoreplayers) ? MOVE_NOMONSTERS : MOVE_NORMAL);
-
-       if(time > autoskill_nextthink)
-       {
-               float a;
-               a = autocvar_skill_auto;
-               if(a)
-                       autoskill(a);
-               autoskill_nextthink = time + 5;
-       }
+       float realplayers, bots, activerealplayers;
 
        activerealplayers = 0;
        realplayers = 0;
@@ -597,8 +579,6 @@ void bot_serverframe()
                bots = 0;
        }
 
-       bot_ignore_bots = autocvar_bot_ignore_bots;
-
        // only add one bot per frame to avoid utter chaos
        if(time > botframe_nextthink)
        {
@@ -608,14 +588,44 @@ void bot_serverframe()
                        if (bot_spawn() == world)
                        {
                                bprint("Can not add bot, server full.\n");
-                               botframe_nextthink = time + 10;
-                               break;
+                               return FALSE;
                        }
                }
                while (currentbots > bots)
                        bot_removenewest();
        }
 
+       return TRUE;
+}
+
+void bot_serverframe()
+{
+       if (intermission_running)
+               return;
+
+       if (time < 2)
+               return;
+
+       bot_calculate_stepheightvec();
+       bot_navigation_movemode = ((autocvar_bot_navigation_ignoreplayers) ? MOVE_NOMONSTERS : MOVE_NORMAL);
+
+       if(time > autoskill_nextthink)
+       {
+               float a;
+               a = autocvar_skill_auto;
+               if(a)
+                       autoskill(a);
+               autoskill_nextthink = time + 5;
+       }
+
+       if(time > botframe_nextthink)
+       {
+               if(!bot_fixcount())
+                       botframe_nextthink = time + 10;
+       }
+
+       bot_ignore_bots = autocvar_bot_ignore_bots;
+
        if(botframe_spawnedwaypoints)
        {
                if(autocvar_waypoint_benchmark)
index d0c513a934622a2faacad21f107f927df42dbfd5..f5b662be35e51a5e6a80a72a6ca70ac800cdaaa7 100644 (file)
@@ -1283,6 +1283,17 @@ void GameCommand(string command)
                        return;
                }
 
+               // set bot count
+               if(argv(1) == "setbots")
+               {
+                       if(argc >= 3 && argv(1) == "setbots")
+                       {
+                               cvar_settemp("minplayers", "0");
+                               cvar_settemp("bot_number", argv(2));
+                               bot_fixcount();
+                       }
+               }
+
                // Load cmds from file
                if(argv(1) == "load" && argc == 3)
                {
@@ -1301,12 +1312,26 @@ void GameCommand(string command)
 
                                if(argc >= 3 && argv(0) == "sv_cmd" && argv(1) == "bot_cmd")
                                {
-                                       // let's start at token 2 so we can skip sv_cmd bot_cmd
-                                       bot = find_bot_by_number(stof(argv(2)));
-                                       if(bot == world)
-                                               bot = find_bot_by_name(argv(2));
-                                       if(bot)
-                                               bot_queuecommand(bot, strcat(argv(3), " ", argv(4)));
+                                       if(argv(2) == "reset")
+                                       {
+                                               bot_resetqueues();
+                                       }
+                                       else if(argv(2) == "setbots")
+                                       {
+                                               cvar_settemp("minplayers", "0");
+                                               cvar_settemp("bot_number", argv(3));
+                                               if(!bot_fixcount())
+                                                       print("Sorry, could not set requested bot count\n");
+                                       }
+                                       else
+                                       {
+                                               // let's start at token 2 so we can skip sv_cmd bot_cmd
+                                               bot = find_bot_by_number(stof(argv(2)));
+                                               if(bot == world)
+                                                       bot = find_bot_by_name(argv(2));
+                                               if(bot)
+                                                       bot_queuecommand(bot, strcat(argv(3), " ", argv(4)));
+                                       }
                                }
                                else
                                        localcmd(strcat(s, "\n"));
index 7130599dec2ac224f9ba83696b968ffc31abd66c..2be9e44a6f9c6f091751b95782145a8bc329972f 100644 (file)
@@ -142,7 +142,7 @@ void shotgun_meleethink (void)
 
 void W_Shotgun_Attack2 (void)
 {
-       sound (self, CH_SHOTS, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM);
+       sound (self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM);
        weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_shotgun_secondary_animtime, w_ready);
 
        entity meleetemp;