Auto-Dismount After OnPreTransition #2692
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Auto Dismount AFTER OnPreTransition
For a mod, I wanted to use the
OnPreTransition
event listener defined in "PlayerEnterExit.cs" to know what theTransportMode
was prior to transitioning into an interior. However, "TransportManager.cs" automatically sets theTransportMode
to foot on this event. So, what theTransportMode
was prior to the transition isn't able to be known by anyOnPreTransition
event listeners after that one has been triggered, and the workaround for this isn't as performant as just checking what theTransportMode
is on this event.In my opinion, it makes more sense semantically for the
OnPreTransition
event to be able to access what theTransportMode
was pre the transition.Therefore, this PR simply sets the
TransportMode
to foot in the "OnTransitionInterior" events instead.TransportMode
inside, so when we exit, we will already be on foot and don't need to auto dismount.The changes in this PR shouldn't change anything for the player and there doesn't seem to be any problems in my play testing. There is nothing in the code that relies on the
TransportMode
being set to foot on theOnPreTransition
event, so nothing should break.Ultimately, it would be nice to allow developers and modders to know what the
TranportMode
is prior to transitioning into an interior using theOnPreTransition
event, and not require a less performant workaround.