-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate registering listeners on the shell menu #297
Comments
What are the downsides to using a new boolean RegisterInShell for the CHEventListenerTemplate (or even for X2EventListenerTemplate) and then registering event listeners with that boolean set to true, in OnInit of UIShell or UIFinalShell, and then removing them prior to unloading the shell level? |
Update: This seems somewhat difficult, as there are lots of places on the shell menu where the history is reset, clearing all registered listeners. Probably better to wait for a real use case or problem before attempting this... |
Well the Issue #783 would be a real use case, I even have the Event done and set up. I'm perfectly content with changing it to a DLC hook, though. I'm not sure if there's something that an Event would accomplish, but a DLC hook would not, in this specific case, since there's all event listeners would have to use ELD_Immediate to take advantage of it anyway. |
Somewhat related: personally, I think we should register strategy listeners before calling |
I have a new "real use case" with events for the mcm actions in my mcmbuilder that should work in the shell too. @robojumper is this something you would consider to pick up again? |
Conceptually, the shell is much closer to strategy than tactical. Are there any drawbacks to just registering strategy listeners on the shell? |
Strategy listeners can expect things like |
Just tested calling |
wouldn't none checking that be in the error handling responsibility of the listener code? |
Why would you check for existence of global singletons? |
Cause there are obviously situation where they are not there |
Please state an example of |
X2WOTCCommunityHighlander/X2WOTCCommunityHighlander/Src/XComGame/Classes/XComHeadquartersCamera.uc Line 74 in d80a587
|
That is an example of a check. It might've been wrong, for old code, called too early into strategy setup or many other reasons. What I'm asking is an example scenario which would cause |
The point is you can also listen to events beside event templates which have no bIsStrategy so perse there is no guarantee when a listener is called. I see your point and I am not against a new bIsShell or whatever. Just saying making assumptions in code always having the possibility of error when code changes or the assumption is not true for an edge case. |
So the two linked issues only need to have listeners registered in time for campaign initialisation, not necessarily as soon as the shell menu is displayed. I don't know if that would suit Musashi's use case, but it should certainly be pretty straightforward to implement. I would also like to voice my support for having a new type of listener that isn't either strategy or tactical. I think there's a strong chance that registering existing strategy listeners before a campaign is initialised will break some mods. Unless we can guarantee that none the existing strategy events are fired at an earlier point than they currently are. |
This change adds an extra `RegisterInCampaignStart` boolean to CHL event listener templates (on top of the existing `RegisterInTactical` and `RegisterInStrategy` ones). Listeners registered for campaign start will now receive events that are fired during campaign initialization, which strategy listeners don't receive. Resolves X2CommunityCore#297.
This change adds an extra `RegisterInCampaignStart` boolean to CHL event listener templates (on top of the existing `RegisterInTactical` and `RegisterInStrategy` ones). Listeners registered for campaign start will now receive events that are fired during campaign initialization, which strategy listeners don't receive. Resolves X2CommunityCore#297.
This change adds an extra `RegisterInCampaignStart` boolean to CHL event listener templates (on top of the existing `RegisterInTactical` and `RegisterInStrategy` ones). Listeners registered for campaign start will now receive events that are fired during campaign initialization, which strategy listeners don't receive. Resolves X2CommunityCore#297.
Currently, X2EventListeners are registered in tactical, and in strategy. The fact that they don't work on the shell screen was a drawback we accepted whenever we decided to use an event hook instead of a DLC hook.
TLE moves some UI to the shell that may be relevant for event hooks (dynamic class icons, for example). We should investigate whether registering on the shell is wanted.
The text was updated successfully, but these errors were encountered: