RaphaelIT7 / gmod-holylib

A library that contains some functions and optimizations for gmod.
39 stars 4 forks source link

Have a hook that runs whenever a new model is precached that passes the current precache count #2

Closed wrefgtzweve closed 3 months ago

wrefgtzweve commented 3 months ago

Can probably be added somewhere around here, would allow for map change when X count of models has been hit. https://github.com/RaphaelIT7/gmod-holylib/blob/8a9c8cd340dee28671b349409ac9cc45a95dac75/source/modules/precachefix.cpp#L57-L62

RaphaelIT7 commented 3 months ago

I added HolyLib:OnModelPrecache(string model, number idx) and HolyLib:OnGenericPrecache(string file, number idx)

RaphaelIT7 commented 3 months ago

Also, as a note, you could also use INetworkStringTable:DeleteAllStrings to nuke the modelprecache stringtable, and then you should only need to reconnect all clients to clear the CClientState::model_precache table clientside (or else weird shit happens, because the client will probably use the wrong model for an index)

Rubat could maybe add a function to nuke the modelprecache table and to clear the CClientState::model_precache clientside which would solve the issue of it getting full and needing a mapchange to clear it(or having to reconnect all clients)

NOTE: I didn't test it in an hl2 build so it's just an Idea that could work or it could break something.