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

When cutting up items, you get 1/X original weight from items with X different materials #54657

Closed
Moumix3 opened this issue Jan 22, 2022 · 1 comment · Fixed by #58414
Closed
Labels
Crafting / Construction / Recipes Includes: Uncrafting / Disassembling (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@Moumix3
Copy link
Contributor

Moumix3 commented Jan 22, 2022

Describe the bug

An item with only 1 material will result in around the same weight of that material once cut up
An item with 2 different materials will result in around 1/2 of its weight in materials once cut up
An item with 3 different materials will result in around 1/3 of its weight in materials once cut up

There is probably a division in the code when calculating resulting materials which shouldn't be there... :)

Steps to reproduce

  1. Spawn an item with only one material (eg: Leather vest) and cut it up, the resulting materials is almost the same weight as the original item (for Leather Vest: 0.9kg received for 1kg original weight)
  2. Spawn an item with two materials (eg: US Ballistic vest) and cut it up, the resulting materials is ~1/2 the weight of the original item (for US Ballistic Vest: 1.3kg received for 2.91kg original weight)
  3. Spawn an item with three materials (eg: Scavenger Gear) and cut it up, the resulting materials is ~1/3 the weight of the original item (for Scavenger Gear: 2.42kg received for 7.92kg original weight)

Expected behavior

The total weight of received materials should be almost the same weight as the original item independantly of the number of materials an item is made of

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0 2009
  • Game Version: bb20c4d [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda]
    ]

Additional context

No response

@Moumix3 Moumix3 changed the title When disassembling, you get 1/X materials from items with X different materials When disassembling, you get 1/X original weight from items with X different materials Jan 22, 2022
@Moumix3 Moumix3 changed the title When disassembling, you get 1/X original weight from items with X different materials When cutting up items, you get 1/X original weight from items with X different materials Jan 22, 2022
@moxian
Copy link
Contributor

moxian commented Jan 22, 2022

Probably this line:

mat_to_weight[type.first] += ( temp.weight() * remaining_weight / temp.made_of().size() ) *

That one divides by the number of mats, and the very next line multiplies by the fraction that this material occupies in the whole thing.

(this comment is not an indication of my willingness to PR the fix)

@Maleclypse Maleclypse added (S1 - Need confirmation) Report waiting on confirmation of reproducibility Crafting / Construction / Recipes Includes: Uncrafting / Disassembling (S2 - Confirmed) Bug that's been confirmed to exist 0.G suggested release blocker and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crafting / Construction / Recipes Includes: Uncrafting / Disassembling (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants