Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Fix abilities blocked by clothing being blocked by integrated armor

Open actually-a-cat opened this issue 2 years ago • 2 comments

Summary

Bugfixes "Fixed abilities meant to be blocked by worn clothing being blocked by natural armor"

Purpose of change

Fixes #56919. The list of affected checks is actually more extensive:

  • Dex bonus from arachnid and insect arms
  • Climbing bonuses from arachnid and insect limbs
  • Dodge bonuses from furred armor
  • Immunity to being downed and knocked back from tentacles
  • Rooting in soil
  • Nutrients from leaves in sunlight
  • Speed bonus from being barefoot with padded feet
  • Drinking nectar with beak or proboscis
  • Auto-retaliate attacks from spines, quills etc.
  • Sound effects for walking barefoot

Describe the solution

  • The core change is that wearing_something_on ignores integrated armor.
  • Added helper wearing_fitting_on, which is the same, but also allows loose (OVERSIZE) items
  • Reviewed all call sites of wearing_something_on, replacing with fiting as needed, and/or removing ad-hoc checks for INTEGRATED and OVERSIZE (they didn't work properly)
  • Removed footwear_factor and replaced with is_barefoot, which only checks footsoles and ignores integrated armor. This matches how it was used. (There is a minor loss of function here, in that there was some consideration for only wearing one shoe, but that's not really a thing currently and when it is needed it can be readded better)
  • Incidentally from the above, reworked ankle-worn items to only cover the ankle and removed NOT_FOOTWEAR as redundant

Other minor changes:

  • Arachnid and insect arms would give a dexterity penalty, on top of not giving a bonus, when constricted. This doesn't make sense to me and feels accidental so I removed it.
  • I flipped the effect of having roots and walking on dirt, from slowing you down if you have shoes to slowing you down if you don't. That I can imagine is because your roots are trying to dig in or something, the current behavior makes no sense to me.

Describe alternatives you've considered

I considered further-reaching changes to armor info functions, to make them aware of integrated armor and allow anything to be queried either including or disregarding it. But I've been informed that all that stuff is due for an overhaul anyway, so I went for a minimal solution that solves the bugs with as little disruption as possible.

The whole deal with OVERSIZE is not ideal (why does a regular backpack restrict your spider arms but a hiking backpack doesn't?) but that flag as a whole is a problem.

Testing

I manually tested most of the listed scenarios (with the notable exception of tentacles holding the character down against a shockwave - no idea how to try it). It seems like some automated tests would fit in here and I might add in the (not immediate) future.

Additional context

I will be mostly away and unable to do any development for a while so if anything is amiss here it will have to wait.

actually-a-cat avatar Jul 09 '22 01:07 actually-a-cat

Drafting because I also need to review uses of is_wearing_shoes and I might not be able to get around to it for a while

actually-a-cat avatar Jul 09 '22 08:07 actually-a-cat

Make sure to fix Thorns + Bark too.

KittyTac avatar Aug 09 '22 10:08 KittyTac

Is this still under construction? We may need someone to take over this PR

I-am-Erk avatar Nov 29 '22 18:11 I-am-Erk

The shoes-related part of this is not ideal (I should instead make Character::is_wearing_shoes aware of the difference between feet and foot soles and use it) but for now I think it's ok.

actually-a-cat avatar Nov 29 '22 22:11 actually-a-cat