]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/Juhu/velocity_pads' into morosophos/server-current4
authorNick S <nick@teichisma.info>
Thu, 30 Mar 2023 18:43:13 +0000 (21:43 +0300)
committerNick S <nick@teichisma.info>
Thu, 30 Mar 2023 18:43:13 +0000 (21:43 +0300)
1  2 
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/mapobjects/trigger/jumppads.qh

index faf8ea1e1ed40ac11f1209950df0d7b31be5891d,8c7ca3e9c48894d54c250854f0260208283d6cf4..b18c95ec23335d14021efaf3d194f3dddff2d01a
@@@ -277,42 -241,22 +249,21 @@@ bool jumppad_push(entity this, entity t
  
        vector org = targ.origin;
  
 -      if(STAT(Q3COMPAT))
 +      if(STAT(Q3COMPAT, targ) || this.spawnflags & PUSH_STATIC)
        {
 -              org.z += targ.mins_z;
 -              org.z += 1; // off by 1!
 +              org = (this.absmin + this.absmax) * 0.5;
        }
  
-       bool is_pushed = false;
-       if(is_velocity_pad)
+       bool already_pushed = false;
+       if(is_velocity_pad) // remember velocity jump pads
        {
-               for(int i = 0; i < MAX_PUSHED; ++i)
+               if(this == targ.last_pushed || (targ.last_pushed && !STAT(Q3COMPAT, targ))) // if q3compat is active overwrite last stored jump pad, otherwise ignore
                {
-                       if(this == targ.has_pushed[i])
-                       {
-                               is_pushed = true;
-                               break;
-                       }
+                       already_pushed = true;
                }
-               if(!is_pushed) // remember velocity jump pads
+               else
                {
-                       bool limit_reached = true;
-                       for(int i = 0; i < MAX_PUSHED; ++i)
-                       {
-                               if(targ.has_pushed[i]) continue;
-                               limit_reached = false;
-                               targ.has_pushed[i] = this; // may be briefly out of sync between client and server if client prediction is toggled
-                               break;
-                       }
-                       if(limit_reached)
-                       {
-                               return false; // too many overlapping jump pads
-                       }
-                       if(!IL_CONTAINS(are_pushed, targ))
-                       {
-                               IL_PUSH(are_pushed, targ);
-                               this.nextthink = time;
-                       }
+                       targ.last_pushed = this; // may be briefly out of sync between client and server if client prediction is toggled
                }
        }