Hundreds of items have nonsensical densities and need correction
#54,811 opened on Jan 26, 2022
Repository metrics
- Stars
- (9,264 stars)
- PR merge metrics
- (Avg merge 6d 5h) (292 merged PRs in 30d)
Description
Describe the bug
Several hundred items (which I have identified) have densities that appear to be way out of line with their material composition. All current instances of this need to be resolved in order to merge a test that will prevent this from happening in the future.
Steps to reproduce
- Look at item stats for something like burdock wine (one of the items on the list), noting the volume, mass, and also note how charges apply to volume and mass if applicable (volume is for one stack of the amount of charges, mass is per charge)
- Burdock wine has a volume of 0.25L, mass of 0.25kg, and 7 charges, so a stack of 7 will have volume of 0.25 and mass of 1.75kg.
- Burdock wine is almost as heavy as steel -- about 7g/cm3, with steel being 8.
Expected behavior
Items should have densities that are no greater than that suggested by their materials, and generally well under that -- sheet metal, for instance, has a density of 6g/cm3, suggesting that even items in a favorable shape for storage often aren't very efficiently stored (though there are some that I'd say are justified being equal, like liquids and things like the 800L plastic cube)
Screenshots
No response
Versions and configuration
- OS: Windows
- OS Version: 10.0 2009
- Game Version: 2ed119b [64-bit]
- Graphics Version: Tiles
- Game Language: System language []
- Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], No Fungal Growth [no_fungal_growth], Bionic Professions [package_bionic_professions], Aftershock [aftershock], Blaze Industries [blazeindustries], Crazy Cataclysm [crazy_cataclysm] ]
Additional context
This first file has all of the items listed. I am working on a second file which has only the very obviously incorrect items and none that may warrant changes to the test or the base material density. Second list is done, I removed about 100 items which I think should be resolved later instead:
low-hanging-fruit.txt
Some pointers for people fixing items on this list:
- You should probably leave things made of organic matter alone until most of the rest have been whittled down.
- A number of items have densities that COULD make sense if the percentage composition of each material was altered, which is a new feature. My testing suite takes that into account. One example is the batteries that are at the top of the file. If an item can be fixed by altering material ratios without touching mass or volume, do that.
- Pay close attention to item charges! The bug I mentioned with burdock wine is responsible for a LOT of the worst offenders.
- Let it be emphasized that the vast majority of items are not in a perfectly efficient shape for storage, and therefore should not be exactly equal to material density. Don't just multiply the item's existing mass by density and call it a day.
- The list is subject to change, off the top of my head I should be able to test rigid containers more thoroughly by subtracting interior volume, and tweaking density values for materials will also change things, I'll update the list here if I change anything of that nature.
Common material densities used from my test (you can refer to my updated materials.json here: https://github.com/CleverRaven/Cataclysm-DDA/pull/54747/files ):
- Elemental substances like copper or silver, or those with well-defined chemical compositions, are just the density for that element or substance
- Bronze is 8.8
- Plastic is 1.0
- Kevlar is 1.4 (all forms)
- Iron and all Steels are 8.0
- Most organic matter including leather is 1.1 -- might be subject to change later. Bones are 1.4.
- Glass is 2.5
- Ceramic is 4.5
- Chitin is 1.45
- Superalloy is 1.8 but I might change it
- Stone is 2.8
- Clay is 1.6
(also tagging PR #54747)