]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/waypoints.qc
Merge branch 'master' into terencehill/lms_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / waypoints.qc
index 7a40f18e8df56f6e1eacf6e0f242b08b316ee9e6..c1afab673f8d358d35bb04c6c6f97bca4f9c38ee 100644 (file)
@@ -1,25 +1,29 @@
 #include "waypoints.qh"
 
-#include <server/defs.qh>
-#include <server/miscfunctions.qh>
-#include "cvars.qh"
-
-#include "bot.qh"
-#include "navigation.qh"
-
-#include <common/state.qh>
-
-#include "../../antilag.qh"
-
+#include <common/animdecide.qh>
 #include <common/constants.qh>
 #include <common/debug.qh>
+#include <common/gamemodes/_mod.qh>
 #include <common/mapobjects/trigger/jumppads.qh>
 #include <common/net_linked.qh>
 #include <common/physics/player.qh>
-
+#include <common/state.qh>
+#include <common/stats.qh>
+#include <common/weapons/_all.qh>
 #include <lib/warpzone/common.qh>
 #include <lib/warpzone/util_server.qh>
-
+#include <server/antilag.qh>
+#include <server/bot/default/bot.qh>
+#include <server/bot/default/cvars.qh>
+#include <server/bot/default/navigation.qh>
+#include <server/items/items.qh>
+#include <server/spawnpoints.qh>
+#include <server/weapons/tracing.qh>
+
+STATIC_INIT(waypoints)
+{
+       waypointeditor_enabled = autocvar_g_waypointeditor;
+}
 .entity spawnpointmodel;
 void waypoint_unreachable(entity pl)
 {
@@ -89,11 +93,11 @@ void waypoint_unreachable(entity pl)
                        LOG_INFO("spawn without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
                        it.spawnpointmodel.effects |= EF_NODEPTHTEST;
                        _setmodel(it.spawnpointmodel, pl.model);
-                       it.spawnpointmodel.frame = pl.frame;
+                       it.spawnpointmodel.frame = ANIM_idle.m_id;
                        it.spawnpointmodel.skin = pl.skin;
-                       it.spawnpointmodel.colormap = pl.colormap;
-                       it.spawnpointmodel.colormod = pl.colormod;
-                       it.spawnpointmodel.glowmod = pl.glowmod;
+                       it.spawnpointmodel.colormap = 1024 + 68;
+                       it.spawnpointmodel.glowmod = '1 0 0';
+                       it.spawnpointmodel.angles = it.angles;
                        setsize(it.spawnpointmodel, PL_MIN_CONST, PL_MAX_CONST);
                        j++;
                }
@@ -355,7 +359,7 @@ void waypoint_restore_hardwiredlinks(entity wp)
 
 void waypoint_setupmodel(entity wp)
 {
-       if (autocvar_g_waypointeditor)
+       if (waypointeditor_enabled)
        {
                // TODO: add some sort of visible box in edit mode for box waypoints
                vector m1 = wp.mins;
@@ -449,7 +453,11 @@ entity waypoint_spawn(vector m1, vector m2, float f)
        w.wpflags = f;
        w.solid = SOLID_TRIGGER;
        w.createdtime = time;
-       setorigin(w, (m1 + m2) * 0.5);
+       w.origin = (m1 + m2) * 0.5;
+       if (waypointeditor_enabled)
+               setorigin(w, w.origin);
+       else // don't link into the world, only bots are aware of waypoints
+               make_pure(w);
        setsize(w, m1 - w.origin, m2 - w.origin);
        if (w.size)
                w.wpisbox = true;
@@ -470,7 +478,7 @@ entity waypoint_spawn(vector m1, vector m2, float f)
                        }
                        else
                        {
-                               if(autocvar_developer)
+                               if(autocvar_developer > 0)
                                {
                                        LOG_INFO("A generated waypoint is stuck in solid at ", vtos(w.origin));
                                        backtrace("Waypoint stuck");
@@ -1287,7 +1295,10 @@ spawnfunc(waypoint)
 {
        IL_PUSH(g_waypoints, this);
 
-       setorigin(this, this.origin);
+       if (waypointeditor_enabled)
+               setorigin(this, this.origin);
+       else
+               make_pure(this);
        // schedule a relink after other waypoints have had a chance to spawn
        waypoint_clearlinks(this);
        //waypoint_schedulerelink(this);
@@ -1572,6 +1583,46 @@ void waypoint_load_hardwiredlinks()
        LOG_TRACE("loaded ", ftos(c), " waypoint links from maps/", mapname, ".waypoints.hardwired");
 }
 
+float waypoint_get_assigned_link_cost(entity w, float i)
+{
+       switch(i)
+       {
+               case  0: return w.wp00mincost;
+               case  1: return w.wp01mincost;
+               case  2: return w.wp02mincost;
+               case  3: return w.wp03mincost;
+               case  4: return w.wp04mincost;
+               case  5: return w.wp05mincost;
+               case  6: return w.wp06mincost;
+               case  7: return w.wp07mincost;
+               case  8: return w.wp08mincost;
+               case  9: return w.wp09mincost;
+               case 10: return w.wp10mincost;
+               case 11: return w.wp11mincost;
+               case 12: return w.wp12mincost;
+               case 13: return w.wp13mincost;
+               case 14: return w.wp14mincost;
+               case 15: return w.wp15mincost;
+               case 16: return w.wp16mincost;
+               case 17: return w.wp17mincost;
+               case 18: return w.wp18mincost;
+               case 19: return w.wp19mincost;
+               case 20: return w.wp20mincost;
+               case 21: return w.wp21mincost;
+               case 22: return w.wp22mincost;
+               case 23: return w.wp23mincost;
+               case 24: return w.wp24mincost;
+               case 25: return w.wp25mincost;
+               case 26: return w.wp26mincost;
+               case 27: return w.wp27mincost;
+               case 28: return w.wp28mincost;
+               case 29: return w.wp29mincost;
+               case 30: return w.wp30mincost;
+               case 31: return w.wp31mincost;
+               default: return -1;
+       }
+}
+
 entity waypoint_get_link(entity w, float i)
 {
        switch(i)
@@ -1869,7 +1920,7 @@ float waypoint_loadall()
        waypoint_version_loaded = ver;
        LOG_TRACE("loaded ", ftos(cwp), " waypoints and ", ftos(cwb), " wayboxes from maps/", mapname, ".waypoints");
 
-       if (autocvar_g_waypointeditor && autocvar_g_waypointeditor_symmetrical_allowload)
+       if (waypointeditor_enabled && autocvar_g_waypointeditor_symmetrical_allowload)
        {
                string sym_str = "";
                cvar_set("g_waypointeditor_symmetrical", ftos(sym));