An array of fluid boxes of an entity. Entities may contain more than one fluid box, and some can change the number of fluid boxes -- for instance, an assembling machine will change its number of fluid boxes depending on its active recipe. See Fluid.
Do note that reading from a LuaFluidBox creates a new table and writing will copy the given fields from the table into the engine's own fluid box structure. Therefore, the correct way to update a fluidbox of an entity is to read it first, modify the table, then write the modified table back. Directly accessing the returned table's attributes won't have the desired effect.
Double the temperature of the fluid in
|
get_prototype(index) | → LuaFluidBoxPrototype or array[LuaFluidBoxPrototype] |
The prototype of this fluidbox index. |
The prototype of this fluidbox index. |
||
get_capacity(index) | → double |
The capacity of the given fluidbox index. |
The capacity of the given fluidbox index. |
||
get_connections(index) | → array[LuaFluidBox] |
The fluidboxes to which the fluidbox at the given index is connected. |
The fluidboxes to which the fluidbox at the given index is connected. |
||
get_filter(index) | → FluidBoxFilter? |
Get a fluid box filter |
Get a fluid box filter |
||
set_filter(index, filter) | → boolean |
Set a fluid box filter. |
Set a fluid box filter. |
||
get_flow(index) | → double |
Flow through the fluidbox in the last tick. |
Flow through the fluidbox in the last tick. |
||
get_locked_fluid(index) | → string? |
Returns the fluid the fluidbox is locked onto |
Returns the fluid the fluidbox is locked onto |
||
get_fluid_system_id(index) | → uint |
Gets unique fluid system identifier of selected fluid box. |
Gets unique fluid system identifier of selected fluid box. |
||
flush(index, fluid?) | → dictionary[string → float] |
Flushes all fluid from this fluidbox and its fluid system. |
Flushes all fluid from this fluidbox and its fluid system. |
||
help() | → string |
All methods and properties that this object supports. |
All methods and properties that this object supports. |
||
owner [R] | :: LuaEntity |
The entity that owns this fluidbox. |
The entity that owns this fluidbox. |
||
valid [R] | :: boolean |
Is this object valid? |
Is this object valid? |
||
object_name [R] | :: string |
The class name of this object. |
The class name of this object. |
||
# (length) [R] | :: uint |
Number of fluid boxes. |
Number of fluid boxes. |
||
[] (index) [R] | :: Fluid? |
Access, set or clear a fluid box. |
Access, set or clear a fluid box. |
The prototype of this fluidbox index. If this is used on a fluidbox of a crafting machine which due to recipe was created by merging multiple prototypes, a table of prototypes that were merged will be returned instead
index | :: uint |
|
Get a fluid box filter
index | :: uint |
The index of the filter to get. |
The index of the filter to get. |
→ FluidBoxFilter? |
The filter at the requested index, or |
Set a fluid box filter.
index | :: uint |
The index of the filter to set. |
The index of the filter to set. |
||
filter | :: FluidBoxFilterSpec or nil |
The filter to set. Setting |
The filter to set. Setting |
→ boolean |
Whether the filter was set successfully. |
Some entities cannot have their fluidbox filter set, notably fluid wagons and crafting machines.
Flow through the fluidbox in the last tick. It is the larger of in-flow and out-flow.
index | :: uint |
|
Fluid wagons do not track it and will return 0.
Gets unique fluid system identifier of selected fluid box. May return nil for fluid wagon, fluid turret's internal buffer or a fluidbox which does not belong to a fluid system
index | :: uint |
|
Flushes all fluid from this fluidbox and its fluid system.
index | :: uint |
|
fluid | :: FluidIdentification? |
If provided, only this fluid is flushed. |
If provided, only this fluid is flushed. |
→ dictionary[string → float] |
The removed fluid. |
All methods and properties that this object supports.
The entity that owns this fluidbox.
Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false
. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
The class name of this object. Available even when valid
is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
Number of fluid boxes.
Access, set or clear a fluid box. The index must always be in bounds (see LuaFluidBox::length_operator). New fluidboxes may not be added or removed using this operator.
Is nil
if the given fluid box does not contain any fluid. Writing nil
removes all fluid from the fluid box.