]> 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>
Wed, 12 Oct 2022 13:01:51 +0000 (23:01 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 16 Feb 2023 11:07:26 +0000 (21:07 +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 2de9cb0b4e2194878e6a157edcd41f2e7cc07b30..df81f43b8bc559c068d935fd1a5344d0851e5396 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);
 }