Skip to content

Regenerating the hook reference#

The Game Hooks page reads generated JSON under docs-cr/data/. Regenerate it when augment.manifest.json changes (after a hook-enabled game build).

Prerequisites#

pip3 install pyyaml

Generate#

From the docs-cr/ folder:

cd docs-cr
python3 regen_json.py ../pc/build/augment.manifest.json

If pc/build/augment.manifest.json already exists, you can omit the path:

python3 regen_json.py

From the repository root:

python3 docs-cr/regen_json.py pc/build/augment.manifest.json

Output files#

File Used by
docs-cr/data/cr_hooks.json Game Hooks browser (names, categories, signatures)
docs-cr/data/cr_reference.json Full struct/enum/function dump (structure only)
docs-cr/data/cr_types.json Struct/enum field lists for Game Hooks type tooltips
docs-cr/data/cr_descriptions.json Compiled from yaml, hook/type descriptions for the UI

To rebuild derived files from an existing reference dump:

python3 regen_json.py --from-reference

Adding descriptions#

Edit docs-cr/data/cr_descriptions.yaml only for custom text. The generator compiles it to cr_descriptions.json and fills in common da*_c actor hooks automatically (see docs-cr/scripts/auto_descriptions.py, Execute, Draw, action_*, damage_check, and similar shared methods). Override a specific hook in yaml only when the template is wrong.

Hook overrides use C++ flat names (ClassName::method):

functions:
  "daCow_c::Execute":
    description: "Main per-frame tick for a cow actor."
    category: "Actors"

Commit the updated docs-cr/data/cr_descriptions.yaml and regenerated docs-cr/data/*.json with your PR.

Legacy / advanced#

Lower-level generator (still supports courage_bindings.d.ts if needed):

python3 docs-cr/scripts/gen_reference.py --from-manifest pc/build/augment.manifest.json
python3 docs-cr/scripts/gen_reference.py --dts /path/to/crxts-types/include/generated/courage_bindings.d.ts

To rebuild cr_hooks.json from the old tuple-based hooks dump (must contain a top-level hooks array):

python3 docs-cr/scripts/gen_reference.py --from-hooks /path/to/legacy_hooks.json

See docs-cr/scripts/README.md for add_script_labels.py (Luau/TypeScript example labels).