- Site Admin
- Posts: 4050
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
This was a tricky thing to do for a multitude of reasons. But there is no way to know if an event is enduring or not until it gets triggered.
So what I have done is created an EventGhostEnduringEvent class that is a subclass of EventGhostEvent. so if you wanted to check the event type using isinstance then you will always have to check the instance against the EventGhostEnduringEvent. because if you check the instance against EventGhostEvent it will always return true. This is because EventGhostEvent is subclassed. and rightfully so because an enduring event is an event. the icon for each event type gets stored in the event. so this can also be used by simple comparison against the would be matching icon in eg.Icons. when you add an item to the tree if there is already the event used in the tree and has had the icon changed (by the triggering of the event). The new tree item will use the enduring event icon. The event type gets saved in the EG xml save file so it can properly load the icon when EG gets started. the icon also gets used in the log. if the icons in the tree have the default event icon and the event that gets triggered is an enduring event the icons for the event in the tree will then change to the proper one. this is the only downfall. I have not put into place a mechanism that will allow a plugin developer to map an event to an event type. as of yet. I wanted to get everyone's input on it first.