milkytoasto / DSChaosMod

Twitch integration solution for Dark Souls
GNU General Public License v3.0
3 stars 0 forks source link

[Feature Request] Trigger effect cleanup / stoppage when the Stop button is pressed in the GUI #5

Closed milkytoasto closed 1 year ago

milkytoasto commented 1 year ago

This potentially shares some overlap with #4

I'd like to have the application handle the stop event in such a way that it removes whatever current effect is in place, and executes some 'cleanup' code. Similarly to the previously mentioned issue, this could be handled via the stop method call within effects.

This, unlike the aforementioned issue. could actually be handled with a try/except/finally block, with the cleanup being run when an exception is thrown. Likely being placed around the await self.current_effect.start(self.pm, self.module) method call within ChaosHandler.

We would likely have to store some kind of class variable within effects to flag if the effect has been stopped, however. This way the user wouldn't be able to press Stop, then exit the application, thereby causing the cleanup to execute twice.