Closed uen closed 8 years ago
There exists no order that satisfies everyone. I've had people ask me to have modules run BEFORE shit is loaded. You're asking me to do it AFTER shit is loaded.
The decision is before, because you can always add a hook to do things later. In your case, OnGamemodeLoaded
Or loadCustomDarkRPItems
, that works better.
Description of the bug
DarkRP loads it's own modules first, then default custom things, then calls DarkRPFinishedLoading which loads any non-gamemode darkrp_modules and then the non-gamemode custom things in darkrp_customthings/*
Which means that any items added using DarkRP.createEntity in modules that require those jobs (such as for using .allowed: https://github.com/vrondakis/Leveling-System/blob/master/addons/darkrpmodification/lua/darkrp_modules/levels/sh_config.lua#L184 ) won't work unless the job was added in the gamemode (and already loaded)
How to make the bug happen
1) Create: /addons/test/lua/darkrp_modules/test/sh_items.lua
2) Add the following to that file:
3) Add the following to /addons/darkrpmodification/darkrp_customthings/jobs.lua:
4) Join the game, 'Test entity 1' will be purchasable because you're the TEAM_CITIZEN job, but when you switch to TEAM_MERCHANT neither 'Test entity 1' or 'Test entity 2' will be purchasable because you're not TEAM_CITIZEN and TEAM_MERCHANT wasn't available when the entity was added because it hadn't loaded the jobs file yet
Lua errors
Why the developer of DarkRP is responsible for this issue
I don't know if it's supposed to be this way but it doesn't seem possible to add items that use .allowed dynamically through modules unless the code to do so is in one of the darkrp_customthings files, which would still only work if that file was loaded after the other job files