Moddable weapon reach#2804
Open
RedRoryOTheGlen wants to merge 1 commit into
Open
Conversation
…using a getter/setter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added a getter/setter to WeaponManager that can override the player's weapon reach.
The intention is to maintain the current behavior but allow mods to change the value of the reach. Currently, WeaponManager will continuously set FPSWeapon's Reach property to the defaultWeaponReach value every time the hands are updated so it's a massive pain to keep changing it from outside as a mod. In this PR, there is a getter/setter that can return either the default weapon reach value or a new public override variable. The override variable will only be used if the set value is greater than 0. Otherwise, the current default weapon reach value is used.
This change allows mods to set a custom value for the weapon reach once, and also easily reset it by setting the override to 0.
Existing mods that read FPSWeapon.Reach to determine the player's attack range will automatically work with this change. Those that read the WeaponManager.defaultWeaponReach will function as normal but not benefit from this change.
Currently, bashing static doors does not benefit from longer weapon reach due to how PlayerActivate checks against the DoorActivationDistance. I decided to not change this behavior as I do not feel like being able to enter/exit buildings from far away is a desirable mechanic.
Action objects (like interior doors and levers) with the Attack trigger type will activate when bashed, as is the normal behavior.
Testing changing values in-game via mod:
Resetting override, reach set to default value:

Suggestions to improve are welcome.