LuaEntityPrototype::fluid_energy_source_prototype

Post Reply
CaveGrinder
Inserter
Inserter
Posts: 35
Joined: Fri Aug 24, 2018 7:42 pm
Contact:

LuaEntityPrototype::fluid_energy_source_prototype

Post by CaveGrinder »

Hi all,

i would like to request
LuaEntityPrototype::fluid_energy_source_prototype
which should expose the values from
https://wiki.factorio.com/Types/EnergyS ... rgy_source

my use case:
i have an assembling-machine which uses fluids as energy source. i would like to determine the fluid capacity of this source, but i currently don't see a way to do it in the control.lua. the issue is:

1.
game.entity_prototypes["robot-labor-assembler"].fluid_capacity is 0. this is as expected due to the comment
https://lua-api.factorio.com/latest/Lua ... d_capacity
"Note: Crafting machines will report 0 due to their fluid capacity being what ever a given recipe needs."

2.#game.entity_prototypes["robot-labor-assembler"].fluidbox_prototypes is 0 (the array is empty). this may or may not be ok. For me it is ok to not have the fluid energy sources as part of the fluidbox_prototypes. But then i would expect to get them somewhere else.

Therefore i am requesting LuaEntityPrototype::fluid_energy_source_prototype, because currently the entity prototype class only has "burner_prototype" and "electric_energy_source_prototype".

For reference, the prototype i am working with looks like this:

Code: Select all

{
    type = "assembling-machine",
    name = "robot-labor-assembler",
    icon = "__base__/graphics/icons/assembling-machine-1.png",
    icon_size = 32,
    flags = {"placeable-neutral", "placeable-player", "player-creation"},
    minable = {mining_time = 0.2, result = "robot-labor-assembler"},
    max_health = 300,
    dying_explosion = "medium-explosion",
    corpse = "medium-remnants",
    resistances =
    {
      {
        type = "fire",
        percent = 70
      }
    },
    collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
    selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
    fast_replaceable_group = "assembling-machine",
    next_upgrade = "assembling-machine-2",
    alert_icon_shift = util.by_pixel(-3, -12),
    animation =
    {
      layers =
      {
        {
          filename = "__base__/graphics/entity/assembling-machine-1/assembling-machine-1.png",
          priority="high",
          width = 108,
          height = 114,
          frame_count = 32,
          line_length = 8,
          shift = util.by_pixel(0, 2),
          hr_version =
          {
            filename = "__base__/graphics/entity/assembling-machine-1/hr-assembling-machine-1.png",
            priority="high",
            width = 214,
            height = 226,
            frame_count = 32,
            line_length = 8,
            shift = util.by_pixel(0, 2),
            scale = 0.5
          }
        },
        {
          filename = "__base__/graphics/entity/assembling-machine-1/assembling-machine-1-shadow.png",
          priority="high",
          width = 95,
          height = 83,
          frame_count = 1,
          line_length = 1,
          repeat_count = 32,
          draw_as_shadow = true,
          shift = util.by_pixel(8.5, 5.5),
          hr_version =
          {
            filename = "__base__/graphics/entity/assembling-machine-1/hr-assembling-machine-1-shadow.png",
            priority="high",
            width = 190,
            height = 165,
            frame_count = 1,
            line_length = 1,
            repeat_count = 32,
            draw_as_shadow = true,
            shift = util.by_pixel(8.5, 5),
            scale = 0.5
          }
        }
      }
    },
    crafting_categories = {"crafting", "basic-crafting", "advanced-crafting"},
    crafting_speed = 1.5,
    energy_source =
    {
        type = "fluid",
        emissions_per_minute = 0,
        render_no_power_icon = true,
        fluid_box =
        {
          base_area = 1,
          height = 1,
          base_level = 0,
          pipe_connections =
          {
          },
          production_type = "input",
          filter = "robot-labor"
        },
        burns_fluid = true,
        effectivity = 1,
    },
    energy_usage = "75W",
    open_sound = { filename = "__base__/sound/machine-open.ogg", volume = 0.85 },
    close_sound = { filename = "__base__/sound/machine-close.ogg", volume = 0.75 },
    vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
    working_sound =
    {
      sound =
      {
        {
          filename = "__base__/sound/assembling-machine-t1-1.ogg",
          volume = 0.8
        },
        {
          filename = "__base__/sound/assembling-machine-t1-2.ogg",
          volume = 0.8
        }
      },
      idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
      apparent_volume = 1.5
    }
  },
      {
    type = "fluid",
    name = "robot-labor",
    default_temperature = 25,
    fuel_value = "1.25J",
    base_color = {r=0, g=0, b=0},
    flow_color = {r=0.5, g=0.5, b=0.5},
    max_temperature = 100,
    icon = "__base__/graphics/icons/fluid/crude-oil.png",
    icon_size = 32,
    order = "a[fluid]-b[crude-oil]"
  },
(It doesn't have fluid boxes on the top level because none of the recipes i want in this assembler have fluid ingredients or results)

Workaround:
the workaround currently is to determine this number from a concrete entities fluid boxes, such as
myEntity.fluidbox.get_capacity(myIndex)
where fluid energy sources are available. However since this number should be constant for all entities of this prototype, independent of the current recipe, i would like to avoid doing this repeatedly.

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: LuaEntityPrototype::fluid_energy_source_prototype

Post by Therenas »

I requested this, along with one for heat, some time ago here. Would still really love to have it.

CaveGrinder
Inserter
Inserter
Posts: 35
Joined: Fri Aug 24, 2018 7:42 pm
Contact:

Re: LuaEntityPrototype::fluid_energy_source_prototype

Post by CaveGrinder »

thanks, i must have missed that post. then it is a duplicate request

Post Reply

Return to “Implemented mod requests”