Types/FluidBox: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(converted to types page since the prototype was removed (or never existed))
m (→‎base_level: formatting)
 
(22 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Basics ==
== Basics ==
[[File:Fluidboxes.png|thumb|550px|Visual representation of base_area, base_level and height. When all the fluidboxes are connected, the water leaves fluidbox A and flows into the other 3 boxes through fluidbox B until the water level is equal in all boxes. For more info about fluids, see [[Fluid system#See also]].]]
Used to set the fluid amount an entity can hold, as well as the connection points for pipes leading into and out of the entity.
Entities can have multiple fluidboxes. These can be part of a [[Types/EnergySource#Fluid_energy_source]] or be specified directly in the entity prototype.
A fluidbox can store only one type of fluid at a time. However, a fluid system (multiple connected fluid boxes) can contain multiple different fluids, see [[Fluid_system#Fluid_mixing]].
== Mandatory properties ==


Used to set the fluid amount an entity can hold, as well as the connection points for pipes leading into and out of the entity.
=== pipe_connections ===
'''Type''': [[Types/table]] of [[Types/PipeConnectionDefinition]]
 
Max number of members is 255.
 
Connection points to connect to other fluidboxes. This is also marked as blue arrows in alt mode.
Fluid may flow in or out depending on the `type` field of each connection.
Connection points may depend on the direction the entity is facing.
 
== Optional properties ==


== Properties ==
=== base_area ===
=== base_area ===
'''Type''': [[Types/unsigned]]
'''Type''': [[Types/double]]
 
'''Default''': 1
 
Must be greater than 0. The total fluid capacity of the fluid box is <code>base_area × height × 100</code>.
 
=== base_level ===
'''Type''': [[Types/double]]
 
'''Default''': 0
 
Base level is the elevation of the invisible fluid box. 0 is ground level.


A base area of 1 will hold 100 units of water, 2 will hold 200, etc...
-1 puts the top of the fluid box at the bottom of a pipe connection (base_level 0, height 1), so fluid "falls" in to it, and can't get out.
 
1 puts the bottom of the fluid box at the top of a pipe connection, so fluid "falls" out of it, but fluids already outside cannot get into it.
 
In other words:
 
* 1 = output only (and will attempt to empty as fast as possible).
* -1 = input only (and will attempt to fill as fast as possible).
* 0 means fluids can freely flow in and out (and like a pipe, will balance to the level of the pipe next to it).
 
Having a -1 or 1 improperly set on an output or input, respectively, will cause issues like output fluid not leaving the building, or input fluid not entering, regardless of fluid levels in the pipe or fluid box.


=== height ===
=== height ===
'''Type''': [[Types/unsigned]]
'''Type''': [[Types/double]]


=== base_level ===
'''Default''': 1
'''Type''': [[Types/unsigned]]
 
Must be greater than 0. The total fluid capacity of the fluid box is <code>base_area × height × 100</code>.
 
=== filter ===
'''Type''': [[Types/string]]
 
Name of a [[Prototype/Fluid]]. Can be used to specify which fluid is allowed to enter this fluid box. [https://forums.factorio.com/viewtopic.php?f=28&t=46302]
 
=== render_layer ===
'''Type''': [[Types/RenderLayer]]
 
'''Default''': "object"
 
=== hide_connection_info ===
'''Type''': [[Types/bool]]
 
'''Default''': false
 
Hides the blue input/output arrows and icons at each connection point.


=== pipe_covers ===
=== pipe_covers ===
'''Type''': Map of [[Types/string]] -> [[Types/Sprite]]
'''Type''': [[Types/Sprite4Way]]


The pictures to show when another fluid box connects to this one. Should look like this:
The pictures to show when another fluid box connects to this one.


<pre>
=== pipe_picture ===
pipe_covers = {
'''Type''': [[Types/Sprite4Way]]
  north = {
      ... sprite layers go here ...
  },
  south = {
      ... sprite layers go here ...
  },
  east = {
      ... sprite layers go here ...
  },
  west = {
      ... sprite layers go here ...
  }
}
</pre>


=== pipe_connections ===
=== minimum_temperature ===
'''Type''': [[Types/double]]
 
The minimum temperature allowed into the fluidbox. Only applied if a <code>filter</code> is specified [https://forums.factorio.com/viewtopic.php?p=496738#p496738].
 
<syntaxhighlight lang="lua">minimum_temperature = 100.0</syntaxhighlight>
 
=== maximum_temperature ===
'''Type''': [[Types/double]]
 
The maximum temperature allowed into the fluidbox. Only applied if a <code>filter</code> is specified [https://forums.factorio.com/viewtopic.php?p=496738#p496738].
 
<syntaxhighlight lang="lua">maximum_temperature = 1000.0</syntaxhighlight>


=== production_type ===
=== production_type ===
'''Type''': [[Types/string]]
'''Type''': [[Types/string]]
'''Default''': "None"


Possible values:
Possible values:
* input
* "None" or "none"
* input-output
* "input"
* output
* "input-output"
* "output"
 
=== secondary_draw_order ===
'''Type''': [[Types/int8]]
 
'''Default''': 1
 
Set the secondary draw order for all orientations. Used to determine render order for sprites with the same <code>render_layer</code> in the same position. Sprites with a higher <code>secondary_draw_order</code> are drawn on top.
 
=== secondary_draw_orders ===
'''Type''': [[Types/table]] of [[Types/int8]]
 
'''Default''': {north = 1, east = 1, south = 1, west = 1}
 
Set the secondary draw order for each orientation. Used to determine render order for sprites with the same <code>render_layer</code> in the same position. Sprites with a higher <code>secondary_draw_order</code> are drawn on top.


== Example ==
== Example ==
<pre>
 
fluid_box =
<syntaxhighlight lang="lua">fluid_box =
     {
     {
       base_area = 1,
       base_area = 1,
Line 62: Line 132:
       production_type = "input-output"
       production_type = "input-output"
     },
     },
</pre>
</syntaxhighlight>

Latest revision as of 10:54, 16 January 2023

Basics

Visual representation of base_area, base_level and height. When all the fluidboxes are connected, the water leaves fluidbox A and flows into the other 3 boxes through fluidbox B until the water level is equal in all boxes. For more info about fluids, see Fluid system#See also.

Used to set the fluid amount an entity can hold, as well as the connection points for pipes leading into and out of the entity.

Entities can have multiple fluidboxes. These can be part of a Types/EnergySource#Fluid_energy_source or be specified directly in the entity prototype.

A fluidbox can store only one type of fluid at a time. However, a fluid system (multiple connected fluid boxes) can contain multiple different fluids, see Fluid_system#Fluid_mixing.

Mandatory properties

pipe_connections

Type: Types/table of Types/PipeConnectionDefinition

Max number of members is 255.

Connection points to connect to other fluidboxes. This is also marked as blue arrows in alt mode. Fluid may flow in or out depending on the `type` field of each connection. Connection points may depend on the direction the entity is facing.

Optional properties

base_area

Type: Types/double

Default: 1

Must be greater than 0. The total fluid capacity of the fluid box is base_area × height × 100.

base_level

Type: Types/double

Default: 0

Base level is the elevation of the invisible fluid box. 0 is ground level.

-1 puts the top of the fluid box at the bottom of a pipe connection (base_level 0, height 1), so fluid "falls" in to it, and can't get out.

1 puts the bottom of the fluid box at the top of a pipe connection, so fluid "falls" out of it, but fluids already outside cannot get into it.

In other words:

  • 1 = output only (and will attempt to empty as fast as possible).
  • -1 = input only (and will attempt to fill as fast as possible).
  • 0 means fluids can freely flow in and out (and like a pipe, will balance to the level of the pipe next to it).

Having a -1 or 1 improperly set on an output or input, respectively, will cause issues like output fluid not leaving the building, or input fluid not entering, regardless of fluid levels in the pipe or fluid box.

height

Type: Types/double

Default: 1

Must be greater than 0. The total fluid capacity of the fluid box is base_area × height × 100.

filter

Type: Types/string

Name of a Prototype/Fluid. Can be used to specify which fluid is allowed to enter this fluid box. [1]

render_layer

Type: Types/RenderLayer

Default: "object"

hide_connection_info

Type: Types/bool

Default: false

Hides the blue input/output arrows and icons at each connection point.

pipe_covers

Type: Types/Sprite4Way

The pictures to show when another fluid box connects to this one.

pipe_picture

Type: Types/Sprite4Way

minimum_temperature

Type: Types/double

The minimum temperature allowed into the fluidbox. Only applied if a filter is specified [2].

minimum_temperature = 100.0

maximum_temperature

Type: Types/double

The maximum temperature allowed into the fluidbox. Only applied if a filter is specified [3].

maximum_temperature = 1000.0

production_type

Type: Types/string

Default: "None"

Possible values:

  • "None" or "none"
  • "input"
  • "input-output"
  • "output"

secondary_draw_order

Type: Types/int8

Default: 1

Set the secondary draw order for all orientations. Used to determine render order for sprites with the same render_layer in the same position. Sprites with a higher secondary_draw_order are drawn on top.

secondary_draw_orders

Type: Types/table of Types/int8

Default: {north = 1, east = 1, south = 1, west = 1}

Set the secondary draw order for each orientation. Used to determine render order for sprites with the same render_layer in the same position. Sprites with a higher secondary_draw_order are drawn on top.

Example

fluid_box =
    {
      base_area = 1,
      height = 2,
      base_level = -1,
      pipe_covers = pipecoverspictures(),
      pipe_connections =
      {
        {type = "input-output", position = {-2, 0.5}},
        {type = "input-output", position = {2, 0.5}}
      },
      production_type = "input-output"
    },