]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/bot/default/scripting.qh
Merge branch 'martin-t/units' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / scripting.qh
1 #pragma once
2
3 #define BOT_EXEC_STATUS_IDLE 0
4 #define BOT_EXEC_STATUS_PAUSED 1
5 #define BOT_EXEC_STATUS_WAITING 2
6
7 #define CMD_STATUS_EXECUTING 0
8 #define CMD_STATUS_FINISHED 1
9 #define CMD_STATUS_ERROR 2
10
11
12 // NOTE: New commands should be added here. Do not forget to update BOT_CMD_COUNTER
13 const int BOT_CMD_NULL                  = 0;
14 const int BOT_CMD_PAUSE                 = 1;
15 const int BOT_CMD_CONTINUE              = 2;
16 const int BOT_CMD_WAIT                  = 3;
17 const int BOT_CMD_TURN                  = 4;
18 const int BOT_CMD_MOVETO                = 5;
19 const int BOT_CMD_RESETGOAL     = 6;    // Not implemented yet
20 const int BOT_CMD_CC                    = 7;
21 const int BOT_CMD_IF                    = 8;
22 const int BOT_CMD_ELSE                  = 9;
23 const int BOT_CMD_FI                    = 10;
24 const int BOT_CMD_RESETAIM              = 11;
25 const int BOT_CMD_AIM                   = 12;
26 const int BOT_CMD_PRESSKEY              = 13;
27 const int BOT_CMD_RELEASEKEY    = 14;
28 const int BOT_CMD_SELECTWEAPON  = 15;
29 const int BOT_CMD_IMPULSE               = 16;
30 const int BOT_CMD_WAIT_UNTIL    = 17;
31 const int BOT_CMD_MOVETOTARGET  = 18;
32 const int BOT_CMD_AIMTARGET     = 19;
33 const int BOT_CMD_BARRIER               = 20;
34 const int BOT_CMD_CONSOLE               = 21;
35 const int BOT_CMD_SOUND                 = 22;
36 const int BOT_CMD_DEBUG_ASSERT_CANFIRE = 23;
37 //const int BOT_CMD_WHILE               = 24;   // TODO: Not implemented yet
38 //const int BOT_CMD_WEND                        = 25;   // TODO: Not implemented yet
39 //const int BOT_CMD_CHASE               = 26;   // TODO: Not implemented yet
40
41 const int BOT_CMD_COUNTER               = 24;   // Update this value if you add/remove a command
42
43 // NOTE: Following commands should be implemented on the bot ai
44 //               If a new command should be handled by the target ai(s) please declare it here
45 .float(entity, vector) cmd_moveto;
46 .float(entity) cmd_resetgoal;
47
48 //
49 const int BOT_CMD_PARAMETER_NONE = 0;
50 const int BOT_CMD_PARAMETER_FLOAT = 1;
51 const int BOT_CMD_PARAMETER_STRING = 2;
52 const int BOT_CMD_PARAMETER_VECTOR = 3;
53
54 float bot_cmds_initialized;
55 int bot_cmd_parm_type[BOT_CMD_COUNTER];
56 string bot_cmd_string[BOT_CMD_COUNTER];
57
58 // Bots command queue
59 entity bot_cmd; // global current command
60 .entity bot_cmd_current; // current command of this bot
61
62 .float bot_cmd_index;                   // Position of the command in the queue
63 .int bot_cmd_type;                      // If of command (see the BOT_CMD_* defines)
64 .float bot_cmd_parm_float;              // Field to store a float parameter
65 .string bot_cmd_parm_string;            // Field to store a string parameter
66 .vector bot_cmd_parm_vector;            // Field to store a vector parameter
67
68 float bot_barriertime;
69 .float bot_barrier;
70
71 .float bot_cmd_execution_index;         // Position in the queue of the command to be executed
72
73
74 void bot_resetqueues();
75 void bot_queuecommand(entity bot, string cmdstring);
76 void bot_cmdhelp(string scmd);
77 void bot_list_commands();
78 float bot_execute_commands(entity this);
79 entity find_bot_by_name(string name);
80 entity find_bot_by_number(float number);