Cataclysm-dda: Recycler only recycles steel

Created on 15 Aug 2018  路  16Comments  路  Source: CleverRaven/Cataclysm-DDA

The Steel Compactor (t_recycler) only recycles steel items into steel materials (steel_lump, sheet_metal, steel_chunk, & scrap) currently.

Now with the addition of the recycle center in-game it would be a nice feature for the Steel Compactor to be an all around recycler... recycling other metal (copper, iron, lead, & aluminum) items and maybe plastic and glass items into their material components.

Code for the current recycling process can be found on line 2713 in iexamine.cpp

<Suggestion / Discussion> Fields / Furniture / Terrain / Traps

Most helpful comment

Here is the list of metals and their basic forms.

I did find items stats that were not sane -- will split that discussion into a separate issue so as not to clutter things up here.

For discussion:

  • should metal compactor output aluminum foil?
  • what to do about bismuth? (see: lead)

aluminum

  • aluminum ingot material_aluminium_ingot in /items/resources/metals.json
  • (?) aluminum foil aluminum_foil in /items/ammo.json

    • Would be nice to have, since this cannot be crafted.

      (Precedent: compactor already produces sheet metal from steel)

note: Funnily enough: there is no "scraps" version of aluminum, you get ingots from blowing cars up.

brass

No basic items available.

budget steel

No basic items available.

copper

  • scrap copper scrap_copper in /items/generic.json
    "A small chunk of copper, usable for crafting or repairs."

  • copper copper in /items/ammo.json
    "Copper scraps. Could be used to craft something, for example makeshift shotgun shells."

note: "scrap copper" is a chunk, and "copper" is scraps. Aargh!
We ought to rename "scrap copper" to "chunk of copper".

gold

  • gold gold_small in /items/resources/metals.json

hard steel

No basic items available.

iron

No basic items available.

lead

  • lead lead in /items/resources/metals.json

There is also

  • bismuth bismuth in /items/resources/metals.json
    "A dense but brittle metal often used as an alternative to lead."
    "material": [ "lead" ]

Bismuth is not a candidate for output when you recycle lead items. But it might pose a problem because is tagged as lead material -- so the compactor would accept it and then transmute it into lead. Are we okay with that?

silver

  • silver silver_small in /items/resources/metals.json

steel

  • lump of steel steel_lump in /items/resources/metals.json
    Disassembles to chunk of steel (4) -- mass is conserved

  • sheet metal sheet_metal in /items/vehicle_parts.json
    "A thin sheet of metal.",

    • The description text doesn't restrict it to being only steel so it's fine if it doesn't match the density of the other steel basic items, but it is comparatively too much lighter and ought to be adjusted.
  • chunk of steel steel_chunk in /items/resources/metals.json
    Disassembles to scrap metal(5) -- mass is conserved

  • scrap metal scrap in /items/resources/metals.json
    "An bulky assortment of small bits of scrap steel useful in all kinds of crafting",

superalloy

  • superalloy sheet alloy_sheet in /items/vehicle_parts.json

All 16 comments

Don't have time to write this, but I can outline the approach:

  1. Add a new list entry to materials that can be recycled in materials.json. Call it "recycles_into", and it's the sorted list of items ids that a material can be recycled into. For steel, it would be:
    "recyles_into": [ "steel_lump", "sheet_metal", "steel_chunk", "scrap"
  1. add code to the materials.json reader to read recyles_into
  2. in iexamine::recycler, first json'ize the current code to remove the hardcoded stuff and replace it with the JSON recycles_into values for the material (which would still be "steel" for now). The num_ items would be replaced by a std::vector num_components with a size equal to the number of recycle list entries. Same with the _weight variables. The case logic would need to be reworked to handle arbitrary sized arrays.
  3. sum_up_item_weight_by_material would need to be revised to guess how much of an item made from multiple materials was made of each material.
  4. The revised code would need to moved into two loops. The loop would loop through all materials with recycles_into entries and get the weights of any items made of those materials. The second loop would print the menu, destroy the items, and generate the recycled components.

I'm going to start assembling a list of metals and their recycles_into and checking their stats for sanity.

No materials have recycles_into. You'll have to figure that out yourself.
Start with data/json/materials.json, and then look through data/json/items/ for basic items of those materials.

That's what I meant -- I'm putting that list together. Thought I'd mention to prevent duplication of effort.

Looking at the recycling related item groups (item_groups.json) may help with this. Said groups are near the bottom of the file or you can search using the term "recycle".

Or the materials page on the cataclysm item browser website.

No, that's not what we want. I believe those groups enumerate the items that might spawn in the recycle bins at the recycling center.

Indeed, and they are categorized by materials (I made them). But the website I linked is probably better anyway.

I am indeed using the item browser.

Here is the list of metals and their basic forms.

I did find items stats that were not sane -- will split that discussion into a separate issue so as not to clutter things up here.

For discussion:

  • should metal compactor output aluminum foil?
  • what to do about bismuth? (see: lead)

aluminum

  • aluminum ingot material_aluminium_ingot in /items/resources/metals.json
  • (?) aluminum foil aluminum_foil in /items/ammo.json

    • Would be nice to have, since this cannot be crafted.

      (Precedent: compactor already produces sheet metal from steel)

note: Funnily enough: there is no "scraps" version of aluminum, you get ingots from blowing cars up.

brass

No basic items available.

budget steel

No basic items available.

copper

  • scrap copper scrap_copper in /items/generic.json
    "A small chunk of copper, usable for crafting or repairs."

  • copper copper in /items/ammo.json
    "Copper scraps. Could be used to craft something, for example makeshift shotgun shells."

note: "scrap copper" is a chunk, and "copper" is scraps. Aargh!
We ought to rename "scrap copper" to "chunk of copper".

gold

  • gold gold_small in /items/resources/metals.json

hard steel

No basic items available.

iron

No basic items available.

lead

  • lead lead in /items/resources/metals.json

There is also

  • bismuth bismuth in /items/resources/metals.json
    "A dense but brittle metal often used as an alternative to lead."
    "material": [ "lead" ]

Bismuth is not a candidate for output when you recycle lead items. But it might pose a problem because is tagged as lead material -- so the compactor would accept it and then transmute it into lead. Are we okay with that?

silver

  • silver silver_small in /items/resources/metals.json

steel

  • lump of steel steel_lump in /items/resources/metals.json
    Disassembles to chunk of steel (4) -- mass is conserved

  • sheet metal sheet_metal in /items/vehicle_parts.json
    "A thin sheet of metal.",

    • The description text doesn't restrict it to being only steel so it's fine if it doesn't match the density of the other steel basic items, but it is comparatively too much lighter and ought to be adjusted.
  • chunk of steel steel_chunk in /items/resources/metals.json
    Disassembles to scrap metal(5) -- mass is conserved

  • scrap metal scrap in /items/resources/metals.json
    "An bulky assortment of small bits of scrap steel useful in all kinds of crafting",

superalloy

  • superalloy sheet alloy_sheet in /items/vehicle_parts.json

I'm wondering whats peoples opinions are on also including plastic (plastic chunk) and glass (glass shard) into this process or keeping it limited to metals.

It's a compactor. Makes sense for metals, which are malleable.
Does not make sense for plastic, and definitely not for glass, which is brittle.

I would go ahead and give hard steel, budget steel, and iron the same recycles_into as steel. The exact difference between iron and steel is somewhat arbitrary in real world material science, and what heat treatment hard steel had isn't going to matter much after it's been crunched into a small lump.

I'm not really sure why bismuth is a separate material in the game and would be happy to see it recycled into lead.

I would go ahead and give hard steel, budget steel, and iron the same recycles_into as steel.

All three have "burn_products": [ [ "scrap", 1 ] ] which counts as steel. In terms of items/crafting:

  • Budget steel: items are all uncraftable, "flawed" bladed weapons
  • Hard steel: hard steel items that are craftable are made from steel, so no problem.
  • Iron: many items, didn't check all of them, but a quick sample of a few craftable ones shows they ultimately derive from scrap metal or other steel.

So yeah, we can probably go with that.

I'm not really sure why bismuth is a separate material in the game and would be happy to see it recycled into lead.

Bismuth isn't a separate material; it is a separate item from lead but is also flagged as lead material.
If all it does is serve as a 1-for-1 analog for lead in crafting recipes, with no other purpose, I'm not sure why it even needs to exist as a separate item TBH.

Bismuth is distinct chemically, and is potentially very useful in that role.

In which case it would be desirable to have bismuth as not only a distinct item from lead, but also a distinct material -- otherwise the player may inadvertently transmute all their bismuth stocks into lead by using the new compactor #25015 only to discover that they needed it for some recipe that requires bismuth and not lead. (No such recipe exists currently.)

(I haven't played in a long while) Are there any crafting recipes or other uses for bismuth? If so I'd agree to making it be it's own material but would also then suggest that it doesn't recycle back to lead.

Was this page helpful?
0 / 5 - 0 ratings