What each module gives you
- Events and Hooks are groups of
UgCore.Enums.EventsandUgCore.Enums.Hooks, such asUgCore.Enums.Events.Accounts.Changed. - Statebags are player statebags named
ug-core:<Key>, such asug-core:Job. identity,playersandpermissionsare required. They are always there.
When a namespace exists
Your resource learns which modules are enabled when ug-core replicates them, right beforeReady. Until then, and for disabled modules, module namespaces raise a clear error:
Module enums, such as
UgCore.Enums.DeathState or UgCore.Enums.Events.Jobs, follow the same rule: they exist once the module is enabled and replicated.
Require a module
When your resource cannot work without a module, require it. Server owners get one clear error instead of a broken resource:server.lua
Adapt to an optional module
When a module only adds something, check it and fall back:server.lua
server.lua
On the client
Clients follow the same rules. The client lifecycle reachesReady after the client files of every enabled module have loaded:
client.lua
Check list
Declare
dependency 'ug-core' and ug_core_version in your manifest.Use module namespaces, enums and events after
Ready.Call
UgCore.Modules.Require for modules you cannot work without.Check
UgCore.Modules.IsEnabled for modules you can work without.Handle every error code a function can return. Each module page lists them.