I've moved the framework caching to a new file `frameworkCache.lua`
This now caches the framework data once when `jim_bridge` starts
Then in `coreloader.lua` now, the information that is cached is now called from that script
This also includes better handling of ESX cached data and should stop errors
This greatly optimizes the loading of all my scripts and lowers server load to speed up server start times
I have been testing this for just under a week and 6 different test servers and it appears to work fine
When collecting Jobs from the server it tries it's best to determine which role is the "Boss"
It checks first of the Job Grade label containing the word "Boss"
If it can't find it, it then uses the highest number grade and adds `.isBoss = true` to it
Custom inventories apparently load items separately/later into qbshared
so the script starts thinking there is definitely 0 items but its checking too early, this forces it to wait until its available to continue
So information and request for help.
The issue here is that my scripts require Job and Vehicle information when the script starts, to do a debug check if the job exists for the location.
ESX doesn't share this with the client for some reason, so this requires me to request it from the server side at script ensure.
This is causing issues because it delays loading of the rest of `jim_bridge` while it slowly requests `ESX.GetJobs()` table from server side
This is delayed even more when the script is placed towards the top of the server load order and it needs to load other things like MLO's
As its trying to load this the rest of the script carries on loading with missing information.
So it loads the script thinking there are 0 jobs and breaks it.
If anyone knows of a better way of doing this then please help.
The only partial solution is to start my scripts last in the server load order
I realised I was loading ESX the stupidest way
I think I was loading ESX object, then instantly clearing it and then used workarounds to try and reload it (thinking is hard ok)
It should now load correctly and faster
also I realised my custom `onPlayerLoaded()` function was loading too fast, so I've added a delay to it but removed the while loops for esx checks that could potentially break the script
PS-Inv used to be exactly the same as QB-Inv so alot of the function calls were shared
This separates them and makes it easier to make changes to support their inventory
Also unified the calls for server side functions into single functions instead of having separate per inventory
Also moves:
- `invImg()` to inventories.lua
- `registerStash()` to stashcontrol.lua
Nothing public uses this yet, but its very similar to QBCore which makes it very for me to support
Nothing special to note, just improves the integration for future ventures into RedM