-
Notifications
You must be signed in to change notification settings - Fork 346
Extends functionality for modders to modify horse riding speed. #2735
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Below is the download link for the Unity package of my sample mod. You can click the link, unzip it and unpack the unity package to the Assets>Game>Mods folder of your DFU Unity project. I'm hoping this can help with the testing process for those who are interested in giving it a try. Click this link to download FasterHorseRidingMod.zip I have also provided a snippet from the unity package below so that you can see how the mod would utilize the functionality I've written in the merge request.
|
@ajrb Was that really not possible before? I know you've played with something similar, like the sprint you have in R&R. Maybe this is different, I'm not sure |
Hi @KABoissonneault , if it's possible to do it another way then I'm happy to consider that.👍 I did talk to other modders on the Lysandus' Tomb Discord working on a mod that increases the variety of rides among other things. They told me the following:
I wonder if @ajrb can weigh on it when he has the time. I'm always happy to delete or modify the pull request, of course. |
Hi, thanks for being patient and waiting for me to respond. The PlayerSpeedChanger class was not one I was veyr involved in, I only added changes to support the horse speed. This was based on the player speeds and thus the player speed stat - hopefully matching classic DF for horse and cart as best we could. I always considered that a mod of movement speed would operate on the base speeds. Anyway I have no problems with these changes, however I will add some review comments. |
private const float dfRideBase = dfWalkBase + 225f; | ||
private const float dfCartBase = dfWalkBase + 100f; | ||
private const float dfRideBase = 375f; | ||
private const float dfCartBase = 250f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change these definitions? Making this change would lose the context that the base speeds are based on the difference to the walk speed base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, this was purely a personal taste change and I think it can be discarded as it has no functional impact. These values are constants meanings they will never change during gameplay (if I'm not mistaken). Since they were not multiplied by the walk speed and were simply used in an addition I preferred to see them as their actual value instead of having to go and look at the walk speed.
float rideSpeed = (GameManager.Instance.TransportManager.TransportMode == TransportModes.Cart) ? dfCartBase : dfRideBase; | ||
baseSpeed = (playerSpeed + rideSpeed) / classicToUnitySpeedUnitRatio; | ||
float currentRideBase = 0; | ||
bool playerIsRidingHorseWithNoCart = GameManager.Instance.TransportManager.TransportMode == TransportModes.Horse; | ||
if (playerIsRidingHorseWithNoCart) | ||
currentRideBase = dfRideBase; | ||
else | ||
currentRideBase = dfCartBase; | ||
baseSpeed = (playerSpeed + currentRideBase) / classicToUnitySpeedUnitRatio; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why this code is being changed.. I can't see any difference in what it does, it's just more verbose and in my eyes less easy to see what is being done. I might be biased since these lines were added by me, happy to take a consensus if many feel it's better written the new way, but otherwise I'd rather this change is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making it simple stupid and more 'verbose' as you put it. When code reads like prose it can sometimes help me understand it better; that's probably why I changed it. I believe no functional change in here so please feel free to pick the version you like. 👍
The speeds are based on normal char speeds with modifiers for horse/cart, normally sprinting is disabled when riding but R&R enables it when riding a horse. |
Hi, I've found out that it was not possible for modders to modify the horse riding speed in DFU. I took some liberty in refactoring this script and adding this exact functionality. I followed the same format with which walking and running speeds were modified to keep my addition predictable and in line with the existing material. I also took a bit of liberty in renaming a few things, removing some possibly redundant comments, rewriting missing/incorrect comments as well. I made sure none of my changes impacted existing mods by keeping everything backwards compatible. I did some light testing to see if things are working as intended and they seemed okay but would love it if someone took the time to test it thoroughly. I'm by no means a stranger to Unity or coding with C#. I got many years under my belt but this is my first contribution in a public repo ever so please let me know if something doesn't make sense or if you have any input. I'm just a guy who wants to mod his horse to ride faster. 🐴