TTT-2 / ttt2-pointer

2 stars 5 forks source link

Workshop texture download #7

Closed Xalaxis closed 4 years ago

Xalaxis commented 4 years ago

When joining a server with this addon, rather than using the Steam workshop to download the pointer textures the client appears to download them directly from the server. I think there's a LUA function that can be used to tell the client to use the Steam workshop for those resources.

TimGoll commented 4 years ago

It's because I added resource.AddFile(). However this does nothing for servers without fastDL. So it shouldn't cause any problems.

Xalaxis commented 4 years ago

Perhaps it would make more sense to use resource.AddWorkshop()? I think that's the function I was thinking off. It won't be much quicker than server to client downloads, but I think it will save a couple of seconds.

TimGoll commented 4 years ago

It's just an addition for people using fastDL. If you want workshop download, use this addon: https://steamcommunity.com/sharedfiles/filedetails/?id=626604673

(All you have to do is to add this to your collection, no configuration needed. All addons will be downloaded from steam after adding this one.)

Xalaxis commented 4 years ago

Thanks for the link, I think that addon will achieve what I want. I wonder why workshop download isn't automatically enforced for all addons?

For people who aren't using the linked addon, is there any advantage to using AddFile() over AddWorkshop() in your code?

TimGoll commented 4 years ago

We could add this to all of our addons. However there are hardly any addons doing this so you'd still have to add this addon for other addons. But in general you're right.

We decided on adding support for fastDL, therefore we added AddFile(), we could also add both or none.

Xalaxis commented 4 years ago

Okay, thanks. That seems very sensible. Fastest issue resolution I've ever had 😄. Have a great day!

TimGoll commented 4 years ago

Glad I could help. You're welcome!

Xalaxis commented 4 years ago

Ah, I may have found a flaw with the global forced download method, this also forces the download of all, many, many maps in the server collection. Did you say that AddFile() could be used in addition to AddWorkshop() without issues?

TimGoll commented 4 years ago

yes, they both work alongside and hmm about the map thing, maybe there's a setting. But I'm no server expert. There are some on our discord if you have questions about servers.

Xalaxis commented 4 years ago

Would it be possible for you to use both techniques? Although I accept that lots of other addons aren't currently doing this, I think it's best practice to use workshop downloads where possible.

Please can I have an invite link to your Discord so I can have a chat about the server? :)

TimGoll commented 4 years ago

Oh. I'm not sure about adding this to this addon. However you could create a lua file in addons/<some name>/lua/autorun/server/xyz.lua with the recource.AddWorkshop() line(s).

Discord: https://discord.gg/Npcbb4W

Xalaxis commented 4 years ago

I've currently been creating manual overrides in that manner whenever I've noticed an addon that doesn't automatically register with AddWorkshop(). Something like 90% of my addons do seem to use it though.

TimGoll commented 4 years ago

I see your point. We'll talk about this in our team.

TimGoll commented 4 years ago

Okay, this one was fast. I've forgot why we decided against it, mainly for base TTT2. When using resource.AddWorkshop() while having a server that relies on fastDL (or a locally installed version in general) many funny things can happen.

We had some promblems with this in the past, see: https://github.com/Facepunch/garrysmod-issues/issues/3876

Xalaxis commented 4 years ago

That's a good reason. I can't really think of any good way around this problem other than Garry's Mod adding some sort of native support for forcibly not downloading addons if they are installed from outside of the workshop. Hopefully that facepunch issue goes somewhere.