]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
func_door: implement Q3 team-based door linking using fullspawndata
authorbones_was_here <bones_was_here@xonotic.au>
Wed, 12 Oct 2022 14:58:25 +0000 (00:58 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 16 Feb 2023 11:07:27 +0000 (21:07 +1000)
qcsrc/common/mapobjects/func/door.qc

index df81f43b8bc559c068d935fd1a5344d0851e5396..a573faf6fb11a2ff636563665d85cebf9c1b8872 100644 (file)
@@ -418,7 +418,7 @@ LinkDoors
 
 entity LinkDoors_nextent(entity cur, entity near, entity pass)
 {
-       while((cur = find(cur, classname, pass.classname)) && ((cur.spawnflags & DOOR_DONT_LINK) || cur.enemy))
+       while((cur = find(cur, classname, pass.classname)) && ((cur.spawnflags & DOOR_DONT_LINK && !Q3COMPAT_COMMON) || cur.enemy))
        {
        }
        return cur;
@@ -426,6 +426,9 @@ entity LinkDoors_nextent(entity cur, entity near, entity pass)
 
 bool LinkDoors_isconnected(entity e1, entity e2, entity pass)
 {
+       if(Q3COMPAT_COMMON)
+               return e1.team == e2.team;
+
        float DELTA = 4;
        if((e1.absmin_x > e2.absmax_x + DELTA)
        || (e1.absmin_y > e2.absmax_y + DELTA)
@@ -451,7 +454,9 @@ void LinkDoors(entity this)
 
        if (this.enemy)
                return;         // already linked by another door
-       if (this.spawnflags & DOOR_DONT_LINK)
+
+       // Q3 door linking is done for teamed doors only and is not affected by spawnflags or bmodel proximity
+       if ((this.spawnflags & DOOR_DONT_LINK && !Q3COMPAT_COMMON) || (Q3COMPAT_COMMON && !this.team))
        {
                this.owner = this.enemy = this;
 
@@ -775,8 +780,18 @@ spawnfunc(func_door)
                        this.speed = 100;
        }
 
-       if (q3compat && !this.dmg)
-               this.dmg = 2;
+       if (q3compat)
+       {
+               if (!this.dmg)
+                       this.dmg = 2;
+
+               if (!this.team)
+               {
+                       string t = GetField_fullspawndata(this, "team");
+                       // bones_was_here: same hack as used to support teamed items on Q3 maps
+                       if(t) this.team = crc16(false, t);
+               }
+       }
 
        settouch(this, door_touch);