Page 1 of 1

Change textures of ores

Posted: Tue Jan 23, 2018 1:48 pm
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.

Re: Change textures of ores

Posted: Tue Jan 23, 2018 3:14 pm
by steinio
Shouldn't the "item" be "resource"?

The "item" is what you mine.

Re: Change textures of ores

Posted: Tue Jan 23, 2018 3:53 pm
by <NO_NAME>
steinio wrote:Shouldn't the "item" be "resource"?

The "item" is what you mine.
Thanks! That was the problem.

Re: Change textures of ores

Posted: Tue Jan 23, 2018 8:42 pm
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

Re: Change textures of ores

Posted: Tue Jan 23, 2018 10:48 pm
by <NO_NAME>

Re: Change textures of ores

Posted: Tue Jan 23, 2018 11:10 pm
by steinio
The link leads to the mod edit page and not to the overview.

But nice idea so far.

Re: Change textures of ores

Posted: Tue Jan 23, 2018 11:22 pm
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.)