Amator Phasma's Recycling

This is a simple modification that adds up to two by-products to the intermediate products: scrap metal with a probability of 10% for one or 5% for two scrap metal types. This scrap metal can be collected and later processed in a recycler and then smelted into plates again. It's very simple, but it adds a small layer of complexity to your transport-belt layout. In the early game you can easily solve this with splitters or filter-inserters. Later in high-production areas, you have a dedicated transport-belt.
4 days ago
0.17
4581
Owner: AmatorPhasma
Source: N/A
Homepage: https://forums.factorio.com/viewtopic...
License: GNU GPLv3
Created: 7 months ago
Latest Version: 0.17.41 (4 days ago)
Factorio version: 0.17
Downloaded: 4581 times

Amator Phasma's Recycling

Source Code on GitLab

Languages:
English, Deutsch


About this mod:

This is a simple modification that adds up to two by-products to the intermediate products:
The scrap metal probability is 10% by default (can be changed in the startup settings) for one scrap metal type, this value is divided by the amount of scrap metal types in a recipe. (example: iron gear wheel: 10% for iron scrap metal, low density structure: 5% for copper and 5% for steel scrap metal) This scrap metal can be collected and later processed in a recycler and then smelted into plates.

It's very simple, but it adds a small layer of complexity to your transport-belt layout. In the early game you can easily solve this with splitters or filter-inserters. Later in high-production areas, you have a dedicated transport-belt for this purpose.

This mod supports all Bob and Angel metals if you had one or both of them.

Tested with vanilla factorio, with Bob's and/or Angel's and/or Earendel's mods. (See list below)

For Modders:

You can easily add scrap metal to products in the data-updates phase with:
apm.lib.utils.recycling.scrap.add(recipe_name, scrap_metal, probability) -- The probability is optional to overwrite the value from the settings
Example:
apm.lib.utils.recycling.scrap.add('pipe', 'iron')
This results in a 10% probability for iron scrap
apm.lib.utils.recycling.scrap.add('rocket-engine', 'tungsten', 0.05)
This results in a 5% probability for tungsten scrap

or delete the scrap metal output with:
apm.lib.utils.recycling.scrap.remove(recipe_name)
Example:
apm.lib.utils.recycling.scrap.remove('pipe')

To define your one scrap metal you need a bit more:
apm.lib.utils.recycling.metal.add(name, tint, output, output_category, wight, output_probability, t_catalysts, t_output_byproducts, b_own_tech, t_tech_prerequisites, output_amount_overwrite)
-- name: an arbitrary name for a metal (like: iron, copper, titanium, etc..)
-- tint: the color of this metal
-- output: an prototype name of an item
-- output_category: the recipe-category for the last recycling step (Default: 'smelting' example: for angel metals: 'induction-smelting')
-- wight: int: <4 means for tier 1, <7 means for tier 2, <10 means for tier 3, >=10 means for tier 4
-- * in the future this will also determine the importance of this metal for a further automatic generation.
-- output_probability: a dummy for the futere, has no impact at this moment
-- t_catalysts example: {{type='fluid', name='steam', amount=100}} (only two inpute-pipe)
-- t_output_byproducts: example: {{type='fluid', name='water', amount=50}} (
only two output-pipe)
-- b_own_tech: bool, if true there is a own tech generated for the recipes of this metal/scrap process
-- t_tech_prerequisites: has only effect if b_own_tech is true, a table of technologies that are used as prerequisites for this recipe chain
-- output_amount_overwrite: (int) overwrites the default output for the last recipe in the process

Example:
apm.lib.utils.recycling.metal.add('iron', {r= 0.75, g = 0.76, b = 0.77}, 'iron-plate', nil, 1, 0.25, nil, nil, false, nil)
apm.lib.utils.recycling.metal.add('tin', {r= 0.33, g = 0.49, b = 0.36}, 'liquid-molten-tin', 'induction-smelting', 2, 0.25, nil, nil, true, {'angels-tin-smelting-1'})

If you add an Metal thats not defines in my ./prototypes/recycling/generate.lua you need to add an local string for translations:
Example:
apm_metal_type_iron=iron
apm_metal_type_copper=Kupfer

If you want look in the code: you need go into my library mod to ./apm_lib_0.17.37.zip/lib/utils/recycling.lua

Important: You have to create the metal type BEFORE you can add scrap metal to a recipe, this means you should prepare the load order to load your data-updates phase after this mod, to use the "defaults" defined in ./prototypes/recycling/generate.lua

Known problem:

  • None

Future?

  • None

Problems?

  • Report them on the forum thread or here on this site under disscussion.

Ideas?

  • Please tell me on the forum thread.

Dependencies:

Known incompatibility:

  • None

Tested compatibility:

My thread in the forum.