it's possible Render an entity

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
evandro1994
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Sep 12, 2020 4:28 am
Contact:

it's possible Render an entity

Post by evandro1994 »

it is possible to change
Render an entity during the game
:geek:

for exemple https://lua-api.factorio.com/latest/Lua ... _animation

but I don't know how to do it

Qon
Smart Inserter
Smart Inserter
Posts: 2118
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: it's possible Render an entity

Post by Qon »

I haven't seen anyone using it. Though, if it is done right then in some cases you would just think that it's done with static file modifications so you wouldn't be able to tell how it is actually implemented by just looking at the result.

I haven't used it yet, but I'm thinking of doing it in the future for one of my mod ideas. So I can't really help you that much now since I don't have any code examples I can point to. What kind of modding experience do you have?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: it's possible Render an entity

Post by DaveMcW »

You must define a special type called "animation" in data.lua. For example:

Code: Select all

data:extend{
  {
    type = "animation",
    name = "my-animation",
    filename = "__base__/graphics/entity/electric-furnace/electric-furnace-heater.png",
    width = 25,
    height = 15,
    frame_count = 12,
    animation_speed = 0.5,
  },
}
In control.lua you can then place the animation anywhere on the map. You cannot edit the animation in control.lua, but it does have some properties like scale and speed that you can adjust.

evandro1994
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Sep 12, 2020 4:28 am
Contact:

Re: it's possible Render an entity

Post by evandro1994 »

Qon wrote:
Sat Sep 12, 2020 7:41 am
I haven't seen anyone using it. Though, if it is done right then in some cases you would just think that it's done with static file modifications so you wouldn't be able to tell how it is actually implemented by just looking at the result.

I haven't used it yet, but I'm thinking of doing it in the future for one of my mod ideas. So I can't really help you that much now since I don't have any code examples I can point to. What kind of modding experience do you have?
I have little experience.
I made a mod that allows you to recycle the remains of dead entities by returning parts of the recipes

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

Re: it's possible Render an entity

Post by darkfrei »

evandro1994 wrote:
Thu Sep 17, 2020 1:45 am
I made a mod that allows you to recycle the remains of dead entities by returning parts of the recipes
Like this one?
https://mods.factorio.com/mod/LootingRemnants

evandro1994
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Sep 12, 2020 4:28 am
Contact:

Re: it's possible Render an entity

Post by evandro1994 »

darkfrei wrote:
Thu Sep 17, 2020 8:59 am
evandro1994 wrote:
Thu Sep 17, 2020 1:45 am
I made a mod that allows you to recycle the remains of dead entities by returning parts of the recipes
Like this one?
https://mods.factorio.com/mod/LootingRemnants
is similar to that
then you have to mine the dead entity to get the items

evandro1994
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Sep 12, 2020 4:28 am
Contact:

Re: it's possible Render an entity

Post by evandro1994 »

DaveMcW wrote:
Sat Sep 12, 2020 7:55 am
You must define a special type called "animation" in data.lua. For example:

Code: Select all

data:extend{
  {
    type = "animation",
    name = "my-animation",
    filename = "__base__/graphics/entity/electric-furnace/electric-furnace-heater.png",
    width = 25,
    height = 15,
    frame_count = 12,
    animation_speed = 0.5,
  },
}
In control.lua you can then place the animation anywhere on the map. You cannot edit the animation in control.lua, but it does have some properties like scale and speed that you can adjust.
it is possible to hide an animation from a standard entity and overlay a temporary animation.

Post Reply

Return to “Modding discussion”