Change textures of ores

Place to get help with not working mods / modding interface.
Post Reply
User avatar
<NO_NAME>
Filter Inserter
Filter Inserter
Posts: 291
Joined: Tue Aug 02, 2016 9:52 am
Contact:

Change textures of ores

Post by <NO_NAME> »

I'm trying to change colors of iron and copper ores because the Internet is laughing at us.
I've found prototypes in file "prototypes/entity/demo-resources.lua" and it was looking pretty straightforward.

I can change icon of ore item with single line:

Code: Select all

data.raw["item"]["iron-ore"].icon = "new texture.png"
However, code to change how ore deposit looks isn't working:

Code: Select all

data.raw["item"]["iron-ore"].stages.sheet.filename = "new texture.png"
The error is:

Code: Select all

Attempt to index field 'stages' (a nil value)
which is weird, because I can clearly see that this field is created in "demo-resources.lua".

I was tinkering with it a few hours and I've achieved nothing. I'm out of ideas what else I can try.
I'm pretty new to both Factorio mods and lua so don't make the answer more complicated than it has to be.
I am a translator. And what did you do for Factorio?
Check out my mod "Realistic Ores" and my other mods!

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Change textures of ores

Post by steinio »

Shouldn't the "item" be "resource"?

The "item" is what you mine.
Image

Transport Belt Repair Man

View unread Posts

User avatar
<NO_NAME>
Filter Inserter
Filter Inserter
Posts: 291
Joined: Tue Aug 02, 2016 9:52 am
Contact:

Re: Change textures of ores

Post by <NO_NAME> »

steinio wrote:Shouldn't the "item" be "resource"?

The "item" is what you mine.
Thanks! That was the problem.
I am a translator. And what did you do for Factorio?
Check out my mod "Realistic Ores" and my other mods!

User avatar
<NO_NAME>
Filter Inserter
Filter Inserter
Posts: 291
Joined: Tue Aug 02, 2016 9:52 am
Contact:

Re: Change textures of ores

Post by <NO_NAME> »

Here are all fields that need to be replaced to change look of an ore. Maybe this will help someone else.

Code: Select all

data.raw["item"][oreName .. "-ore"].icon = "..."

data.raw["resource"][oreName .. "-ore"].icon = "..."
data.raw["resource"][oreName .. "-ore"].map_color = {r=0.000, g=0.000, b=0.000}
data.raw["resource"][oreName .. "-ore"].stages.sheet.filename = "..."
data.raw["resource"][oreName .. "-ore"].stages.sheet.hr_version.filename = "..."

for k,picture in pairs(data.raw["particle"][oreName .. "-ore-particle"].pictures) do
	picture.filename = "..."
	picture.hr_version.filename = "..."
end
for k,shadow in pairs(data.raw["particle"][oreName .. "-ore-particle"].shadows) do
	shadow.filename = "..."
	shadow.hr_version.filename = "..."
end
I am a translator. And what did you do for Factorio?
Check out my mod "Realistic Ores" and my other mods!

User avatar
<NO_NAME>
Filter Inserter
Filter Inserter
Posts: 291
Joined: Tue Aug 02, 2016 9:52 am
Contact:

Re: Change textures of ores

Post by <NO_NAME> »

Last edited by <NO_NAME> on Tue Jan 23, 2018 11:20 pm, edited 2 times in total.
I am a translator. And what did you do for Factorio?
Check out my mod "Realistic Ores" and my other mods!

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Change textures of ores

Post by steinio »

The link leads to the mod edit page and not to the overview.

But nice idea so far.
Image

Transport Belt Repair Man

View unread Posts

User avatar
<NO_NAME>
Filter Inserter
Filter Inserter
Posts: 291
Joined: Tue Aug 02, 2016 9:52 am
Contact:

Re: Change textures of ores

Post by <NO_NAME> »

steinio wrote:
The link leads to the mod edit page and not to the overview.

But nice idea so far.
Fixed. (This feeling when your shameless self-advertising backfires.)
I am a translator. And what did you do for Factorio?
Check out my mod "Realistic Ores" and my other mods!

Post Reply

Return to “Modding help”