Is resource.AddWorkshop broken ?

Hi,

I’ve extracted a few workshop addons to fix/replace lua code within the addon and run it locally on my server, thus I don’t wish to have it in our workshop collection. So I decided to use resource.AddWorkshop to force client’s to download these addons so they can have their models, materials and sounds. For some reason this does not force my client to download the addon whatever I try.

I’ve detoured resource.AddWorkshop and it is indeed being called, and the function is being called within autorun/server.
I checked if it was conflicting with my server using a collection, disabled it and it made absolutely no difference.

cl_downloadfilter is set to “all” on my client.

Does anyone have any ideas, is this function actually broken or something?

Thanks!

Could you post the exact code that isn’t working?

[lua]local oldResourceAddWorkshop = resource.AddWorkshop

g_WorkShopTable = {}
function resource.AddWorkshop( id )
g_WorkShopTable[ id ] = true

oldResourceAddWorkshop( id )

end

resource.AddWorkshop( “104548572” )
resource.AddWorkshop( “180507408” )
resource.AddWorkshop( “609456211” )
resource.AddWorkshop( “673698301” )
resource.AddWorkshop( “742357482” )[/lua]

PrintTable( g_WorkShopTable ) prints out

[lua]104548572 = true
180507408 = true
609456211 = true
673698301 = true
742357482 = true[/lua]

That is run in autorun/server

The client is not forced to download the workshop addons listed above.

sv_allowcslua is set to 0 (Don’t know if that helps)
the server uses its own collection too

Do you have downloads enabled in Options -> Others? It should be set to Allow all downloads.

As mentioned above: cl_downloadfilter is set to “all” on my client.

Yes

This is set to one by default, but is your cl_allowdownload also 1?

Yes. I’m pretty sure these commands are related to downloading files from the server/fastdl not to workshop

cl_allowdownload
cl_allowupload
sv_allowdownload
sv_allowupload

Then your diagnosis of the problem is incorrect.
resource.AddWorkshop is not broken.

Do you mean a listen server by “locally on my server”? (starting a server from your game client).
Or are you in singleplayer?
What about players who join your “local server”?
How do you know for a fact that it’s not being downloaded?
Maybe they already have it up to date in their cache and thus don’t need to download?
Have you tried clearing your cache?
And by “download” i’m assuming you mean they aren’t being mounted in gmod.
Have you checked the clients mounted information?

What have you tried when you say “whatever i try”?

  1. SRCDS, not a local server.
  2. The server is hosted on a dedicated box not on the same computer.
  3. It’s not being downloaded OR mounted because its not in my engine.GetAddons() list, it’s not inside of my addons folder AND it is not being downloaded (watching the HUD at the bottom of your screen)
  4. This is of a FRESH garry’s mod install
  5. Regular workshop collection addons (that the server uses) are downloaded and mounted on clients, whereas addons through resource.AddWorkshop() are not downloaded by clients.

Could be the workshop collection being set overriding the resource.AddWorkshops.
Unset it and see what happens.

Yeah I’ve already tried that. It might be my client doing something weird. I will reinstall GMOD again and see what happens. It’s quite odd really.

What of other players who join it?

Does the hosting pc have an internet connection?

Here’s a suggestion. Use FastDL and just download everything off the workshop that’s in your collection.