]> 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 6b69077a09abe2d7e49925a1fc9bb4df72025be3..4e081bfb70308d7ea88d04e87b6af6396e3501b6 100644 (file)
@@ -27,6 +27,7 @@ void door_go_up(entity this, entity actor, entity trigger);
 
 void door_blocked(entity this, entity blocker)
 {
+       bool reverse = false;
        if((this.spawnflags & DOOR_CRUSH)
 #ifdef SVQC
                && (blocker.takedamage != DAMAGE_NO)
@@ -69,6 +70,7 @@ void door_blocked(entity this, entity blocker)
                                        else
                                                door_rotating_go_down(this);
                                }
+                               reverse = true;
                        }
                }
 #ifdef SVQC
@@ -80,6 +82,8 @@ void door_blocked(entity this, entity blocker)
                }
 #endif
        }
+       if (!reverse && this.classname == "door")
+               SUB_CalcMovePause(this);
 }
 
 void door_hit_top(entity this)
@@ -365,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);
 }
@@ -689,7 +704,7 @@ void door_init_shared(entity this)
        }
        else if (!this.wait)
        {
-               this.wait = 3;
+               this.wait = q3compat ? 2 : 3;
        }
 
        if (!this.lip)
@@ -742,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)
        {