]> git.megabrutal.com Git - pmprecache.git/commitdiff
Add teamplay models to precache list
authorMegaBrutal <megabrutal+github@megabrutal.com>
Fri, 28 Mar 2025 01:30:00 +0000 (02:30 +0100)
committerMegaBrutal <megabrutal+github@megabrutal.com>
Fri, 28 Mar 2025 01:30:00 +0000 (02:30 +0100)
dllapi.cpp

index 942fc91d11d03840fbe42b52dbcaaf11ffed954e..436c638269db22c769ad3e0025d7975613bfb225 100644 (file)
@@ -126,6 +126,22 @@ void ClientPutInServer( edict_t *pEntity ) {
 }
 
 void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) {
+       // Precache teamplay models, if it's teamplay
+       if (gpGlobals->teamplay) {
+               LOG_MESSAGE(PLID, "Adding teamplay models to precache list");
+               char teamlist[256];
+               strncpy(teamlist, CVAR_GET_STRING("mp_teamlist"), 255);
+               char *teammodel = strtok(teamlist, ";");
+
+               while (teammodel != NULL) {
+                       if (addPrecacheEntry( "server teamplay", teammodel ))
+                               LOG_MESSAGE(PLID, "Added teamplay model %s to precache list", teammodel);
+                       else
+                               LOG_MESSAGE(PLID, "Teamplay model %s not added - redundant or precache list is full", teammodel);
+                       teammodel = strtok(NULL, ";");
+               }
+       }
+
        bool hasBMP, hasTMDL;
        LOG_MESSAGE(PLID, "Precaching %d player models", precache_count);
        for (int i = 0; i < precache_count; i++) {