Hook system improvements

+ Allow assigning multiple hook types to a class.
+ Add hook types, that are executed (almost) on every occasion.
This commit is contained in:
magmaus3 2022-11-20 13:21:45 +01:00
parent d4b2efe048
commit e66ed05ef7
Signed by: magmaus3
GPG key ID: 966755D3F4A9B251
2 changed files with 23 additions and 23 deletions

View file

@ -11,8 +11,9 @@ hook = hook_system.hook
class Login:
# Different hook types are executed at different places.
# In this case, the hook is executed when a user logs in.
#
# Check the documentation for more hook types.
hook_type = "player_login"
hook_type = ["player_login"]
def __call__(self, *args, **kwargs):
def __call__(self, hook_type, *args, **kwargs):
print("LOGIN HOOK:", args, kwargs)