Skip to content

Moddable weapon reach#2804

Open
RedRoryOTheGlen wants to merge 1 commit into
Interkarma:masterfrom
RedRoryOTheGlen:ModdableWeaponReach
Open

Moddable weapon reach#2804
RedRoryOTheGlen wants to merge 1 commit into
Interkarma:masterfrom
RedRoryOTheGlen:ModdableWeaponReach

Conversation

@RedRoryOTheGlen

@RedRoryOTheGlen RedRoryOTheGlen commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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:

image image image

Resetting override, reach set to default value:
image

Suggestions to improve are welcome.

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.

1 participant