3.8 KiB
id, title, slug, description
| id | title | slug | description |
|---|---|---|---|
| greg-hook-naming | greg hook and event naming | /reference/greg-hook-naming | Canonical naming for hooks, events, and cross-language documentation stubs. |
greg hook and event naming
Target format
All new public hook and event identifiers should follow:
greg.<Domain>.<EventOrHook>
greg— Fixed prefix (Greg Mod Framework / gregFramework hook namespace).<Domain>— Uppercase domain from the approved domain list. Describes where the signal belongs in the game (player, rack, server, economy, …).<EventOrHook>—PascalCasesegment(s), usuallyOnSomethingfor events or a verb phrase for commands.
Examples (illustrative): greg.RACK.CableSpinnerColorResolved, greg.PLAYER.InputPoll, greg.NETWORK.Cable.OnConnected.
Approved domain segments
Domains are closed by default. Add a new domain only via changelog + maintainer review.
| Domain | Scope |
|---|---|
GAMEPLAY |
Rules, scoring, simulation beats not covered elsewhere |
PLAYER |
Local player input, camera, UI focus |
EMPLOYEE |
NPC staff, hiring, schedules |
CUSTOMER |
Contracts, SLA, satisfaction |
SERVER |
In-game server racks, VMs, power |
RACK |
Physical rack placement, mounting |
NETWORK |
Cables, switches, traffic |
STORE |
Shop cart, checkout |
WORLD |
Rooms, expansion, walls |
UI |
HUD overlays, menus (when not PLAYER) |
SAVE |
Save/load lifecycle |
FRAMEWORK |
Loader, bridge, diagnostics |
Runtime IL2CPP (MelonLoader): greg.*
Harmony patches in gregFramework emit stable greg.<DOMAIN>.<Action> strings via GregHookName / GregEventDispatcher. That surface is documented in greg hooks catalog (IL2CPP) (greg_hooks.json, regeneration, overlap with hand-written HarmonyPatches). It is separate from the greg.* / greg.* documentation constants below.
Native pipeline: GregNativeEventHooks (replaces HookNames)
Numeric EventIds are mapped to canonical greg.* strings in GregNativeEventHooks (source), aligned with greg_hooks.json where that file names the patched method. Logging uses GregNativeEventHooks.Resolve(uint); unknown ids ? greg.SYSTEM.UnmappedNativeEvent.
GregCompatBridge (source) redirects deprecated hook spellings (including older documentation-style names) to the current greg.* string — see also legacy entries in greg_hooks.json.
Policy
- New documentation identifiers:
greg.<Domain>.*as above. - New runtime subscriptions: always
greg.*viaGregHookName.CreateorGregNativeEventHooksconstants — see greg hooks catalog.
Cross-language stubs (documentation)
For each canonical hook, the wiki may add non-normative snippets:
| Language | Convention |
|---|---|
| C# | greg.Domain.OnSomething.Subscribe(...) or string literal |
| Lua | greg.Domain.OnSomething:subscribe(...) |
| Rust | greg::domain::on_something::subscribe(...) |
| Python | greg.domain.on_something.subscribe(...) |
| TypeScript | greg.Domain.OnSomething.subscribe(...) |
Bindings are not auto-generated for all languages; stubs are for contributor clarity.
Related
- greg hooks catalog — EventId ?
greg.*(generated) - greg hooks catalog — Short overview / Redirect
- greg hooks — declarative surface (may be superseded by the core registry)