Page 1 of 1

Changing Item Picture

Posted: Sat Dec 05, 2015 8:19 am
by KTobias
I'd like to change the default base item picture (icon) to one that i have created without removing the original base picture. Is it possible to have a mod do so and if so, how?

Re: Changing Item Picture

Posted: Sat Dec 05, 2015 11:25 am
by prg
In data-updates.lua:

Code: Select all

data.raw.item["iron-plate"].icon = "__yourmod__/graphics/new.png"

Re: Changing Item Picture

Posted: Sat Dec 05, 2015 10:10 pm
by KTobias
So here's what i have for the code to change the icon picture of the iron-axe. This is in the data-updates.lua.

data.raw.mining-tools["iron-axe"].icon = "__DSD__/graphics/axes/iron-axe.png"

But I get this error.

__DSD__/data-updates.lua:1: syntax error near '-'

Any ideas?

Re: Changing Item Picture

Posted: Sat Dec 05, 2015 10:36 pm
by prg
You need to use the square bracket syntax for element names containing punctuation and such. Also, it's just mining-tool.

Code: Select all

data.raw["mining-tool"]["iron-axe"].icon = "__DSD__/graphics/axes/iron-axe.png"

Re: Changing Item Picture

Posted: Sat Dec 05, 2015 11:12 pm
by KTobias
Yes,

That worked.

Thanks prg