Inventory event handling was overhauled this week. That wasn’t the plan, but it was necessary to get visual effects for items created by interactions fully functional. The UI code was a pain to work with because the extensive use of events made it difficult to follow. And, the event logic was a mess. Some events were redundant, some events didn’t have any listeners, some events weren’t being raised in all of the places they needed to be, and some events were being raised in too many places. To get a handle on the UI event logic, I made a list of every event, its intended purpose, every class and method that raised it, every listener, and what the listener did. With this information I was able to understand what the UI was doing and where events and listeners needed to be added and removed. Visual effects for item interactions now work correctly and the UI event logic is more straightforward.
Next week, I’m focusing on actor movement. I’ll fix a few movement-related bugs and make the number of times an actor can move in a turn configurable. The latter will be used to have enemies that move slower or faster than the player and haste/slow effects.