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

Activating & Deactivating Power Armor suits doesnt update encumbrance #54722

Closed
John-Candlebury opened this issue Jan 24, 2022 · 4 comments · Fixed by #54764
Closed

Activating & Deactivating Power Armor suits doesnt update encumbrance #54722

John-Candlebury opened this issue Jan 24, 2022 · 4 comments · Fixed by #54764
Assignees
Labels
<Bug> This needs to be fixed Items: Armor / Clothing Armor and clothing Items / Item Actions / Item Qualities Items and how they work and interact

Comments

@John-Candlebury
Copy link
Member

John-Candlebury commented Jan 24, 2022

Describe the bug

Activating & Deactivating Power Armor suits doesn't update encumbrance. This can let you fight using unpowered Field Combat exoskeletons, without facing any of the supposed encumbrance penalties.

Steps to reproduce

  1. Spawn a Heavy Field Combat Exoskeleton, UPS, and a spork. Wear the suit and wield the spork.
  2. Notice you have the correct 60 encumbrance value.
  3. Activate the suit, check the @ menu and notice an incorrect 60 encumbrance value.
  4. Drop your spork, This causes encumbrance to update to the correct value of 20 after waiting one turn.
  5. Deactivate the suit. Encumbrance remains at 20 until you grab the spork again.
  6. Magic sporks?

Expected behavior

The item transformation should trigger an encumbrance update.

Screenshots

No response

Versions and configuration

-Version: Latest Master
-Mods: DDA

Additional context

Found while testing #53254 but as mentioned the bug is also present in vanilla objects.

@John-Candlebury John-Candlebury added <Bug> This needs to be fixed Items / Item Actions / Item Qualities Items and how they work and interact Items: Armor / Clothing Armor and clothing labels Jan 24, 2022
@Nerezza
Copy link
Contributor

Nerezza commented Jan 24, 2022

Noticed this issue too, but I wasn't able to get to where I could regularly use my power armor to really be able to investigate it.

Relevantly the way power armor works is it's two different objects that swap json stats when you turn them on/off. The function handling the stat swapping probably needs to check if the item is worn, and call for an encumbrance refresh if it is.

@John-Candlebury
Copy link
Member Author

John-Candlebury commented Jan 24, 2022

Normal transformable armor does update correctly. I think the issue is found in the hardcoded encumbrance reduction Power Armors are supposed to get. Found in line 803 of character_attire.

        const int armorenc = !power_armor || !it.is_power_armor() ?
                             encumber_val : std::max( 0, encumber_val - 40 );

Removing this and updating the armors definitions to explicitly state the encumbrance reduction causes them to work properly.

I'd fix it but it might be worthwile for someone more knowledgeable to look at it.

@kevingranade
Copy link
Member

That sounds totally reasonable.

@Broken27
Copy link
Contributor

Honestly i think power armors should work with a normal transform function instead of being hardcoded.

It would make much easier to change the properties of the activated armor. (Like giving them an strenght buff, or giving activated power helmets night vision).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Items: Armor / Clothing Armor and clothing Items / Item Actions / Item Qualities Items and how they work and interact
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants