]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/bot.qh
Fix removal of the locked waypoint
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / bot.qh
index b3c628de1d6f40383fc9dc776941bbecc2f2b8ec..c4da14a4beeb29c7474c273879b34abc1c8411de 100644 (file)
@@ -1,23 +1,22 @@
-#ifndef BOT_H
-#define BOT_H
+#pragma once
 /*
  * Globals and Fields
  */
 
-const int AI_STATUS_ROAMING                                            = 1;    // Bot is just crawling the map. No enemies at sight
-const int AI_STATUS_ATTACKING                                  = 2;    // There are enemies at sight
-const int AI_STATUS_RUNNING                                            = 4;    // Bot is bunny hopping
-const int AI_STATUS_DANGER_AHEAD                               = 8;    // There is lava/slime/trigger_hurt ahead
-const int AI_STATUS_OUT_JUMPPAD                                        = 16;   // Trying to get out of a "vertical" jump pad
-const int AI_STATUS_OUT_WATER                                  = 32;   // Trying to get out of water
-const int AI_STATUS_WAYPOINT_PERSONAL_LINKING  = 64;   // Waiting for the personal waypoint to be linked
-const int AI_STATUS_WAYPOINT_PERSONAL_GOING            = 128;  // Going to a personal waypoint
-const int AI_STATUS_WAYPOINT_PERSONAL_REACHED  = 256;  // Personal waypoint reached
-const int AI_STATUS_JETPACK_FLYING                             = 512;
-const int AI_STATUS_JETPACK_LANDING                            = 1024;
-const int AI_STATUS_STUCK                                              = 2048; // Cannot reach any goal
-
-.float isbot; // true if this client is actually a bot
+const int AI_STATUS_ROAMING                    = BIT(0); // Bot is just crawling the map. No enemies at sight
+const int AI_STATUS_ATTACKING                  = BIT(1); // There are enemies at sight
+const int AI_STATUS_RUNNING                    = BIT(2); // Bot is bunny hopping
+const int AI_STATUS_DANGER_AHEAD               = BIT(3); // There is lava/slime/trigger_hurt ahead
+const int AI_STATUS_OUT_JUMPPAD                = BIT(4); // Trying to get out of a "vertical" jump pad
+const int AI_STATUS_OUT_WATER                  = BIT(5); // Trying to get out of water
+const int AI_STATUS_WAYPOINT_PERSONAL_LINKING  = BIT(6); // Waiting for the personal waypoint to be linked
+const int AI_STATUS_WAYPOINT_PERSONAL_GOING    = BIT(7); // Going to a personal waypoint
+const int AI_STATUS_WAYPOINT_PERSONAL_REACHED  = BIT(8); // Personal waypoint reached
+const int AI_STATUS_JETPACK_FLYING             = BIT(9);
+const int AI_STATUS_JETPACK_LANDING            = BIT(10);
+const int AI_STATUS_STUCK                      = BIT(11); // Cannot reach any goal
+
+.bool isbot; // true if this client is actually a bot
 .int aistatus;
 
 // Skill system
@@ -42,12 +41,12 @@ float autoskill_nextthink;
 
 .float totalfrags_lastcheck;
 
-
+// Custom weapon priorities
+float bot_distance_far;
+float bot_distance_close;
 
 entity bot_list;
-entity player_list;
 .entity nextbot;
-.entity nextplayer;
 .string cleanname;
 .string netname_freeme;
 .string playermodel_freeme;
@@ -63,6 +62,7 @@ entity player_list;
 
 .float bot_pickup;
 .float bot_pickupbasevalue;
+.bool bot_pickup_respawning;
 .float bot_canfire;
 .float bot_strategytime;
 
@@ -77,6 +77,12 @@ float botframe_nextthink;
 float botframe_nextdangertime;
 float bot_cvar_nextthink;
 
+int _content_type;
+#define IN_LAVA(pos) (_content_type = pointcontents(pos), (_content_type == CONTENT_LAVA || _content_type == CONTENT_SLIME))
+#define IN_LIQUID(pos) (_content_type = pointcontents(pos), (_content_type == CONTENT_WATER || _content_type == CONTENT_LAVA || _content_type == CONTENT_SLIME))
+#define SUBMERGED(pos) IN_LIQUID(pos + autocvar_sv_player_viewoffset)
+#define WETFEET(pos) IN_LIQUID(pos + eZ * (m1.z + 1))
+
 /*
  * Functions
  */
@@ -84,26 +90,26 @@ float bot_cvar_nextthink;
 entity bot_spawn();
 float bot_fixcount();
 
-void bot_think();
-void bot_setnameandstuff();
+void bot_think(entity this);
+void bot_setnameandstuff(entity this);
 void bot_custom_weapon_priority_setup();
 void bot_endgame();
 void bot_relinkplayerlist();
-void bot_clientdisconnect();
-void bot_clientconnect();
+void bot_clear(entity this);
+void bot_clientdisconnect(entity this);
+void bot_clientconnect(entity this);
 void bot_removefromlargestteam();
 void bot_removenewest();
 void autoskill(float factor);
 void bot_serverframe();
 
-.void() bot_ai;
+.void(entity this) bot_ai;
 .float(entity player, entity item) bot_pickupevalfunc;
 
 /*
  * Imports
  */
 
-void() havocbot_setupbot;
+void(entity this) havocbot_setupbot;
 
-void bot_calculate_stepheightvec(void);
-#endif
+void bot_calculate_stepheightvec();