Ore De-clutter

by Koravel

Removes ore clutter from Map View

Utilities
4 days ago
2.0
14
Environment

g For modders

4 days ago
(updated 4 days ago)

Hello, fellow mod developers! I am new to Factorio modding and I need your help!
For the love of god please tell is there really no way to edit data.raw prototypes at runtime? For this instance as you might understand, I need to dynamically change data.raw.resource["some-ore"].map_color but as far as I can tell this is impossible without some dirty hacks like passing entire data.raw through load stages which is in my opinion is not a good practice

4 days ago

As you have probably figured out, prototypes are completely immutable at runtime. data.raw does not exist in the Runtime stage, and some of its components can be accessed read-only from prototypes.

My assumption is that you want to convert this mod into a runtime switch to let the player show/hide ore patches on the map whenever they want?

It may be most practical to ask the developers in the Modding interface requests forum to add a new field to MapViewSettings which would easily let you hide the ores on the map via the engine. (Or make a full blown suggestion instead for a proper toggle button on the Map interface.)

If they agreed to add it, you would almost certainly have to wait for Factorio 2.1 until we see it in the game.


Failing that, your most likely approach would be to hide them on the map permanently like you're doing already, and devise a method to draw them conditionally at runtime. I would look into the Resource Map Label Marker mod as an existing example of how you can do this.

That mod uses chart tags, which are shared per force. You might want to use rendering objects instead, which you can control per-player.

Instead of setting resource_patch_search_radius = 0 in the prototypes, you can set game.draw_resource_selection = false at runtime to disable the hover behaviour for ores on the map. This property is global, it cannot be set per-player.

Good luck!

New response