lotgd / core

Core functionality for Legend of the Green Dragon, a text-based RPG game.
GNU Affero General Public License v3.0
152 stars 15 forks source link

Module::handleEvent needs access to it's properties. #66

Open Vassyli opened 8 years ago

Vassyli commented 8 years ago

We should supply handleEvent as well with the module entity in order to access properties. This already is the case for onRegister/onUnregister. There are 2 possibilities:

austenmc commented 8 years ago

Hmm. Tough one. Module is not the only class that implements the event listener pattern.

Vassyli commented 8 years ago

Yep. Though the issue is not about extending the interface (adding additional nullable parameters are allowed by php), it's more that EventManager now needs to tingle with the ModuleManager as well.

How about suscribing module events in a separate table and let ModuleManager suscribe to all events (using a pattern that matches everything) which then propagates the event to the modules?