[Resolved] How do I make a new liquid?

Place to get help with not working mods / modding interface.
Starfoth
Inserter
Inserter
Posts: 27
Joined: Thu Sep 22, 2016 10:29 pm
Contact:

[Resolved] How do I make a new liquid?

Post by Starfoth »

I have tried searching for it and tried dissecting other mods that add liquids, but one issue remains; how do I make the graphic for it? Not the icon, I mean color the liquid a specific color? I can't find where that info is or where it is on the liquids lua file.
Last edited by Starfoth on Fri Oct 28, 2016 3:13 am, edited 1 time in total.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: How do I make a new liquid?

Post by aubergine18 »

Here's an example of one of the existing liquids, they are all defined in data.raw.fluid

Note the base_color and flow_color properties:

Code: Select all

    {
      base_color = {
        b = 0,
        g = 0,
        r = 0
      },
      default_temperature = 25,
      flow_color = {
        b = 0.5,
        g = 0.5,
        r = 0.5
      },
      flow_to_energy_ratio = 0.59,
      heat_capacity = "1KJ",
      icon = "__base__/graphics/icons/fluid/crude-oil.png",
      max_temperature = 100,
      name = "crude-oil",
      order = "a[fluid]-b[crude-oil]",
      pressure_to_speed_ratio = 0.4,
      type = "fluid"
    },
So you'll need to make a table like that for your fluid, obviously with custom name, then

Code: Select all

data:extend{ your_liquid_table }
For example:

Code: Select all

data:extend {
    {
      base_color = {
        b = 0,
        g = 0,
        r = 0
      },
      default_temperature = 25,
      flow_color = {
        b = 0.5,
        g = 0.5,
        r = 0.5
      },
      flow_to_energy_ratio = 0.59,
      heat_capacity = "1KJ",
      icon = "__YourModName__/graphics/icons/fluid/your-liquid-name-here.png",
      max_temperature = 100,
      name = "your-liquid-name-here",
      order = "a[fluid]-b[crude-oil]",
      pressure_to_speed_ratio = 0.4,
      type = "fluid"
    },
}
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Starfoth
Inserter
Inserter
Posts: 27
Joined: Thu Sep 22, 2016 10:29 pm
Contact:

Re: How do I make a new liquid?

Post by Starfoth »

Thank you again for your help
Post Reply

Return to “Modding help”