local functions will now use `mod` instead of `self` to be more clear about intent.
_registry now holds hook_data and nothing else, as a registry should. This will make it easier to implement the hook debugging utilities planned later on.
_registry.hooks and _registry.origs have been renamed to _hooks and _origs.
mod:enable_all_hooks and mod:disable_all_hooks are now both calling the internal toggle_all_hooks_for_mod function to be consistent with the rest of the API.
It will throw an error if you're trying to update a hook using a different hook_type api to prevent any weirdness by jumping from one chain to the other.
Also created a specialized function for hook_data initialization.
This makes it much easier to give the function name in the error/warning messages and we can easily get the hook type based on function name.
Also, swap around enable_hook and similar function to hook_enable format to keep backward-compatibility with existing mods.
Instead of having a single enable/disable_hook call that requires modders to know hook type IDs, make separate APIs for all types.
This also makes it much easier in the future to improve the system or handle new use case scenarios easily.
A lot of the code ended up being duplicated between the four api calls,
on top of that some type handling checks had to be made in both create_hook and get_orig_function.
This lead to a very messy state of things, so combine all of the handling into a single function,
then we can proceed with the rest of the code expecting one thing.
Having a single entry point made it very easy to add support for delaying hook cleanly.
Also add support for "Obj.Method" notation for backward-compatibility with old hooks.
I initially tried to use string.split provided by fatshark's code, but it creates a table, and requires a lot of supporting code that is all avoided by using a simple string.sub call.
- Comment out the old hooks.lua
- Remove the HookMixin table in favor of using VMFMod.
- Update UIRenderer hook to adjust for changes in the new system.