]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/gamec/bots.c
Forgot a couple of files
[divverent/nexuiz.git] / data / qcsrc / gamec / bots.c
1 float BOTTYPE_MAUVEBOT = 0;
2 float BOTTYPE_URREBOT = 1;
3 .float bottype;
4
5 /*
6 MauveBot v1.0 for Nexuiz
7 */
8
9 float intermission_running;
10
11 .float skill_level;
12
13 .float ai_time;
14 .float threat;
15 .entity dodgeent;
16
17 float THREAT_UNFLAGGED = 0;
18 float THREAT_IGNORE = -1;
19
20 float DODGE_DIST = 500;
21 float SEARCH_DIST = 1000;
22
23 .float search_time;
24
25 float bot_number;
26
27 void() add_MauveBot;
28 void() remove_MauveBot;
29
30 /*
31 UrreBot 1.5 for Nexuiz
32 */
33
34 entity navnode_chain, bot_chain;
35 float navnodes, loadstep;
36 .entity list, link0, link1, link2, link3, link4, link5, link6, link7, link8, link9;
37 .entity link10, link11, link12, link13, link14, link15, link16, link17, link18, link19;
38 .float sflags;
39 .float lflags0, lflags1, lflags2, lflags3, lflags4, lflags5, lflags6, lflags7, lflags8, lflags9;
40 .float lflags10, lflags11, lflags12, lflags13, lflags14, lflags15, lflags16, lflags17, lflags18, lflags19;
41 .vector pointl;
42 .float costl;
43 .float lmark;
44 float search_distance;
45 float minisearch_distance;
46 float stratsearch_distance;
47 .entity goalcurrent;
48 .float strat_me;
49 .float() evalfunc;
50
51 vector nullvector;
52 .vector movepoint;
53 .float camptime;
54 .vector campcheck;
55
56 .vector aimpoint;
57 .float aimtime;
58 .float evaltime;
59 .float lead;
60
61 float skill;
62
63 float S_TELEPORT = 1;
64 float S_DOOR = 2;
65 float S_TOUCH = 4;
66
67 float LF_NOLINK = 1;
68 float LF_NOWALK = 2;
69 float LF_BAD = 4;
70 float LF_BIGDROP = 8;
71 float LF_REMOTE = 16;
72
73 .entity plane_chain;
74
75 float urrebots, actualurrebots, urrebots_strategytime, urrebots_combattime;
76
77 entity strategytoken;
78 float strategytime;
79 .float combattime;
80
81 entity(vector org, vector minss, vector maxss) FindCurrentNavNode;
82 void(float distance) UrreBotPath;
83 void() UrreBotSetup;
84 void() UrreBotThink;
85 void() LoadNavNodes;
86 void() LinkNavNodes;
87 void() ItemEvals;
88 void() UrreBotAdd;
89 void() UrreBotRemove;
90
91 float(vector m1, vector m2, vector m3, vector m4) boxesoverlap = {return m2_x >= m3_x && m1_x <= m4_x && m2_y >= m3_y && m1_y <= m4_y && m2_z >= m3_z && m1_z <= m4_z;};
92 float(vector smins, vector smaxs, vector bmins, vector bmaxs) boxenclosed = {return smins_x >= bmins_x && smaxs_x <= bmaxs_x && smins_y >= bmins_y && smaxs_y <= bmaxs_y && smins_z >= bmins_z && smaxs_z <= bmaxs_z;};
93
94 entity newmis;
95 void() SUB_Remove;
96 float JoinBestTeam(entity pl, float only_return_best);
97 float sv_maxspeed;
98
99 void() Bots_Shared =
100 {
101         local float flo;
102
103         if (time >= 3)
104         {
105                 // MauveBots
106                 flo = cvar("bot_number");
107                 if (flo > bot_number)
108                         add_MauveBot();
109                 else if (flo < bot_number)
110                         remove_MauveBot();
111
112                 // UrreBots
113                 urrebots = cvar("urrebots");
114                 urrebots_strategytime = cvar("urrebots_strategytime");
115                 urrebots_combattime = cvar("urrebots_combattime");
116                 stratsearch_distance = cvar("urrebots_stratsearch_dist");
117                 minisearch_distance = cvar("urrebots_minisearch_dist");
118                 if (actualurrebots < urrebots)
119                 {
120                         if (loadstep == 0)
121                         {
122                                 LoadNavNodes();
123                                 loadstep = 1;
124                                 return;
125                         }
126                         else if (loadstep == 1)
127                         {
128                                 LinkNavNodes();
129                                 loadstep = 2;
130                                 return;
131                         }
132                         else if (loadstep == 2)
133                         {
134                                 ItemEvals();
135                                 loadstep = 3;
136                                 return;
137                         }
138                         UrreBotAdd();
139                 }
140                 if (actualurrebots > urrebots)
141                         UrreBotRemove();
142         }
143         else
144         {
145                 remove_MauveBot();
146                 UrreBotRemove();
147         }
148 };