Skip to content
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

Auto-Dismount After OnPreTransition #2692

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ArshvirGoraya
Copy link

Auto Dismount AFTER OnPreTransition

For a mod, I wanted to use the OnPreTransition event listener defined in "PlayerEnterExit.cs" to know what the TransportMode was prior to transitioning into an interior. However, "TransportManager.cs" automatically sets the TransportMode to foot on this event. So, what the TransportMode was prior to the transition isn't able to be known by any OnPreTransition event listeners after that one has been triggered, and the workaround for this isn't as performant as just checking what the TransportMode is on this event.

In my opinion, it makes more sense semantically for the OnPreTransition event to be able to access what the TransportMode was pre the transition.

Therefore, this PR simply sets the TransportMode to foot in the "OnTransitionInterior" events instead.

  • The "OnTransitionExterior" events aren't added as we can't change the 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 the OnPreTransition 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 the OnPreTransition event, and not require a less performant workaround.

@ajrb
Copy link
Collaborator

ajrb commented Sep 3, 2024

What's your use case for this?

@KABoissonneault
Copy link
Collaborator

KABoissonneault commented Sep 3, 2024

I think the use case is pretty clear (get what transport the player was using before entering the dungeon/interior). However, I'm not too good with the side effects of changing the order of events for mods currently using these events.
Couldn't the transport manager store its last transport mode and provide a new getter?

@ArshvirGoraya
Copy link
Author

@KABoissonneault

Get what transport the player was using before entering the dungeon/interior

This is it. I also agree that the potential side effects for mods already using this event isn't good.
I like your suggestion to store the previous transport mode. It's also something I mentioned doing in this PR: #2694

I made the changes here.

@ajrb
Copy link
Collaborator

ajrb commented Sep 5, 2024

I wanted to know if there was anything else required that I wasn't seeing. I think this can be done much simpler. I'll submit my proposal this weekend and you can take a look and verify it supports what you need.

@ajrb
Copy link
Collaborator

ajrb commented Sep 26, 2024

Sorry I have had some RL things come up with my aging dad and now I am on holiday for 2 weeks. I will get to what I said I'd do but it will be a little while longer. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants