]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
q3compat: allow damage to open a func_door with no health and no targetname
authorbones_was_here <bones_was_here@xa.org.au>
Sun, 17 Apr 2022 09:53:31 +0000 (19:53 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Sun, 17 Apr 2022 11:03:05 +0000 (21:03 +1000)
Fixes doors that should open when shot on some Q3* maps

Also fixed some indenting and a comment

qcsrc/common/mapobjects/func/door.qc

index d3c042ef93dae155463cfff3f6b012803b88f799..6b69077a09abe2d7e49925a1fc9bb4df72025be3 100644 (file)
@@ -655,7 +655,7 @@ void door_init_shared(entity this)
        // TODO: other soundpacks
        if (this.sounds > 0 || q3compat)
        {
-               // Doors in Q3 always have sounds (they're hard coded in Q3 engine)
+               // Doors in Q3 always have sounds (they're hard coded)
                this.noise2 = "plats/medplat1.wav";
                this.noise1 = "plats/medplat2.wav";
        }
@@ -683,14 +683,14 @@ void door_init_shared(entity this)
                precache_sound(this.noise2);
        }
 
-        if(autocvar_sv_doors_always_open)
-        {
-                 this.wait = -1;
-        }
-        else if (!this.wait)
-        {
-               this.wait = 3;
-        }
+       if(autocvar_sv_doors_always_open)
+       {
+               this.wait = -1;
+       }
+       else if (!this.wait)
+       {
+               this.wait = 3;
+       }
 
        if (!this.lip)
        {
@@ -699,7 +699,7 @@ void door_init_shared(entity this)
 
        this.state = STATE_BOTTOM;
 
-       if (GetResource(this, RES_HEALTH))
+       if (GetResource(this, RES_HEALTH) || (q3compat && this.targetname == ""))
        {
                //this.canteamdamage = true; // TODO
                this.takedamage = DAMAGE_YES;
@@ -744,17 +744,17 @@ spawnfunc(func_door)
        this.pos1 = this.origin;
        this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
 
-        if(autocvar_sv_doors_always_open)
-        {
-                this.speed = max(750, this.speed);
-        }
-        else if (!this.speed)
-        {
+       if(autocvar_sv_doors_always_open)
+       {
+               this.speed = max(750, this.speed);
+       }
+       else if (!this.speed)
+       {
                if (q3compat)
                        this.speed = 400;
                else
-                       this.speed = 100;
-        }
+                       this.speed = 100;
+       }
 
        settouch(this, door_touch);