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

Restore variable encumbrance #40321

Merged

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: Features "Restore variable encumbrance for non-rigid containers"

Purpose of change

One feature that got lost in the nested containers implementation was that non-rigid worn items should change their encumbrance with volume.

Describe the solution

Reinstate that feature.

It makes more sense than it did previously because now we know how full each individual item is, rather than having to approximate based on the overall inventory usage.

Each 250ml adds one unit of encumbrance, unless an explicit max_encumbrance value is given, in which case the encumbrance interpolates between the two endpoints.

Describe alternatives you've considered

Requiring max_encumbrance to be given.

Testing

Restored the iteminfo unit tests which cover this case (they are no longer [!mayfail]) and update the test data accordingly.

Additional context

I was getting annoyed by the expected failures in the tests.

@jbytheway
Copy link
Contributor Author

I see @wapcaplet (#40314) and I have trodden on each others toes a bit here. I need to rebase now.

@jbytheway jbytheway force-pushed the restore_variable_encumbrance branch from b9133d2 to b90af43 Compare May 8, 2020 01:33
@KorGgenT
Copy link
Member

KorGgenT commented May 8, 2020

looks like json needs linting

@dissociativity
Copy link
Contributor

maybe cargo pants can finally be less encumbering than many armours with this eh?

@jbytheway jbytheway force-pushed the restore_variable_encumbrance branch 2 times, most recently from 0798d92 to 1ee7e59 Compare May 8, 2020 12:49
@jbytheway
Copy link
Contributor Author

I've realised that this is actually a fairly substantial behaviour change because previously the variable encumbrance only applied to things that either had an explicit max_encumbrance or directly contained objects (like the waterskins). Now, because everything directly contains objects, all clothing that doesn't specify max_encumbrance will start accumulating additional encumbrance, where it didn't before. So, e.g. cargo pants as mentioned by @dissociativity will be more encumbering after this change (used to be 16; now between 16 and 32).

We probably need a review of the encumbrance of all those items. Or maybe we can think of a better default behaviour than what I've currently implemented for items lacking a max_encumbrance field. Thoughts?

@jbytheway jbytheway marked this pull request as draft May 8, 2020 14:51
@jbytheway
Copy link
Contributor Author

jbytheway commented May 8, 2020

There are some issues in the tests I need to get to the bottom of, so marking as draft. I'd still appreciate thoughts on how to deal with increased encumbrance for existing items, though. In particular, is it acceptable to merge this first and fix the items later?

@jbytheway jbytheway marked this pull request as ready for review May 8, 2020 17:24
@jbytheway jbytheway marked this pull request as draft May 8, 2020 17:39
@jbytheway jbytheway marked this pull request as ready for review May 8, 2020 18:32
@dissociativity
Copy link
Contributor

I'm sure we can fix it in items, I'll happily go through some after this is merged!

@Termineitor244
Copy link
Contributor

Termineitor244 commented May 9, 2020

I would say that there is no problem with fixing the items later, many probably will need some thinking to balance their encumbrance numbers, cargo pants being a great example, in the future it would be better to drop the base encumbrance of all the items with several pockets so as to not end with an insane encumbrance...

That said, in the meantime the cargo pants will be basically useless haha, I think those could do better with a max_encumbrance and a reduced base encumbrance.

In another note, many players will be annoyed by the sudden change in encumbrance of their regular clothes, so a little warning could do.

Edit: Why don´t, in the meantime, you have the formula for encumbrance check the max volume storage of the item, and, as more storage the item has, the less encumbrance it receives for every 250 ml of items?

The items with a low number in storage capacity are (generally) not designed to have their pockets full and be comfortable to use, but the items with more storage capacity, like the cargo pants are designed in a way to make the items in storage not encumbrance you so much.

In that way, most items will have encumbrance in reasonable levels in the meantime of being changed their exact numbers.

@jbytheway
Copy link
Contributor Author

I've written a script which does a decent job of identifying the items that need updating. Hopefully I'll be able to adapt it to perform a minimally reasonable update to these items so that encumbrance doesn't go too crazy as soon as this is merged.

@Termineitor244
Copy link
Contributor

Great! Thanks!

@jbytheway jbytheway marked this pull request as draft May 9, 2020 01:51
@jbytheway jbytheway force-pushed the restore_variable_encumbrance branch from 732dec7 to 2fb4503 Compare May 9, 2020 19:32
@jbytheway jbytheway force-pushed the restore_variable_encumbrance branch 3 times, most recently from 1b4b6d6 to 0d6fc16 Compare May 11, 2020 13:37
jbytheway added 5 commits May 11, 2020 11:16
One feature that got lost in the nested containers implementation was
that non-rigid worn items should change their encumbrance with volume.

Reinstate that feature.

It makes more sense than it did previously because now we know how full
each individual item is, rather than having to approximate based on the
overall inventory usage.
These tests had been marked !mayfail as part of the nested containers
implementation.  Now they can be fixed.

Fix them, updating the test data accordingly, and remove the !mayfail
marking.
Rename function to clarify meaning.
This assertion hit in the CI tests, so it shouldn't be fatal.
jbytheway added 2 commits May 11, 2020 11:16
This calculates the actual maximum volume of contents of the pocket.
Unlike item_pocket::volume_capacity, which doesn't account for ammo
contents.
Now pocket_data's former max_contains_volume is called volume_capacity
and there's a new method max_contains_volume that calculates the actual
maximum possible volume of contents.
@jbytheway jbytheway force-pushed the restore_variable_encumbrance branch from 9e78847 to 7e89377 Compare May 11, 2020 15:17
@jbytheway jbytheway marked this pull request as ready for review May 11, 2020 15:18
This tests the calculation of ammo volumes.
@jbytheway jbytheway force-pushed the restore_variable_encumbrance branch from 7e89377 to 4ed430d Compare May 11, 2020 15:21
@jbytheway
Copy link
Contributor Author

jbytheway commented May 11, 2020

I got the automated script working. For all the things that appeared to be "regular storage" clothing and didn't already have a max_encumbrance value I've set their new max_encumbrance to be their old encumbrance and their new encumbrance to be max( max_encumbrance / 2, max_encumbrance - capacity / 250ml ).

I think that should suffice for a first pass, but people will need to keep an eye out for items with silly values.

Then there was a bug with quiver volumes that took me several days to track down. Now finally fixed, I believe.

Along the way I enhanced the iteminfo tests (changes I made to debug that quiver issue, but which are probably a good idea regardless).

So, if the tests now look good, then I think this one should be ready to go.

jbytheway added 6 commits May 11, 2020 12:35
Looks like these flags were overlooked in the migration.
I'm fairly sure both of these were intended to be rigid.  Probably got
lost in the migration to pockets.
For each item which had non-zero encumbrance, but not max encumbrance,
and which wasn't a holster, restricted container, or rigid:
- Add a max_encumbrance field equal to the old encumbrance value.
- Update encumbrance to max(max_encumbrance / 2, max_encumbrance -
  capacity / 250ml).
To help debug encumbrance test failures.
I saw a failure here in the recipe test where the avatar knew the recipe
when they shouldn't.  I didn't get to the bottom of what was going on,
but calling clear_avatar fixes it.
Remove a stray comment in item.h

This close-brace no longer has a matching opening brace.  I guess it was
lost in the nested containers implementation.  Delete the dangling
brace.

Typo in an unrelated comment.
@jbytheway jbytheway force-pushed the restore_variable_encumbrance branch from 4ed430d to 5a49ef7 Compare May 11, 2020 16:35
My script had updated the encumbrance of power armour because the
pockets thereon were non-rigid.  I'm fairly sure power armour storage
should be rigid.  Make it so, and restore the old encumbrance values.
@kevingranade kevingranade merged commit 19e90be into CleverRaven:master May 12, 2020
@jbytheway jbytheway deleted the restore_variable_encumbrance branch May 12, 2020 09:18
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.

5 participants