[scarpet] enityt_load_handler doesn't sometimes dectect scope global
Firigion opened this issue ยท 4 comments
Since apps are laoded sequentially, if you have an app that defines entity_laod_handler
and later in the code defines __config
setting the scope to global, the app will fail to load stating that the former needs the latter to function, even tho global scope si defined, albeit later in the file. I understand this is only a very minos annoywance, but it can
- Be confusing for new commers
- Be sligtly annoying for people that, like me, like to have the config at the bottom of the file.
Are you running entity_load_handler
from outside any function? I think this shouldn't happen if you call it inside the on_start (https://github.com/gnembon/fabric-carpet/blob/master/docs/scarpet/Full.md#__on_start) event.
Yup, I was running it outside functions, I forgot wrapping it into __on_start
would ensure it runs after configuration has been applied. Do you think some sort of note about config and on_srart should be made in the docs? If not, feel free to close the issue.
What would be the best place to add that? I woudn't add it to 'entity_load_handler` specifically because its a global effect for all player scoped apps and all methods that set some handlers.
mmm in the on_start
entry?
current text:
[...] Static code (i.e. code typed directly in the app code that executes immediately, outside of function definitions), will only execute once per app, regardless of scope, '__on_start()' allows to reliably call player specific initializations. However, most event handlers defined in the static body of the app will be copied over to each player scoped instance when they join.
proposed addition:
Note also that this will run after
__config
has been applied, meaning function calls that require things like scope being defined to work should go here.
Something along those lines?