overriding resource.AddFile

I added a shitload of workshop addons to my server and the problem with some of them is that they force the clients to download some files using fastdl. I don’t want that, I want the clients to only download the most important ones that I choose with resource.AddWorkshop, and I want them to download the rest themselves if they want to. One way I thought of doing this is to override resource.AddFile with a function that does nothing to prevent any addons from forcing downloads on their files. But I would have to do that before these addons run their code. Is there any way to ensure this order, like placing that function under some specific path or filename? Or maybe there’s some other way to completely disable file downloads from the server and only allow workshop downloads?

You can override a file in lua/includes/modules as they have the highest load priority, or just extract the workshop addons.

as code_gs said, it’s best to do this somewher in includes/modules; something along these lines



resource.AddFileOld = resource.AddFile
function resource.AddFile( ... )
return
end


if you ever need to use it for your own addons, simply call resource.AddFileOld