Prototype/Fluid: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(0.16)
(Updated styling of prototype doc migration note)
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Mandatory properties ==
<div class="stub"><p>'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/prototypes/FluidPrototype.html https://lua-api.factorio.com/latest/prototypes/FluidPrototype.html]
Inherits all properties from [[Prototype]].
 
</p><p>This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums].</p></div>


=== icon ===
'''Type''': [[Types/FileName]]


=== icon_size ===
'''Type''': [[Types/uint]]


The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.
{{Prototype parent|PrototypeBase}}
A fluid.


=== default_temperature ===
{{Prototype TOC|fluid}}
'''Type''': [[Types/double]]


Also the minimum temperature of the fluid.
== Mandatory properties ==
Inherits all properties from [[PrototypeBase]].


=== max_temperature ===
{{Prototype property|icons, icon, icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]}}
'''Type''': [[Types/double]]


=== base_color ===
{{Prototype property|default_temperature|[[Types/double|double]]}}
'''Type''': [[Types/Color]]
Also the minimum temperature of the fluid. Has to be lower than <code>max_temperature</code>.


{{Prototype property|base_color|[[Types/Color|Color]]}}
Used by bars that show the fluid color, like the flamethrower turret fill bar in the tooltip, or the fill bar for the fluidwagon tooltip; and for the pipe windows and storage tank fill gauges.
Used by bars that show the fluid color, like the flamethrower turret fill bar in the tooltip, or the fill bar for the fluidwagon tooltip; and for the pipe windows and storage tank fill gauges.


=== flow_color ===
{{Prototype property|flow_color|[[Types/Color|Color]]}}
'''Type''': [[Types/Color]]
 
Used only for pipe windows or storage tank fill gauges.
Used only for pipe windows or storage tank fill gauges.
=== pressure_to_speed_ratio ===
'''Type''': [[Types/double]]
=== flow_to_energy_ratio ===
'''Type''': [[Types/double]]
Flow to energy ratio can't be negative.


== Optional properties ==
== Optional properties ==


=== heat_capacity ===
{{Prototype property|max_temperature|[[Types/double|double]]|value of <code>default_temperature</code>|optional=true}}
'''Type''': [[Types/Energy]]
 
'''Default''': "1KJ"


{{Prototype property|heat_capacity|[[Types/Energy|Energy]]|"1KJ"|optional=true}}
Joule needed to heat 1 Unit by 1 °C.
Joule needed to heat 1 Unit by 1 °C.


=== fuel_value ===
{{Prototype property|fuel_value|[[Types/Energy|Energy]]|"0J"|optional=true}}
'''Type''': [[Types/Energy]]
 
'''Default''': "0J"
 
=== emissions_multiplier ===
'''Type''': [[Types/double]]
 
'''Default''': 1.0


{{Prototype property|emissions_multiplier|[[Types/double|double]]|1.0|optional=true}}
Scales pollution generated when the fluid is consumed.
Scales pollution generated when the fluid is consumed.


=== gas_temperature ===
{{Prototype property|subgroup|[[Types/string|string]]|"fluid"|optional=true}}
'''Type''': [[Types/double]]
The value of this property may not be an empty string. It either has to be nil, or a non-empty string.
 
'''Default''': max value of double (1.7976931348623158e+308)
 
=== max_push_amount ===
'''Type''': [[Types/double]]
 
'''Default''': 1
 
When two fluids interact how much of it can be pushed at most.
 
=== ratio_to_push ===
'''Type''': [[Types/double]]


'''Default''': 2.1
{{Prototype property|gas_temperature|[[Types/double|double]]|max value of double|optional=true}}
Above this temperature the <code>gas_flow</code> animation is used to display the fluid inside storage tanks and pipes.


How much more height must one fluid have to push the other.
{{Prototype property|hidden|[[Types/bool|bool]]|false|optional=true}}
Hides the fluid from the signal selection screen.


=== auto_barrel ===
== Custom properties ==
'''Type''': [[Types/bool]]
The base mod reads the following property in data-updates.lua to determine if the fluid should be barreled. The property itself is not read by the C++ part of the game which means that it is discarded by the game when loading finishes.
* auto_barrel - [[Types/bool|bool]] - Optional, defaults to true. Whether the fluid should be included in the barrel recipes automatically generated in data-updates.lua in the base mod.


Whether the fluid should be included in the barrel recipes automatically generated in data-updates.lua in the base mod.
== Differing defaults ==
=== subgroup ===
:''See [[Prototype#subgroup]]''
'''Default''': "fluid"
The value of this property may not be an empty string. It either has to be nil, or a non-empty string.
== Example ==
== Example ==
<syntaxhighlight lang="lua">  {
<syntaxhighlight lang="lua">  {
Line 98: Line 59:
     flow_color = {r=0.7, g=0.7, b=0.7},
     flow_color = {r=0.7, g=0.7, b=0.7},
     icon = "__base__/graphics/icons/fluid/water.png",
     icon = "__base__/graphics/icons/fluid/water.png",
     icon_size = 32,
     icon_size = 64,
     order = "a[fluid]-a[water]",
    icon_mipmaps = 4,
    pressure_to_speed_ratio = 0.4,
     order = "a[fluid]-a[water]"
    flow_to_energy_ratio = 0.59
   }</syntaxhighlight>
   }</syntaxhighlight>

Revision as of 10:43, 21 September 2023

The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/prototypes/FluidPrototype.html

This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.


Template:Prototype parent A fluid.

Template:Prototype TOC

Mandatory properties

Inherits all properties from PrototypeBase.

Template:Prototype property

Template:Prototype property Also the minimum temperature of the fluid. Has to be lower than max_temperature.

Template:Prototype property Used by bars that show the fluid color, like the flamethrower turret fill bar in the tooltip, or the fill bar for the fluidwagon tooltip; and for the pipe windows and storage tank fill gauges.

Template:Prototype property Used only for pipe windows or storage tank fill gauges.

Optional properties

Template:Prototype property

Template:Prototype property Joule needed to heat 1 Unit by 1 °C.

Template:Prototype property

Template:Prototype property Scales pollution generated when the fluid is consumed.

Template:Prototype property The value of this property may not be an empty string. It either has to be nil, or a non-empty string.

Template:Prototype property Above this temperature the gas_flow animation is used to display the fluid inside storage tanks and pipes.

Template:Prototype property Hides the fluid from the signal selection screen.

Custom properties

The base mod reads the following property in data-updates.lua to determine if the fluid should be barreled. The property itself is not read by the C++ part of the game which means that it is discarded by the game when loading finishes.

  • auto_barrel - bool - Optional, defaults to true. Whether the fluid should be included in the barrel recipes automatically generated in data-updates.lua in the base mod.

Example

  {
    type = "fluid",
    name = "water",
    default_temperature = 15,
    max_temperature = 100,
    heat_capacity = "0.2KJ",
    base_color = {r=0, g=0.34, b=0.6},
    flow_color = {r=0.7, g=0.7, b=0.7},
    icon = "__base__/graphics/icons/fluid/water.png",
    icon_size = 64,
    icon_mipmaps = 4,
    order = "a[fluid]-a[water]"
  }