]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/race.qc
Use the constants for player hitbox size when applicable (should fix observer hitbox)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / race.qc
index 8fc38aa2c5e028ed1d44f8cd5f3b7128454ddda9..a3cbc685f2be9d3164ce3526d7932a9f962b7a54 100644 (file)
@@ -9,6 +9,7 @@
 #include "../common/deathtypes/all.qh"
 #include "../common/notifications/all.qh"
 #include "../common/mapinfo.qh"
+#include <common/net_linked.qh>
 #include "../common/triggers/subs.qh"
 #include "../lib/warpzone/util_server.qh"
 #include "../lib/warpzone/common.qh"
@@ -912,7 +913,7 @@ spawnfunc(trigger_race_checkpoint)
                settouch(this, checkpoint_touch);
 
        o = (this.absmin + this.absmax) * 0.5;
-       tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
+       tracebox(o, PL_MIN_CONST, PL_MAX_CONST, o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
        waypoint_spawnforitem_force(this, trace_endpos);
        this.nearestwaypointtimeout = time + 1000000000;
 
@@ -952,20 +953,29 @@ spawnfunc(trigger_race_checkpoint)
 
 spawnfunc(target_checkpoint) // defrag entity
 {
-       vector o;
        if(!g_race && !g_cts) { delete(this); return; }
        defrag_ents = 1;
 
-       EXACTTRIGGER_INIT;
+       // if this is targeted, then it probably isn't a trigger
+       bool is_trigger = !boolean(!this.nottargeted && this.targetname != "");
+
+       if(is_trigger)
+               EXACTTRIGGER_INIT;
 
        this.use = checkpoint_use;
-       if (!(this.spawnflags & 1))
+       if (is_trigger && !(this.spawnflags & 1))
                settouch(this, checkpoint_touch);
 
-       o = (this.absmin + this.absmax) * 0.5;
-       tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
-       waypoint_spawnforitem_force(this, trace_endpos);
-       this.nearestwaypointtimeout = time + 1000000000;
+       vector org = this.origin;
+
+       // bots should only pathfind to this if it is a valid touchable trigger
+       if(is_trigger)
+       {
+               org = (this.absmin + this.absmax) * 0.5;
+               tracebox(org, PL_MIN_CONST, PL_MAX_CONST, org - '0 0 1' * (org.z - this.absmin.z), MOVE_NORMAL, this);
+               waypoint_spawnforitem_force(this, trace_endpos);
+               this.nearestwaypointtimeout = time + 1000000000;
+       }
 
        if(this.message == "")
                this.message = "went backwards";
@@ -982,9 +992,9 @@ spawnfunc(target_checkpoint) // defrag entity
        race_timed_checkpoint = 1;
 
        if(this.race_checkpoint == 0)
-               WaypointSprite_SpawnFixed(WP_RaceStart, o, this, sprite, RADARICON_NONE);
+               WaypointSprite_SpawnFixed(WP_RaceStart, org, this, sprite, RADARICON_NONE);
        else
-               WaypointSprite_SpawnFixed(WP_RaceCheckpoint, o, this, sprite, RADARICON_NONE);
+               WaypointSprite_SpawnFixed(WP_RaceCheckpoint, org, this, sprite, RADARICON_NONE);
 
        this.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player;