Ulysses

General => Developers Corner => Topic started by: iViscosity on May 05, 2017, 11:22:47 AM

Title: Any way to force autorun priorities?
Post by: iViscosity on May 05, 2017, 11:22:47 AM
So after some research (https://facepunch.com/showthread.php?t=929628&p=21578446&viewfull=1#post21578446) and it seems that the lua loading priority is
Code: [Select]
lua/autorun
lua/autorun/server|client
addons/lua/autorun
addons/lua/autorun/server|client
gamemode/

Is there any way to force an addon to load AFTER a specific addon has loaded? I was thinking of making them all under a function and if the addon it's waiting for isn't defined yet, wait a few seconds then re-execute the function once it has.
Title: Re: Any way to force autorun priorities?
Post by: MrPresident on May 05, 2017, 07:21:04 PM
I believe that addons are loaded in alphabetical order. Try renaming your addon directories so that they're ordered in the way you would like. Or you could number them.

garrysmod/addons/1.ULib/
garrysmod/addons/2.ULX/
garrysmod/addons/3.Pointshop/
garrysmod/addons/4.OtherAddonExample/


etc etc etc.

Not 100% sure this would work, but it might.

Keep in mind the way the filesystem orders numbers.

12 might come before 2.

example:

0
1
11
12
2
3
4
5
6
7
8
9
Title: Re: Any way to force autorun priorities?
Post by: JamminR on May 05, 2017, 07:56:21 PM
Been a long time since I've seen this discussed. 3-4 years ago now for sure, it was alphabetical, especially in linux where upper case and lower case were sorted differently. (I forget, think uppercase was before lower)

Unfortunately, there's no way to rename workshop subscriptions to meet your order need.
Title: Re: Any way to force autorun priorities?
Post by: MrPresident on May 05, 2017, 07:57:09 PM
If it was that important, you could extract workshop addons and convert them to legacy addons.
Title: Re: Any way to force autorun priorities?
Post by: iViscosity on May 05, 2017, 08:08:52 PM
It isn't incredibly important, but it could be useful. I learned that for my purposes it wasn't necesary because it doesn't use other addons on autorun, but during certain hooks (that happen after the server is already running)
Title: Re: Any way to force autorun priorities?
Post by: JamminR on May 05, 2017, 08:21:45 PM
Does the addon you're wanting to run after have 'ready/loaded' callback hooks?
Or a table that's only in the addon?
Shouldn't be difficult to monitor either and run after.
ULib has a 'player ready' hook that gets called on server and client when a client is ready to run commands.



Title: Re: Any way to force autorun priorities?
Post by: iViscosity on May 06, 2017, 06:10:50 AM
Nah, it's nothing like that. It runs off of ULibCommandCalled and PlayerDisconnected hooks.