Closed renatomassaro closed 6 years ago
ObjectBlocker cannot be implemented in a similar fashion to ObjectListener, it would be extremely inefficient.
Helix.Event.emit/1
.Contrast this to ObjectListener, which:
So, if a ObjectBlocker-like behavior is desired, it must be implemented at the Henforcer level:
Event.t
is emitted.
The idea behind ObjectListener is to create a global listener on game objects that react to certain events, registering a callback when that event occurs.
Sample use case:
Solution: Add a listener:
Also possibly useful:
ObjectBlocker. Similar to Listener, but performs the check before the action, blocking it in some cases. So, on the above example, it would be possible to not allow the file X to be deleted on the first place.
All macros for illustrative purposes only.