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.

Content
3 years ago
0.17 - 0.18
22
Manufacturing

g Recipe outputs - output_probability functionality

4 years ago
(updated 4 years ago)

Hi,

i was looking in your code how to extend it / how it is working. The changes that i want to make are the following:

green circuit in Assembling machine 1;

input: 3 copper cable, 1 iron plate ; time: 0.5 sec;
output: 1 green circuit 70%, 30% for:1 copper cable waste , 1 iron plate waste

green circuit in Assembling machine 2;

input: 3 copper cable, 1 iron plate ; time: 0.5 sec;
output: 1 green circuit 80%, 20% for: 1 copper cable waste, 1 iron plate waste

green circuit in Assembling machine 3;

input: 3 copper cable, 1 iron plate ; time: 0.5 sec;
output: 1 green circuit 90%, 10% for: 1 copper cable waste, 1 iron plate waste

This means there's always a loss in the output but it decreases when you're using better machines.

Is this possible with using your mod lib?

4 years ago
(updated 4 years ago)

Not in a function, but with a batch of different functions:

Somthing like this...

# remove my changes
apm.lib.utils.recycling.scrap.remove('electronic-circuit')
apm.lib.utils.recycling.scrap.remove('advanced-circuit')
apm.lib.utils.recycling.scrap.remove('processing-unit')

# green circuit
apm.lib.utils.recipe.result.mod('electronic-circuit', 'electronic-circuit', 0)
apm.lib.utils.recipe.result.add_with_probability('electronic-circuit', 'electronic-circuit', 0, 1, 0.7)
apm.lib.utils.recycling.scrap.add('electronic-circuit', 'iron', 0.3)
apm.lib.utils.recycling.scrap.add('electronic-circuit', 'copper', 0.3)

# red circuit
apm.lib.utils.recipe.result.mod('advanced-circuit', 'advanced-circuit', 0)
apm.lib.utils.recipe.result.add_with_probability('advanced-circuit', 'advanced-circuit', 0, 1, 0.8)
apm.lib.utils.recycling.scrap.add('advanced-circuit', 'iron', 0.2)
apm.lib.utils.recycling.scrap.add('advanced-circuit', 'copper', 0.2)

# blue circuit
apm.lib.utils.recipe.result.mod('processing-unit', 'processing-unit', 0)
apm.lib.utils.recipe.result.add_with_probability('processing-unit', 'processing-unit', 0, 1, 0.9)
apm.lib.utils.recycling.scrap.add('processing-unit', 'iron', 0.1)
apm.lib.utils.recycling.scrap.add('processing-unit', 'copper', 0.1)
4 years ago

Thanks

with this it works tough i do not get why the main probability to get 80% needs to be 1.6?

red circuit

apm.lib.utils.recipe.result.mod('advanced-circuit', 'advanced-circuit', 0)
apm.lib.utils.recipe.result.add_with_probability('advanced-circuit', 'advanced-circuit', 0, 1, 1.6)
apm.lib.utils.recycling.scrap.add('advanced-circuit', 'iron', 0.1)
apm.lib.utils.recycling.scrap.add('advanced-circuit', 'copper', 0.1)

Does you lib allow to add a dependency between recipe and assembly machine? Mk1 = 60%, Mk2 = 70% prob for the right result etc?

New response