Open em92 opened 1 year ago
Hmmmm, that should be possible by modifying the last_init method, and plugin_load mechanism, and modifying add_hook in the plugin class to register the handler for the given hook.
Note that I also added the handle_frame event which is called once per server frame, i.e. 40 times per second on default server settings to your list of events that maybe should be hot pluggable.
For example:
damage
hook https://github.com/MinoMino/minqlx/pull/120minqlx.register_handler("damage", handle_damage)
is executed from PR above.When damage is registered QLDS runs python code around
handle_damage
and https://github.com/MinoMino/minqlx/blob/390d6c11ec15c2df060765a7416f64f6d0eebfd3/python/minqlx/_events.py#L41-L98, which wastes extra CPU time and clearly does not do anything useful.So it would be better, if
minqlx.register_handler("damage", handle_damage)
only if plugin or minqlx itself requires it.That also concerns to other hooks below, but comparing to
damage
hook, they are executed less frequently