Page 1 of 1

Steam Turbine Animation Question

Posted: Tue Dec 15, 2020 8:35 pm
by AyleeJenn
dear community,

I am trying to do something and I almost made it but there is one thing that I just cannot get to work properly and I am coming here to seek for help. I have been trying on my own, reading, looking at stuff, but I can't figure it out. I am asking because I am honestly stuck :shock:


What am I trying to do?

I am trying to create an assembly machine that looks like the steam-turbine and animates when it crafts. The assembly is supposed to have one steam input and one water output, crafting steam back into water (and animating and making smoke like the steam turbine in the process).


Why is it not working?

Here is my code, maybe you can tell me why :oops:

Code: Select all

    
    type = "assembling-machine",
    name = "steam-to-water-assembly",
    icon = "__base__/graphics/icons/steam-turbine.png",
    icon_size = 32,
    flags = {"placeable-neutral", "placeable-player", "player-creation"},
    minable = {hardness = 0.2, mining_time = 1, result = "steam-to-water-assembly"},
    max_health = 300,
    corpse = "big-remnants",
    dying_explosion = "medium-explosion",
    alert_icon_shift = util.by_pixel(0, -12),
    resistances =
    {
      {
        type = "fire",
        percent = 70
      }
    },
    fluid_boxes =
    {
      {
        base_area = 1,
        height = 2,
        base_level = -1,
        pipe_covers = pipecoverspictures(),
        pipe_connections =
        {
          { type = "input", position = {0, 3} },
        },
        production_type = "input",
        filter = "steam",
      },
      {
        base_area = 1,
        height = 2,
        base_level = -1,
        pipe_covers = pipecoverspictures(),
        pipe_connections =
        {
          { type = "output", position = {0, -3} },
        },
        production_type = "output",
      },
      off_when_no_fluid_recipe = true
    },
    fast_replaceable_group = "steam-engine",
    collision_box = {{-1.35, -2.35}, {1.35, 2.35}},
    selection_box = {{-1.5, -2.5}, {1.5, 2.5}},
    animation = make_4way_animation_from_spritesheet({ layers =
    {
      {
        filename = "__base__/graphics/entity/steam-turbine/steam-turbine-H.png",
        width = 160,
        height = 123,
        frame_count = 1,
        shift = util.by_pixel(0, -2.5),
        hr_version = {
          filename = "__base__/graphics/entity/steam-turbine/hr-steam-turbine-H.png",
          width = 320,
          height = 245,
          frame_count = 1,
          shift = util.by_pixel(0, -2.75),
          scale = 0.5
          }
      },
      {
        filename = "__base__/graphics/entity/steam-turbine/steam-turbine-H-shadow.png",
        width = 217,
        height = 74,
        frame_count = 1,
        draw_as_shadow = true,
        shift = util.by_pixel(28.75, 18),
        hr_version = {
          filename = "__base__/graphics/entity/steam-turbine/hr-steam-turbine-H-shadow.png",
          width = 435,
          height = 150,
          frame_count = 1,
          draw_as_shadow = true,
          shift = util.by_pixel(28.5, 18),
          scale = 0.5
          }
      },
        {
          filename = "__base__/graphics/entity/steam-turbine/steam-turbine-V.png",
          width = 108,
          height = 173,
          frame_count = 1,
          shift = util.by_pixel(5, 6.5),
          hr_version = {
            filename = "__base__/graphics/entity/steam-turbine/hr-steam-turbine-V.png",
            width = 217,
            height = 347,
            frame_count = 1,
            shift = util.by_pixel(4.75, 6.75),
            scale = 0.5
          },
        },
        {
          filename = "__base__/graphics/entity/steam-turbine/steam-turbine-V-shadow.png",
          width = 151,
          height = 131,
          repeat_count = 8,
          frame_count = 1,
          line_length = 1,
          draw_as_shadow = true,
          shift = util.by_pixel(39.5, 24.5),
          hr_version = {
            filename = "__base__/graphics/entity/steam-turbine/hr-steam-turbine-V-shadow.png",
            width = 302,
            height = 260,
            repeat_count = 8,
            frame_count = 1,
            line_length = 1,
            draw_as_shadow = true,
            shift = util.by_pixel(39.5, 24.5),
            scale = 0.5
          },
        },
    }}),
    working_visualisations =
    {
      {
        animation =
        {
          filename = "__base__/graphics/entity/steam-turbine/steam-turbine-H.png",
          width = 160,
          height = 123,
          frame_count = 8,
          line_length = 4,
          shift = util.by_pixel(0, -2.5),
          hr_version = {
            filename = "__base__/graphics/entity/steam-turbine/hr-steam-turbine-H.png",
            width = 320,
            height = 245,
            frame_count = 8,
            line_length = 4,
            shift = util.by_pixel(0, -2.75),
            scale = 0.5
          }
        },
        light = {intensity = 0.4, size = 6, shift = {0.0, 1.0}, color = {r = 1.0, g = 1.0, b = 1.0}}
      },
      {
        animation =
        {
          filename = "__base__/graphics/entity/steam-turbine/steam-turbine-V.png",
          width = 108,
          height = 173,
          frame_count = 8,
          line_length = 4,
          shift = util.by_pixel(5, 6.5),
          hr_version = {
            filename = "__base__/graphics/entity/steam-turbine/hr-steam-turbine-V.png",
            width = 217,
            height = 347,
            frame_count = 8,
            line_length = 4,
            shift = util.by_pixel(4.75, 6.75),
            scale = 0.5
          }
        },
        smoke =
        {
          {
            name = "turbine-smoke",
            north_position = {0.0, -1.0},
            east_position = {0.75, -0.75},
            frequency = 10 / 32,
            starting_vertical_speed = 0.08,
            slow_down_factor = 1,
            starting_frame_deviation = 60
          }
        }
      }
    },
    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/steam-engine-90bpm.ogg",
          volume = 0.6
        },
      },
      idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
      apparent_volume = 1.5,
    },
    crafting_categories = {"crafting-with-fluid"},
    crafting_speed = 1,
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input",
      emissions = -1.5 / 4
    },
    energy_usage = "10kW",
    ingredient_count = 1,
  },

What happens is that the custom assembly can be placed but it cannot be rotated. And it looks like as if the horizontal and vertical steam turbine are overlapping on one another? :? Oh and it also creates no smoke.

I am trying to have the steam-to-water assembly so it can be rotated like the steam-turbine can be rotated. I wonder where I am going wrong :?

I have got everything working, I only need to get the graphics/animation part right now.

Thank you for reading and thank you in advance if you are considering to help me.

Re: Steam Turbine Animation Question

Posted: Wed Dec 16, 2020 10:02 am
by darkfrei
Please attach some mod.

You are need to define fluid boxes https://wiki.factorio.com/Prototype/Cra ... luid_boxes
With
off_when_no_fluid_recipe = false

https://wiki.factorio.com/Prototype/AssemblingMachine

Also the collision box must be square fo 90° rotations.

Re: Steam Turbine Animation Question

Posted: Wed Dec 16, 2020 2:45 pm
by AyleeJenn
dear darkfrei,

thanks to your help I was able to get it to work just now!! I had come as far as figuring out that the game does not allow non-square shaped collision boxes to rotate (unless you get a special backstage pass like the steam engine and the steam turbine ;) ). But what I was still unclear on is how to properly do it and get it to work!! Your suggestion helped and turning

off_when_no_fluid_recipe = true

into

off_when_no_fluid_recipe = false

helped as well.

thank you so much for your help and for your patience to not only respond to someone with less experience and skill in this as you no doubt command but also explaining to me the "why" of things. Thank you and have a lovely day!!