Realistic Ores

by ouk_ouk

New look for iron, copper and uranium ores. Now, they have colors of real ores, not refined metals. Also, uranium ore glow is decreased to 70%. (Configurable and with support for other mods.)

Tweaks
10 days ago
0.15 - 2.1
14.9K
Environment

b mod compatibility

15 days ago

I want to publish a new mod, Silicon Circuits (SC) that depends on Realistic Ores (RO). Before I do that, I would like to fix compatibility issue.

RO changes the appearance of iron ore. SC repurposes the original iron ore graphics to be metallic silicon. To get that done, SC needs to refer to the iron ore data structures before they are updated by RO.

Unfortunately, RO updates graphics in data.lua (first phase). The way mods are sorted (lexicographic) means RO runs its data.lua before SC, making it impossible for SC to read the old data. It would be lovely if you moved the graphics updates to data-updates.lua (second phase). That's where mods should be updating base or other mod data.

11 days ago
(updated 11 days ago)

The question is whether you want to use the vanilla texture, or whatever was set there before my mod changed it, even if it was modified by another mod.
If you just want the vanilla texture, you can hardcode the path. It's something like "__base__/graphics/icons/iron-ore.png", if I remember right.

If you want whatever were set before, we can discuss and figure something out.
I'm not convinced that moving it to data-updates.lua is the right move. Some other mode may depend on it being in data.lua, so this is a slightly risky move.

11 days ago
(updated 11 days ago)

I don't know what all RO modifies, but the iron-ore item graphics are a little more than a single path string:

"iron-ore": 
{
  "type": "item",
  "name": "iron-ore",
  "icon": "__RealisticOres__/graphics/icons/iron-ore.png",
  "pictures": 
  [

    {
      "size": 64,
      "filename": "__RealisticOres__/graphics/icons/iron-ore.png",
      "scale": 0.5,
      "mipmap_count": 4
    },

    {
      "size": 64,
      "filename": "__RealisticOres__/graphics/icons/iron-ore-1.png",
      "scale": 0.5,
      "mipmap_count": 4
    },

    {
      "size": 64,
      "filename": "__RealisticOres__/graphics/icons/iron-ore-2.png",
      "scale": 0.5,
      "mipmap_count": 4
    },

    {
      "size": 64,
      "filename": "__RealisticOres__/graphics/icons/iron-ore-3.png",
      "scale": 0.5,
      "mipmap_count": 4
    }
  ],
  "color_hint": 
  {
    "text": "I"
  }
}

There isn't any risk, because another mod depending on RO will always run its data-updates.lua after RO's data-updates.lua. Factorio ensures this. It's largely why optional dependencies are a thing.

It's called data-updates.lua for a reason: That's where you update things, whereas data.lua is where you define entirely new things. When done correctly, it enables us to navigate situations such as this one, but also it allows mods to interoperate without explicit dependencies.

11 days ago
(updated 11 days ago)

You're maybe wondering about mods that don't explicitly depend on RO, but still expect that ore retextures should happen in data.lua. Those mods might do things in data-updates.lua that break. I argue that those mods are already broken. If they need RO to run first they should depend on it. If they need all retexture mods to run first, they should put the code in data-final-fixes.lua.

If you still don't want to make the change I recommend, I'll leave it at that. I hope you reconsider. In any case thanks for making this mod. It's already quite lovely.

10 days ago

OK, I can see your point.
I moved the code from "data.lua" to "data-updates.lua". See if this works for you.

10 days ago

Wonderful. Thanks so much for taking the time to help me out.
In case you're curious, here it is: Silicon Circuits.

10 days ago

The premise doesn't look bad. I'll download it for the semi-unlikely case I will remember to test compatibility when I made some changes.
(Or if I will be doing a modded run one day.)

New response