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

Fix zinc_metal stats (and cascade effects) #63375

Merged
merged 7 commits into from
Mar 18, 2023

Conversation

cake-pie
Copy link
Contributor

@cake-pie cake-pie commented Jan 31, 2023

Summary

Bugfixes "Fix zinc_metal stats (and cascade effects)"

Purpose of change

Split off from #62936

The density of zinc_metal is way off. Fix it, and deal with cascading effects in recipes.

Describe the solution

Zinc has density 7.14g/cm³. That's 357g for 50ml volume, which divides into a stack of 200 charges, 1785mg per unit.
 

Adjust the disassembly of 5L zinc ingot, applying a 5.5% lossiness -- as I work my way through the spinoffs of #62936, 5~6% loss rate that will be applied consistently to all 5L ingot disassembly.
 

Migrated item zinc oxide with misleading id chem_zinc to chem_zinc_oxide to prevent confusion with actual elemental/metal zinc items. Drive-by adjustment to volume due to discrepancy in quoted density figure -- not expected to affect recipes, since those depend on the weight (which corresponds to 1/100 moles of chemical).
 

Edit: adopted coal_lump and charcoal stats from #62180
Fix weight of coal_lump, from 1.5g to 37.5g. There was a mistake in 5549b62 where divided by count (250) instead of stack size (10) leading to value off by a factor of ×25. This is required for sanity of the next step.
Check cascade effects of coal weight change; see details below
 

As a source of elemental carbon for chemistry, coal_lump treated as anthracite coal with 90% carbon content.
For charcoal, carbon content of wood charcoal can vary drastically (sources give 50~95%). Picked a fairly generous value of ~80.56% for convenience, since that will allow charcoal and coal_lump to be used at parity.
 

Fix recipe for smelting zinc_metal from ore material_zincite by reduction with carbon.

  • Quantities reworked on the basis of zinc content of zincite, to ensure balanced input and output.
    • Zincite composition: Zn0.9Mn2+0.1O [source]
  • Added hammer and chisel tool requirements to break ore and coal into smaller pieces before roasting; would not work if you just chucked a large chunk of ore in.
  • Replace basic boil and contain requirements with crucible due to high temperatures.
  • Added fuel required for roasting. This is distinct from the coal being used as source of carbon reagent. Smelting roughly 1.5kg of mass in total, or 6 steel-chunk-equivalents.
     

Fix recipe for further reduction of zinc oxide with carbon; this uses an extremely conservative approach that oversupplies carbon.

  • takes a hint from this, "to achieve the complete reduction of ZnO, the amount of reducing agent was increased to two times the stoichiometric amount."
  • Replace basic boil and contain requirements with crucible due to high temperatures.
  • Added fuel required for roasting. This is distinct from the coal being used as source of carbon reagent. Smelting roughly 500g of mass in total, or 2 steel-chunk-equivalents.
     

Adjust recipe for grinding of zinc_metal into chem_zinc_powder; reworked to produce ~130g, on the same scale as aluminum powder grinding recipe (176g output) and maintaining roughly the same material inefficiency as before (was 1308g/1400g, 6.6% lossy). This only balances zinc input and output, other issues with this recipe are marked with TODO and deferred to be fixed as a package with other problems found with powdered metals in #62936
 

Adjust battery recipes by scaling zinc_metal inputs to roughly preserve mass. However, proportion also needs to be preserved when comparing among those recipes, so it is a straightforward scaling by 4× rather than 3.922× followed by rounding. (This is naive multiplication only, I did not look into the scientific basis for these recipes.)
 

This should cover all pertinent references to zinc_metal in src/, data/json/ and data/mods.

Testing

Suggested checks:

  • Double check my maths / chemistry derivations.
  • Load in game and check
    • zinc metal has sane stats
    • 5L ingot disassembly recipe reports sane input/output in crafting menu
    • check zinc smelting recipe in crafting menu for sanity
    • check zinc powder grinding recipe in crafting menu for sanity
    • check battery recipes in crafting menu for changes applied correctly.

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Appliance/Power Grid Anything to do with appliances and power grid Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Mods Issues related to mods or modding Mods: Innawood 🌲 Anything to do with Innawood mod Spawn Creatures, items, vehicles, locations appearing on map <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jan 31, 2023
@cake-pie
Copy link
Contributor Author

cake-pie commented Feb 1, 2023

Edit: none of this is applicable any more due to #62180

Adjustments to usages of coal_lump going to be listed here because it's kind of a spinoff sub-issue so it's neater to keep it separated from the zinc_metal stuff.

Magiclysm Nova Flare spell requirements

 {
     "id": "spell_components_nova_flare",
     "type": "requirement",
     "//": "Fire starting items suitable for the Nova Flare spell",
+    "//1": "1.3MJ energy content",
+    "components": [ [ [ "coal_lump", 1 ], [ "lamp_oil", 35 ] ] ]
-    "components": [ [ [ "coal_lump", 30 ], [ "lamp_oil", 5 ] ] ]
 }

1 coal_lump is 37.5g of anthracite coal and has 1.3MJ
https://www.wolframalpha.com/input?i=37.5g+*+higher+heating+value+of+anthracite+coal

35 lamp_oil is 35ml or 35cm3 of kerosene and has 1.33MJ
https://www.wolframalpha.com/input?i=35cm3+*+density+of+kerosene+*+higher+heating+value+of+kerosene


Fix recipe for further reduction of zinc oxide with carbon; this uses an extremely conservative approach that oversupplies carbon.

  • takes a hint from this, "to achieve the complete reduction of ZnO, the amount of reducing agent was increased to two times the stoichiometric amount."
  • the charcoal amount was simply scaled together with the coal lump amount. checking for correct equivalence between them is deferred, see below.

CaC2 production: looks like I need to make a separate PR related to the arc furnace process, so I'll deal with it there.


Innawoods ammonium hydroxide recipe: skipped, because this was a hack to compensate for inability to loot the chem in innawoods, and I couldn't figure out what kind of process this was supposed to be based off of.


Several recipes allow coal_lump and charcoal to be used interchangeably, in equal or unequal amounts -- there isn't necessarily a consensus on the conversion rate between the two, although 1-to-1 is common. The usage may treat them as fuel, and sometimes as a source of carbon. Further scrutiny is required for the correct ratio between the two alternatives, and that is being deferred to a separate PR. already being worked on in #62180

Besides the reduction of zinc oxide with carbon from above, other such instances are:

  • data/json/requirements/materials.json: requirements for CVD coating,case hardening steel
  • data/json/recipes/armor/other.json: carbon for rebreather_filter
  • data/json/recipes/recipe_others.json: tempered steel wire; survival_marker
  • data/json/recipes/other/materials.json: smelting of 3 different grades of steel
  • innawoods: smelting of steel_lump + 3 different grades of steel

@github-actions github-actions bot added Mechanics: Enchantments / Spells Enchantments and spells Mods: Magiclysm Anything to do with the Magiclysm mod BasicBuildPassed This PR builds correctly, label assigned by github actions labels Feb 1, 2023
@PatrikLundell
Copy link
Contributor

A note regarding ore processing: The hammer+chisel requirement isn't an issue here, but be careful when you get to iron ores, as we don't want to put Innawood in a catch-22 situation where you need the tools to process the ore you need to get the tools. For that case it might be useful to add an additional recipe that uses more primitive tools at the expense of it taking longer.

@Karol1223
Copy link
Contributor

A note regarding ore processing: The hammer+chisel requirement isn't an issue here, but be careful when you get to iron ores, as we don't want to put Innawood in a catch-22 situation where you need the tools to process the ore you need to get the tools. For that case it might be useful to add an additional recipe that uses more primitive tools at the expense of it taking longer.

Couldn't Innawoods issues be handled in Innawoods-specific recipes? It's a bit weird to adjust mainline recipes specifically to avoid problems in Innawoods. I had the same thing happen when I changed the antenna recipe and made electronics not able to be learned in Innawoods anymore - I just ported the old recipe that allowed for it to be Innawoods-specific.

@PatrikLundell
Copy link
Contributor

Yes, I would suggest it would be an Innawood specific recipe. However, this PR is tagged with Innawood, so I didn't think to mention that specifically.

@cake-pie
Copy link
Contributor Author

cake-pie commented Feb 1, 2023

The tagging happened automatically because in this PR I have adjusted the innawood version of the battery recipe alongside the mainline one when adjusting input amounts.

Noted the potential smelting catch-22. Depending on the ore's hardness, I guess you could just try smashing it with another rock of harder material, or something like that.

@PatrikLundell
Copy link
Contributor

Come to think of it, bog iron isn't actually huge chunks of rock, so it wouldn't need much or any bashing in the first place. Thus, hematite could use the regular breaking apart routine, while the Innawood specific bog iron might not actually need any tool change. Even if that's needed, pulverizing it with a rock (hammer 1) ought to be sufficient.

@cake-pie
Copy link
Contributor Author

cake-pie commented Feb 1, 2023

Ready for review but not merging -- will rebase after #63365 is merged, dropping 21c4214.

@cake-pie cake-pie marked this pull request as ready for review February 1, 2023 17:44
@cake-pie cake-pie requested a review from KorGgenT as a code owner February 1, 2023 17:44
@anoobindisguise
Copy link
Contributor

anoobindisguise commented Feb 1, 2023

I already fixed the weight of coal (and charcoal) in pending #62180. this will conflict.

@cake-pie
Copy link
Contributor Author

cake-pie commented Feb 1, 2023

I already fixed the weight of coal (and charcoal) in pending #62180. this will conflict.

Noted, thanks for the heads up

@cake-pie
Copy link
Contributor Author

Rebased to incorporate changes from #62180.

@kevingranade kevingranade merged commit 04900ad into CleverRaven:master Mar 18, 2023
@cake-pie cake-pie deleted the mrid-zinc branch March 18, 2023 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Appliance/Power Grid Anything to do with appliances and power grid 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) Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Mechanics: Enchantments / Spells Enchantments and spells Mods: Innawood 🌲 Anything to do with Innawood mod Mods: Magiclysm Anything to do with the Magiclysm mod Mods Issues related to mods or modding Spawn Creatures, items, vehicles, locations appearing on map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants