]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/scripting.qc
Transifex autosync
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / scripting.qc
index 94c849650f9bbc47b73cfdee073a1a668ae25366..960ac2162866410a86ba101a9eb9fb1d04dce8f3 100644 (file)
@@ -1,18 +1,15 @@
 #include "scripting.qh"
 
-#include <common/weapons/_all.qh>
-#include <common/stats.qh>
-#include <server/miscfunctions.qh>
-#include <server/weapons/selection.qh>
-#include <server/weapons/weaponsystem.qh>
-#include "cvars.qh"
-
-#include <common/state.qh>
 #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
 #include <common/physics/player.qh>
+#include <common/state.qh>
+#include <common/stats.qh>
+#include <common/weapons/_all.qh>
 #include <common/wepent.qh>
-
-#include "bot.qh"
+#include <server/bot/default/bot.qh>
+#include <server/bot/default/cvars.qh>
+#include <server/weapons/selection.qh>
+#include <server/weapons/weaponsystem.qh>
 
 .int state;
 
@@ -349,7 +346,7 @@ void bot_cmdhelp(string scmd)
                switch(ntype)
                {
                        case BOT_CMD_PARAMETER_FLOAT:
-                               stype = "float number";
+                               stype = "float";
                                break;
                        case BOT_CMD_PARAMETER_STRING:
                                stype = "string";
@@ -393,7 +390,7 @@ void bot_cmdhelp(string scmd)
                                desc = "Resets the goal stack";
                                break;
                        case BOT_CMD_CC:
-                               desc = "Execute client command. Examples: cc \"say something\"; cc god; cc \"name newnickname\"; cc kill;";
+                               desc = "Execute client command. Examples: cc say something; cc god; cc name newnickname; cc kill;";
                                break;
                        case BOT_CMD_IF:
                                desc = "Perform simple conditional execution.\n"
@@ -452,17 +449,14 @@ void bot_list_commands()
        if(!bot_cmds_initialized)
                bot_commands_init();
 
-       LOG_INFO(
-           "List of all available commands:\n"
-           "  Command - Parameter Type\n"
-    );
+       LOG_HELP("Bot commands:");
 
        for(i=1;i<BOT_CMD_COUNTER;++i)
        {
                switch(bot_cmd_parm_type[i])
                {
                        case BOT_CMD_PARAMETER_FLOAT:
-                               ptype = "float number";
+                               ptype = "float";
                                break;
                        case BOT_CMD_PARAMETER_STRING:
                                ptype = "string";
@@ -474,8 +468,12 @@ void bot_list_commands()
                                ptype = "none";
                                break;
                }
-               LOG_INFO("  ", bot_cmd_string[i]," - <", ptype, ">");
+               if (ptype != "none")
+                       LOG_HELP("  ^2", bot_cmd_string[i]," ^7<", ptype, ">");
+               else
+                       LOG_HELP("  ^2", bot_cmd_string[i]);
        }
+       LOG_HELP("For help about a specific command, type bot_cmd help <command>");
 }
 
 // Commands code
@@ -495,8 +493,8 @@ float bot_cmd_impulse(entity this)
 
 float bot_cmd_continue(entity this)
 {
-       bot_relinkplayerlist();
        this.bot_exec_status &= ~BOT_EXEC_STATUS_PAUSED;
+       bot_relinkplayerlist();
        return CMD_STATUS_FINISHED;
 }
 
@@ -1002,6 +1000,11 @@ float bot_cmd_releasekey(entity this)
        return bot_cmd_keypress_handler(this, key,false);
 }
 
+bool bot_ispaused(entity this)
+{
+       return(this.bot_exec_status & BOT_EXEC_STATUS_PAUSED);
+}
+
 float bot_cmd_pause(entity this)
 {
        PHYS_INPUT_BUTTON_DRAG(this) = false;
@@ -1016,8 +1019,8 @@ float bot_cmd_pause(entity this)
        CS(this).movement = '0 0 0';
        this.bot_cmd_keys = BOT_CMD_KEY_NONE;
 
-       bot_clear(this);
        this.bot_exec_status |= BOT_EXEC_STATUS_PAUSED;
+       bot_relinkplayerlist();
        return CMD_STATUS_FINISHED;
 }
 
@@ -1209,13 +1212,13 @@ float bot_execute_commands_once(entity this)
        ispressingkey = boolean(bot_presskeys(this));
 
        // Handle conditions
-       if (!(bot_cmd.bot_cmd_type==BOT_CMD_FI||bot_cmd.bot_cmd_type==BOT_CMD_ELSE))
-       if((this.bot_cmd_condition_status & CMD_CONDITION_true) && this.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK)
+       if (!(bot_cmd.bot_cmd_type == BOT_CMD_FI || bot_cmd.bot_cmd_type == BOT_CMD_ELSE))
+       if((this.bot_cmd_condition_status & CMD_CONDITION_true) && (this.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK))
        {
                bot_command_executed(this, true);
                return -1;
        }
-       else if((this.bot_cmd_condition_status & CMD_CONDITION_false) && this.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK)
+       else if((this.bot_cmd_condition_status & CMD_CONDITION_false) && (this.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK))
        {
                bot_command_executed(this, true);
                return -1;