]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add support for teamed items on Q3 maps by using fullspawndata
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 3 Oct 2022 06:36:08 +0000 (16:36 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 3 Oct 2022 06:36:08 +0000 (16:36 +1000)
Closes #2368

qcsrc/server/items/items.qc
qcsrc/server/main.qh

index 5f89f7eead680c22c19eeaa588e81c86a07cc0e3..cbc4ae44098d63981c7fd58ed4bcf47ba8e82ad5 100644 (file)
@@ -976,6 +976,13 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        precache_model(this.model);
        precache_sound(this.item_pickupsound);
 
+       if(q3compat && !this.team)
+       {
+               string t = GetField_fullspawndata(this, "team", false);
+               // bones_was_here: this hack is cheaper than changing to a .string strcmp()
+               if(t) this.team = crc16(false, t);
+       }
+
        if (Item_IsLoot(this))
        {
                this.reset = SUB_Remove;
index 172e0a9e5719c0e1efe37faf3e43bf6e17f34859..40e708e86304b616a8422978689f5c29ace32d41 100644 (file)
@@ -44,6 +44,8 @@ float servertime, serverprevtime, serverframetime;
 
 .float contents_damagetime;
 
+string GetField_fullspawndata(entity e, string f, ...);
+
 /*
 ==================
 main