From 01e765dcf3839c72939826e14f182311f78b036f Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Thu, 13 Oct 2022 00:58:25 +1000 Subject: [PATCH] func_door: implement Q3 team-based door linking using fullspawndata --- qcsrc/common/mapobjects/func/door.qc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/qcsrc/common/mapobjects/func/door.qc b/qcsrc/common/mapobjects/func/door.qc index df81f43b8..a573faf6f 100644 --- a/qcsrc/common/mapobjects/func/door.qc +++ b/qcsrc/common/mapobjects/func/door.qc @@ -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); -- 2.39.2