]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: add proper support for target_push jumppads.
authorterencehill <piuntn@gmail.com>
Fri, 19 Apr 2024 17:13:04 +0000 (19:13 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 20 Apr 2024 17:38:07 +0000 (19:38 +0200)
These jump pads now spawn a box waypoint matching trigger size that bots can properly detect on touch like conventional jump pads

qcsrc/common/mapobjects/trigger/jumppads.qc

index 5ded24a28c0b27559110e9164c308c845061270d..38d0d0ca6f06f387603ae4a96833aa3d43fb535e 100644 (file)
@@ -573,8 +573,9 @@ float trigger_push_get_push_time(entity this, vector endpos)
 }
 #endif
 
-/// if (item != NULL) returns true if the item can be reached by using this jumppad, false otherwise
-/// if (item == NULL) tests jumppad's trajectory and eventually spawns waypoints for it (return value doesn't matter)
+// if (item != NULL) returns true if the item can be reached by using this jumppad, false otherwise
+// if (item == NULL) tests jumppad's trajectory and eventually spawns waypoints for it (return value doesn't matter)
+// NOTE: for simplicity's sake it improperly tests jumppad bboxes instead of bmodels
 bool trigger_push_test(entity this, entity item)
 {
 #ifdef SVQC
@@ -903,7 +904,18 @@ spawnfunc(target_push)
        this.use = target_push_use;
 
        if(this.target && this.target != "") // Q3 or old style Nexuiz pusher
+       {
+               entity trigger_ent = findchain(target, this.targetname);
+               if (trigger_ent)
+               {
+                       // apply size of its trigger entity so that it can be tested like a conventional
+                       // trigger_push jumppad and spawn an usable box waypoyint
+                       this.absmin = trigger_ent.absmin;
+                       this.absmax = trigger_ent.absmax;
+               }
+               IL_PUSH(g_jumppads, this);
                InitializeEntity(this, trigger_push_findtarget, INITPRIO_FINDTARGET);
+       }
        else // Q3 .angles and .speed pusher
        {
                if (!this.speed)