Liquify Science and Big Lab


Liquify your science into fluids allowing using pipes and tanks for logistics. Use the new Big Lab too, to process all your science packs. Now supports Vanilla, Schall and Bobs Tech.

Utilities
3 years ago
0.16 - 1.1
1.45K

b Too little fluid created in liquid recipe

6 years ago
(updated 6 years ago)

Looking at the science recipes in game I noticed that the liquid versions of military, production, and high tech science only output 10 fluid when it should create 20 because the solid version creates 2 packs. This makes producing science directly into liquid very wasteful; not to mention that a chem plant can only use 3 modules, potentially losing 10% productivity compared to an assembler.
I tried messing with numbers in the lua but to no avail :o

Edit:
Ok so in prototypes\func.lua I created a new local number to keep track of the amount of fluid that should be produced, then changing it to 20 if the number of products produced from the original recipe is 2. Unfortunately, this doesn't work if there is anything but 1 or 2 packs being produced.
This is the code I changed. Everything after this was not modified.
func.lua
--Take science pack and create 3 recipes from it
function liquify(science)
local orig = data.raw.recipe[science.name]
if orig then
--Basic liquid recipe; copies base recipe and creates liquid science
local fluid_amount_to_create = 10 --Used for creating the correct amount of science in the liquid recipe
if (orig.result_count == 2) then fluid_amount_to_create = 20 end

    local liquid_recipe = {
        type = "recipe",
        name = "liquid-" .. science.name,
        enabled = false,
        energy_required = orig.energy_required,
        ingredients = orig.ingredients,
        category = "chemistry",
        subgroup = "liquify",
        order = science.order,
        results = {{type = "fluid", name = "liquid-" .. science.name, amount = fluid_amount_to_create}},
    }
    data:extend({liquid_recipe})
end

My most sincere apologies for the formatting, I don't know how to work the tags yet!

6 years ago

Hi Paragorn, thanks for that information, i'm on it!! XD

6 years ago

THAAANKS Paragon... I just updated and sorry for the delay... You make it perfect now, that error was really bad... XD

6 years ago

No problem! Glad I could help and thanks for updating!
:D

6 years ago
(updated 6 years ago)

You should be able to use

local fluid_amount = 10
if orig.result_count then
    fluid_amount = fluid_amount * orig.result_count
end

This should allow it to work for any amount of science. If the original recipe only produces 1, there will be no result_count, and fluid_amount will default to 10, otherwise, it will multiply the result count by 10. Also, my bad. Since I'm the one who made this code, I'm the one who should apologize. It was a pretty dumb mistake; just forgot some science produced in batches of 2

6 years ago

Hi Kryzeth!!! I get it ... If the science produce 10, it will be 100 fluid, etc... Great code!! Thanks!! Im updating now!

New response