]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/scripting.qc
Merge branch 'terencehill/ons_camera' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / scripting.qc
index e111b2ab4f043f5174b270b5090f6190a3dfb5c1..9f29a22176264e9e507c24da84854fd67e90c486 100644 (file)
@@ -230,17 +230,10 @@ void bot_commands_init()
 // Returns first bot with matching name
 entity find_bot_by_name(string name)
 {
-       entity bot;
-
-       bot = findchainflags(flags, FL_CLIENT);
-       while (bot)
+       FOREACH_CLIENT(IS_BOT_CLIENT(it) && it.netname == name,
        {
-               if(IS_BOT_CLIENT(bot))
-               if(bot.netname==name)
-                       return bot;
-
-               bot = bot.chain;
-       }
+               return it;
+       });
 
        return NULL;
 }
@@ -594,16 +587,12 @@ const int CMD_CONDITION_false_BLOCK = 8;
 float bot_cmd_eval(entity this, string expr)
 {
        // Search for numbers
-       if(strstrofs("0123456789", substring(expr, 0, 1), 0) >= 0)
-       {
+       if(IS_DIGIT(substring(expr, 0, 1)))
                return stof(expr);
-       }
 
        // Search for cvars
        if(substring(expr, 0, 5)=="cvar.")
-       {
                return cvar(substring(expr, 5, strlen(expr)));
-       }
 
        // Search for fields
        switch(expr)
@@ -1117,7 +1106,6 @@ void bot_setcurrentcommand(entity this)
        if(!this.bot_cmd_current)
        {
                this.bot_cmd_current = new_pure(bot_cmd);
-               this.bot_cmd_current.is_bot_cmd = true;
        }
 
        bot_cmd = this.bot_cmd_current;