Creating a new texture programmatically?

Place to get help with not working mods / modding interface.
Post Reply
doktorstick
Fast Inserter
Fast Inserter
Posts: 152
Joined: Fri Aug 12, 2016 10:22 pm
Contact:

Creating a new texture programmatically?

Post by doktorstick »

Howdy. When I tweaked the splitters in my mod, I manually edited every animation frame in Paint.NET to dinstinguish them visually from the default splitters (four direction facings, three splitter types, and 32 animation frames).

In thinking about supporting other mod author's splitters natively, I was wondering if there is a better way to accomplish the different look--like with a texture overlay or something. I imagine this is possible because it's done with circuit network connections.

Would someone mind outlining what I would need to do to accomplish this? I'm a complete graphics/animation newbie, so I'm not sure where to start or what to search for to find out. :D

Thanks!

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Creating a new texture programmatically?

Post by Adil »

Well, have look at how default entities are defined. Most of them list several layers in their animations. If you need, you can modify the tint value of the layer, add new layers, including masks of various degree of transparency (tint with alpha value less than 1).
The algorithm is pretty much standard one, you modify data.raw after the entities of interest are known to be included (to do that you either list relevant mods as dependencies for your one, or use data-updates.lua or later.) .
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

doktorstick
Fast Inserter
Fast Inserter
Posts: 152
Joined: Fri Aug 12, 2016 10:22 pm
Contact:

Re: Creating a new texture programmatically?

Post by doktorstick »

Yeah, I figured it out. The item in question had it's animation defined in a top-level table. By moving that definition into a newly created sub-table called layers, i was able to add another animation frame that's my texture overlay. It took some hunting around to find the magic sauce (i.e., that sub-table). Thanks.

User avatar
Xerus
Burner Inserter
Burner Inserter
Posts: 19
Joined: Wed Jul 19, 2017 8:44 am
Contact:

Re: Creating a new texture programmatically?

Post by Xerus »

could I get some more detail on how to do this? I can't find any documentation...

Post Reply

Return to “Modding help”