docs: restructure README into Usage and For mod development sections
This commit is contained in:
@@ -4,7 +4,21 @@ Server-side mod for Vintage Story. Lets other mods hook into chat commands
|
||||
before and after they run, namespaced per mod so multiple mods can watch
|
||||
the same command without colliding.
|
||||
|
||||
## How it works
|
||||
## Usage
|
||||
|
||||
Install it like any other mod. It has no effect unless something else
|
||||
depends on it.
|
||||
|
||||
## For mod development
|
||||
|
||||
Add it as a dependency in your `modinfo.json`:
|
||||
|
||||
```json
|
||||
"dependencies": {
|
||||
"game": "1.22.3",
|
||||
"commandhook": "1.0.0"
|
||||
}
|
||||
```
|
||||
|
||||
CommandHook patches `ChatCommandApi.Execute` and dispatches to whoever
|
||||
has registered. Your mod doesn't patch anything itself, it just implements
|
||||
@@ -28,7 +42,7 @@ path where the command actually ran.
|
||||
`CommandData` is passed by `ref` the whole way through, no allocation per
|
||||
command.
|
||||
|
||||
## Example
|
||||
### Example
|
||||
|
||||
```csharp
|
||||
public class MyListener : ICommandHookListener
|
||||
@@ -83,4 +97,3 @@ public override void Dispose()
|
||||
|
||||
Calling `Register` again with the same `ModId` replaces your existing
|
||||
registration. If your `Commands` list hasn't changed, it's a no-op.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user