garrysmod
garrysmod copied to clipboard
Call GM:MouthMoveAnimation via hook library
I think this should be a hook, so addons that control the mouth can work without overriding the gamemode function and screwing eachother up
might as well do the same for GrabEarAnimation then too
This function is called pretty frequently, right? I wonder about the performance impact of doing work inside hooks for this function. Then again, if addons are already doing it, providing an official method likely wouldn't make things worse.
Check out how the popcorn and vape sweps deal with this. The popcorn swep overrides the global gamemode function which is obviously prone to issues, should any other code override the function. The Vape swep has an ugly solution and may break with code refreshes.
When calling a hook inside of a GAMEMODE function, you should use hook.Call and pass the current table (self in this case).
It looks like the same mistake was already in the code by calling the GAMEMODE global.
yupi, I don't agree, as I don't think addons use it. That's very subjective though. bmwalters, I don't think the hook overhead is significant here.
This would finally stop addon creators from overriding this.
how u dare using hooks in gamemode