Current precache model count/table
It would be great if we could have a function like util.GetPrecacheModelTable(). Then we can switch the map before it crashes.
[lua] if ( #util.GetPrecacheModelTable() >= 1000 ) then game.ConsoleCommand("changelevel gm_construct\n") end [/lua]
I wrote something semi-similar for my game-mode and for the skeleton game-mode I am releasing soon. But, it just made sure the util functions were only called once per model / sound. I'm going to extend it to actually override util.PrecacheModel and Sound. I would write a pull request with that feature to include access to the table but I don't see where util.PrecacheModel/Sound is in the code. It may be a C function. If that's the case I can still over-write it to give the functionality but it'd be a "hack" job so I don't think it'd be inserted, and if it's a C function Garry would need to add it in. I do support it, but you'd have to create the hook ( and, the best way to do it would be from the function itself so as a new model/sound is being added, it checks to see if it's about to go over, if so then it calls a hook and you do what you want in the hook )
I may write something up for you when those are called with a few config options and put it in game-mode and addon releases.
To add LUA code, use 3 of these followed by lua on the same line together, then add lua, then on a line by itself add 3 more to end it.
Escaped example:
LUA CODE HERE
Having a engine.GetModelPrecacheCount() and engine.GetModelPrecacheTable() of some sort would be super useful, should be relatively simple to implement as well 👍
I know that this issue is from 2013 but it still is something that would be great in 2024 as there is simply no good way to otherwise do it.
Nice, duplicate issues get read/closed 10 minutes after submission while the original didn't see any developer feedback for 10 YEARS.
classic rubat, instead of actually reading the request, finds the nearest duplicate to continue to ignore it