Last updated
Last updated
Here are instructions to how to implement your own hooks for the general public using Carbon.
For documentation purposes, it's important to properly describe what the hook does, properly identify its ID and flags.
These attributes are entirely used by the documentation code-generation system of which outputs can be found .
Info
attribute, can be multiple.
Parameter
attribute, can be multiple. Are the exact parameter types and a readable name shown in the example.
Return
attribute, can only be one or none. It's the displayed return type in the generated example of the hook.
A primary requirement is the location of the patch, as well as the Prefix, Postfix and/or Transpiler methods.
Above the previous metadata attributes (or regardless of the position), you need to add the following attribute, defining the location of the patch.
Notice! If the method you're trying to patch does not have any arguments, please still keep the new System.Type[] { }
present.
We use regular Harmony patches for our hooks, so depending on the purpose of your hook, you may choose to use between a Prefix, Postfix and/or Transpiler.
For example:
We do not use Interface.CallHook
for our hook system which use direct hook name strings, instead we use hook identifiers as they're way faster to process.
We use almost exactly the same system Rust uses with StringPool
to get numeric identifiers out of string values.
It should look something like this: 499798872
, which then used in the HookCaller
, like this:
To get started with submitting your hook(s), please do the following;
Make your changes & commit to the fork.
Please use the correct sub-folder which should be treated as the category of the hook.
As well as the naming of the hook file should match the hook name.
Like src/Category/MyHookName.cs
.
Create a pull request for us to review and merge.
Please describe within your commit what the purpose of the hook is.
You can generate your own hook identifier, with .
Under this format:
Fork our repository.
Once all that is done, you'll find your hook(s) in the marked as a Carbon-only hook.
How to get started with submitting community-driven hook changes, requests and additions.