]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
func_door: fix bug where doors blocked by players never reversed direction
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 15 Sep 2023 06:49:19 +0000 (16:49 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 15 Sep 2023 07:11:43 +0000 (17:11 +1000)
This bug was inherited from Nexuiz.  It worked properly in Quake which
didn't have this condition, and in Quake 3.

qcsrc/common/mapobjects/func/door.qc

index 1438baadd03cac8ebd3153d63b7634984187dc70..66bf63c9fb28f0e44bd2bd6694d955f9a6cbb176 100644 (file)
@@ -47,31 +47,29 @@ void door_blocked(entity this, entity blocker)
                        Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
 #endif
 
-                // don't change direction for dead or dying stuff
-               if(IS_DEAD(blocker)
+               // don't change direction for dead or dying stuff
+               if (!IS_DEAD(blocker)
 #ifdef SVQC
-                       && (blocker.takedamage == DAMAGE_NO)
+                       && blocker.takedamage != DAMAGE_NO
 #endif
+                       && this.wait >= 0
                )
                {
-                       if (this.wait >= 0)
+                       if (this.state == STATE_DOWN)
                        {
-                               if (this.state == STATE_DOWN)
-                               {
-                                       if (this.classname == "door")
-                                               door_go_up(this, NULL, NULL);
-                                       else
-                                               door_rotating_go_up(this, blocker);
-                               }
+                               if (this.classname == "door")
+                                       door_go_up(this, NULL, NULL);
                                else
-                               {
-                                       if (this.classname == "door")
-                                               door_go_down(this);
-                                       else
-                                               door_rotating_go_down(this);
-                               }
-                               reverse = true;
+                                       door_rotating_go_up(this, blocker);
+                       }
+                       else
+                       {
+                               if (this.classname == "door")
+                                       door_go_down(this);
+                               else
+                                       door_rotating_go_down(this);
                        }
+                       reverse = true;
                }
 #ifdef SVQC
                else
@@ -82,7 +80,8 @@ void door_blocked(entity this, entity blocker)
                }
 #endif
        }
-       if (!reverse && this.classname == "door")
+       // if we didn't change direction and are using a non-linear movement controller, we must pause it
+       if (!reverse && this.classname == "door" && this.move_controller)
                SUB_CalcMovePause(this);
 }