Hello, I'm currently working on a personal project to replace icon graphics for parts of bob's and angels mods, and the process for changing the graphics for an item or recipe is not clear to me. Could someone offer help or maybe an example of a line that could accomplish this task?
Additionally, how can I make sure that it is not overridden by any other mod? It will be hard to tell if my code works if the graphics are being overridden by another mod.
Thanks!
Updating graphics of installed mods
-
- Inserter
- Posts: 28
- Joined: Sat Jun 11, 2016 1:49 pm
- Contact:
Re: Updating graphics of installed mods
It's generally something like
so in your case maybe
to do it one by one, or if you have replacement graphics for everything,
Recipes might not have an icon defined and simply inherit the one of their result, but the icon can still be defined in case there are multiple results or e.g. for the different ways to produce solid fuel.
If you put that code in data-final-fixes.lua it'll hopefully run last so the changes will stick around. (If another mod is doing something similar in data-final-fixes.lua and overwriting your changes, add a dependency to it so your mod will be loaded last.)
Code: Select all
data.raw["type"]["name"].the_thing_you_want_to_change = new_value
Code: Select all
data.raw["item"]["iron-chest"].icon = "__newicons__/graphics/icons/iron-chest.png"
Code: Select all
for _, v in pairs(data.raw["item"]) do
v.icon = string.gsub(v.icon, "__oldmod__", "__newmod__")
end
If you put that code in data-final-fixes.lua it'll hopefully run last so the changes will stick around. (If another mod is doing something similar in data-final-fixes.lua and overwriting your changes, add a dependency to it so your mod will be loaded last.)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Re: Updating graphics of installed mods
data-updates.lua and data-final-fixes.lua should be avoided whenever possible, it is much better to use data.lua and a dependency.prg wrote:If you put that code in data-final-fixes.lua it'll hopefully run last so the changes will stick around. (If another mod is doing something similar in data-final-fixes.lua and overwriting your changes, add a dependency to it so your mod will be loaded last.)
viewtopic.php?p=127496#p127496
Re: Updating graphics of installed mods
In the info file you can write mods what you need. Your mod will be read after them.
-
- Inserter
- Posts: 28
- Joined: Sat Jun 11, 2016 1:49 pm
- Contact:
Re: Updating graphics of installed mods
In that case, how would I detect if one of the mods is installed (so I can use it in an if/then statement) without having to explicitly state it in a config file?
Additionally, it appears that mods that I have added optional dependencies for are still overriding my icons. Does that mean I am forced to use data-final-fixes.lua to force my changes to be loaded last?
Additionally, it appears that mods that I have added optional dependencies for are still overriding my icons. Does that mean I am forced to use data-final-fixes.lua to force my changes to be loaded last?