Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hook.ProtectedRun and hook.ProtectedCall functions #2175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Srlion
Copy link

@Srlion Srlion commented Dec 18, 2024

hook.ProtectedCall/ProtectedRun will execute hooks without interruptions. If a hook returns a value or encounters an error, it will not halt the execution of the remaining hooks.
These functions are particularly useful for hooks that do not expect a return value, such as Initialize hooks.
Many poorly designed addons in the workshop return values within critical hooks, making it difficult to track down what is preventing a hook from working correctly or causing issues.

Here is a simple list of hooks that could benefit from it:
GM:PreGamemodeLoaded
GM:OnGamemodeLoaded
GM:PostGamemodeLoaded
GM:Initialize
GM:OnEntityCreated
GM:EntityRemoved
GM:InitPostEntity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant