Register from the hook. Always.
lua/autorun/server/myaddon_vetra.lua
- if Blueprints has not loaded yet, your handler simply waits for it;
- if it has, it has not fired the hook yet either. Blueprints fires it once the map has
finished loading, at
InitPostEntity, by which point every addon’s autorun has run.
Vetra.Blueprints.Adapters.HOOK.
What does not work
What your handler is given
Your handler receives the public adapter surface as its only argument. That is the entire SDK:Blueprints also ships one optional public helper,
Vetra.Blueprints.Entities, for
adapters whose domain is entity-backed. Nothing in the SDK requires it: the DarkRP adapter
does not use it at all.Adapters.Internal is Blueprints’ own and may change in any release.
The registration window closes
Registration is open only while the hook is being fired. AfterwardsAdapters.Register
refuses, and the refusal names the hook.
Registration from inside a capability function is refused for a related reason: it would
mutate the list a running capture is iterating.
Duplicate ids
First registration wins, and the collision is reported as the bug it is, naming both adapters and their versions. Handlers are iterated in sorted name order and each is called separately and defensively, so:- the outcome never depends on which addon loaded first;
- an addon whose registration handler errors does not take the others with it.
Validation at registration
Registration is where declarations are checked, not first use. A declared ability with no function behind it would otherwise be believed by the first caller that asks. Refused outright:
Warned about and ignored: