]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/func/door.qc
func_door: use Q3 default of 2s .wait time on Q3 maps
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / func / door.qc
index 2dcd2333d214f3137a0de938a1fe9582524b9906..4e081bfb70308d7ea88d04e87b6af6396e3501b6 100644 (file)
@@ -82,7 +82,7 @@ void door_blocked(entity this, entity blocker)
                }
 #endif
        }
-       if (!reverse)
+       if (!reverse && this.classname == "door")
                SUB_CalcMovePause(this);
 }
 
@@ -369,14 +369,25 @@ void door_trigger_touch(entity this, entity toucher)
 #endif
                        return;
 
-       if (time < this.door_finished)
+       if (this.owner.state == STATE_UP)
                return;
 
        // check if door is locked
        if (!door_check_keys(this, toucher))
                return;
 
-       this.door_finished = time + 1;
+       if (this.owner.state == STATE_TOP)
+       {
+               if (this.owner.nextthink < this.owner.ltime + this.owner.wait)
+               {
+                       entity e = this.owner;
+                       do {
+                               e.nextthink = e.ltime + e.wait;
+                               e = e.enemy;
+                       } while (e != this.owner);
+               }
+               return;
+       }
 
        door_use(this.owner, toucher, NULL);
 }
@@ -693,7 +704,7 @@ void door_init_shared(entity this)
        }
        else if (!this.wait)
        {
-               this.wait = 3;
+               this.wait = q3compat ? 2 : 3;
        }
 
        if (!this.lip)
@@ -746,7 +757,11 @@ spawnfunc(func_door)
        door_init_shared(this);
 
        this.pos1 = this.origin;
-       this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
+       vector absmovedir;
+       absmovedir.x = fabs(this.movedir.x);
+       absmovedir.y = fabs(this.movedir.y);
+       absmovedir.z = fabs(this.movedir.z);
+       this.pos2 = this.pos1 + this.movedir * (absmovedir * this.size - this.lip);
 
        if(autocvar_sv_doors_always_open)
        {