Working animations: correct prototyping - how?

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
nucleargen
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Sat May 07, 2016 4:51 pm
Contact:

Working animations: correct prototyping - how?

Post by nucleargen »

I'm not very familiar with graphic redactors, but want to create updated graphics for some assembling machine entities with different effects on different recipes. I.e: there is vanilla Chemical plant with different colored boiling patch, depended what product being produced.
Since it is undocumented in nor the factorio wiki nor factorio lua-api docs - i have a big question: how can i create this effects?

By thinking on entity code i understand next:
- different recipe effects depends on "working_visualisations" array, which items has "apply_recipe_tint" property with string tint name. This is in entity prototype.
- effect coloring depends on "crafting_machine_tint" recipe property array formed as: "tint_name": {color specification}
- graphic patches used in tint must be grayscaled
Is this correct?

Then, i was viewed Centrifuge entity protype. It hasn't any tint since have the same effect on all recipes. But have "uranium-glow" effect with adjuctable color, intensity, size and center. Can it be controlled by "apply_recipe_tint" ?
And then Centrifuge have some other graphics properties:
- "idle_animation" with "always_draw_idle_animation" flag. This animation works all the time entity rendered
- "animation" - doing green highlight on centrifuge when it is working
- "working_visualisation" - adding green glow effect (as written above) at night
- "working_visualisation_disabled" - what does this property do since it mostly matches with "animation"?
What properties can be controlled by recipe tint and how can i prepare graphics for this?
The brightest future in the center of a nuclear explosion...2003©nucleargen

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Working animations: correct prototyping - how?

Post by darkfrei »

You can have several layers, see demo-biter-animations.lua:

Code: Select all

function spawner_idle_animation(variation, tint)
return
  {
    layers =
    {
      {
        filename = "__base__/graphics/entity/spawner/spawner-idle.png",
        line_length = 8,
        width = 243,
        height = 181,
        frame_count = 8,
        animation_speed = 0.18,
        direction_count = 1,
        run_mode = "forward-then-backward",
        shift = {0.140625 - 0.65, -0.234375},
        y = variation * 181
      },
      {
        filename = "__base__/graphics/entity/spawner/spawner-idle-mask.png",
        flags = { "mask" },
        width = 166,
        height = 148,
        frame_count = 8,
        animation_speed = 0.18,
        run_mode = "forward-then-backward",
        shift = {-0.34375 - 0.65, -0.375},
        line_length = 8,
        tint = tint,
        y = variation * 148
      }
    }
  }
end
You are need LuaEntity.recipe and
LuaEntity.graphics_variation

User avatar
nucleargen
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Sat May 07, 2016 4:51 pm
Contact:

Re: Working animations: correct prototyping - how?

Post by nucleargen »

Graphics_variation is not i'm searching for. This property provide several different visualisations of the object, but is independent from recipe currently working on.
In my researches i understand next things:
- recipe_tint applies only on working_visualisations
- working_visualisations doesn't sync its speed with machine speed (such as animation/idle_animation)
- effects in working_visualisations doesn't affected by recipe_tint
The brightest future in the center of a nuclear explosion...2003©nucleargen

Post Reply

Return to “Modding discussion”