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

Characters have actual volume, sane-ify sane-ified vehicle size checks. Enforce with unit tests #74162

Merged

Conversation

RenechCDDA
Copy link
Member

@RenechCDDA RenechCDDA commented May 29, 2024

Summary

None

Purpose of change

Fixes #74068

Please stop pinging me. Yes I saw the first one

Describe the solution

Give characters actual volume

Remove pain from cramped space

Completely different volume calculation for characters, not related to monster calculation

(this is a big one)

--- >Character volume includes carried volume, including their weapon < ---

(big one up above!)

Flip an oopsie greater than

Embrace testing, testing is good

Describe alternatives you've considered

Revert?

Testing

my own unit test is currently failing. it passes now

Additional context

Character size to volume is based on height, but here is a (better) graph plotted to the average heights for each size class:

image

Note: There still might be some json weirdness where volumes don't match up to what is 'expected'. I would expect some seats to be cramped, this is intended. Cramped space no longer gives pain and a penalty to fighting inside a restricted vehicle space makes sense to me. So yes, if you can't swing your broadsword 100% effectively from the driver's seat that is intended behavior.

If you find a vehicle part that looks wrong, please feel free to PR a fix. I did not exhaustively review each and every cargo vehicle part.

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions labels May 29, 2024
@fairyarmadillo
Copy link
Contributor

fairyarmadillo commented May 29, 2024

I spent a long time trying to get power armor to stop people from fitting through windows and sitting comfortably in compact cars, but every fix I tried wound up messing with BMI and calorie requirements. If this actually makes the player feel like they're wearing T-60 power armor (including making them big enough to use knockdown and knockback techs on bigger enemies) that will be completely awesome.

@RenechCDDA RenechCDDA force-pushed the did_you_get_that_ping_I_sent_you branch from cc7d8ce to aa6def4 Compare May 29, 2024 08:10
@RenechCDDA RenechCDDA marked this pull request as ready for review May 29, 2024 08:10
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label May 29, 2024
@RenechCDDA RenechCDDA force-pushed the did_you_get_that_ping_I_sent_you branch from aa6def4 to ea41c1c Compare May 29, 2024 08:24
@RenechCDDA RenechCDDA force-pushed the did_you_get_that_ping_I_sent_you branch from ea41c1c to f8eaf93 Compare May 29, 2024 08:25
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label May 30, 2024
@Alm999
Copy link
Contributor

Alm999 commented May 30, 2024

Volume based on height is great, but what if my character is "Morbidly Obese" as well (e.g. "Weight XXXL" starting trait)?

@Vgoloshivskiy
Copy link
Contributor

Can't wait until this get merged. will you be unable to use Mech suits / Combat Exosceletons designed for normal sized people with this?

@Maleclypse Maleclypse merged commit 82e9103 into CleverRaven:master Jun 2, 2024
22 of 28 checks passed
@RenechCDDA RenechCDDA deleted the did_you_get_that_ping_I_sent_you branch June 2, 2024 10:49
item_location wep = get_wielded_item();
units::volume wep_volume = wep ? wep->volume() : 0_ml;
// Note: Does not measure volume of worn items that do not themselves contain anything
return get_base_volume() + volume_carried() + wep_volume;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

volume_carried() here doesn't seem appropriate, unless I'm reading it wrong wearing a giant empty rucksack counts as 0, while a snack bar in my jeans pocket apparently makes the space I'm in more cramped?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the intention. Using worn clothes' volume would be wildly inappropriate, since (depending on the clothing in question) it would add negligible amounts of volume to your person. A wetsuit is 5L, but it's definitely not going to add 5L of volume to your person when being worn.

There is room for more nuance here, like separating out rigid and non-rigid items and materials.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

volume_carried() is wildly inappropriate too imo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How? If you're carrying a 500L fridge and you try to step into a vehicle it's... just not gonna work? Same thing if you're wearing a huge box backpack.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing if you're wearing a huge box backpack.

volume_carried() doesn't count that as volume unless it's full which was my original point...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does? In the tests we use a giant novelty backpack with 80L of volume capacity. Putting it on and putting a 10L rock into it causes an open tile to become cramped for movement purposes. It increases the character's volume from 70L to above 75L (where the aisle starts being cramped). If it counted the full 80L then our total volume would be 70+80 = 150L, and we couldn't move through the aisle at all. But we can, and it's just cramped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my point... the novelty backpack should be counting the full 80L (or whatever volume takes up when empty) bc it's not surrounding the player like a wetsuit. At the very least you should be counting BELTED stuff.
It's also pretty silly that like a flak jacket with plates would count the plates volume but an empty power armour suit wouldn't count as anything.

@RenechCDDA
Copy link
Member Author

Volume based on height is great, but what if my character is "Morbidly Obese" as well (e.g. "Weight XXXL" starting trait)?

There is no difference in volume calculation based on body fat. I tried reading up on it but calculating that turns out to be "it's complicated" and varies greatly depending on age and sex. If you are interested in adding this, I recommend Determination of human body volume from height and weight, authored by JULIUS SENDROY, JR. AND HAROLD A. COLLISON

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cramped space. Incorrect volume calculation?
6 participants