How to hack fluid system? (editing LUA scripts)

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
andyfth
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Jun 27, 2017 5:30 am
Contact:

How to hack fluid system? (editing LUA scripts)

Post by andyfth »

I want unlimited pipe/pump/tank throughput. Eg. if I have 25000 oil in a tank; it's instantly available by a single pipe. No matter lenght. Also fluids in connected tanks are instantly balanced....etc.

In the past I was editing stuff like size of chest/vagons, energy comsumsion of machines, maximum number of modules per machine etc.

But I can figure out, how to hack fluids system. :geek: :geek: :geek: Do you have ideas? I know there are mods, but I'm lazy replacing old pipes by mod pipes.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: How to hack fluid system? (editing LUA scripts)

Post by darkfrei »

https://lua-api.factorio.com/latest/LuaFluidBox.html
A fluid box is represented as a table:

name :: string: Fluid prototype name of the fluid contained in this fluid box.
amount :: double: Amount of the fluid in this box.
temperature :: double (optional): The temperature. When reading from LuaFluidBox, this field will always be present. It is not necessary to specify it when writing, however. When not specified, the fluid box will be set to the fluid's default temperature as specified in the fluid's prototype.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1027
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: How to hack fluid system? (editing LUA scripts)

Post by quyxkh »

To make inspection easier:

Code: Select all

/c psd={comment=false,nocode=true} function gpsl(p,k) return game.print(serpent.line(p,k or psd)) end
To see what's in a fluid box:

Code: Select all

/c gpsl(game.player.selected.fluidbox[1])
To set it:

Code: Select all

/c gps=game.player.selected gps.fluidbox[1]={name='crude-oil',amount=gps.fluidbox.capacity(1)}
Some fluid boxes have multiple inventories, poke around.

Post Reply

Return to “Gameplay Help”