Quality Miners


Miners' mining speed is now affected by quality, configurable in settings. You can also enable miners to drop stacks on belts. It adds new miner prototypes to the game, so it is inherently incompatible with any other mod that does the same for miners.

Tweaks
14 days ago
2.0 - 2.1
1.96K
Mining

i Why use multiple prototypes?

2 days ago

I think the factorio api should support a way to change the mining speed for each quality.
It is often used for other machine speeds and parameters.
The mod you linked adds more module slots and so needs multiple prototypes, but I don't think they should be needed for what this Mod does.

I haven't looked at the code, but I just noticed it and wanted to mansion it.

2 days ago
(updated 2 days ago)

Thank you for the suggestion!

It's been a while since I wrote the mod, but from what I remember, the API only lets you read the mining_speed of drills at runtime.
(notice that this field is read-only https://lua-api.factorio.com/2.1.7/classes/LuaEntityPrototype.html#mining_speed)

I think I managed to make something work that increases the speed without quality in the initial development phases, but I scrapped the idea because anything that modified the speed (like a beacon being placed, unpowered, or the module setup) reset it to the prototype's original values.

In the prototype phase, I don't see anything that would "support a way to change the mining speed for each quality".
There are several separate defines that provide different functionality (https://lua-api.factorio.com/2.1.7/prototypes/QualityPrototype.html) but crafting speed increase from quality is reserved for crafting machines (and inherited by all furnaces, recyclers, etc. and assemblers, the foundry, EM plant, et al.)

Mining drills' inheritance chain: EntityWithOwnerPrototype « EntityWithHealthPrototype « EntityPrototype « Prototype « PrototypeBase

My general takeaways were that quality is a piece of extremely hardcoded, and pretty modder-unfriendly work; At least seeing how with every new feature they have to add a separate field to quality prototypes, which are likely read and executed upon inside the engine. The jank this mod has mostly has to do with the fact that I need to add prototypes to modify values for each machine, but the game itself doesn't really treat each tier of machine as a different prototype, just as the same instance that has a quality value that's different.

The hidden prototypes then are replacing the normal version of the mining drill you upgrade at runtime. The upgrade planner itself is very foggy to me, and I can imagine that could be fixed with enough care on my part. Not really planning on it though.

A suggestion I saw that could work is adding specific modules, an invisible beacon with a very small range, and operate that way, but that feels a bit more dirty to me, and not my area of expertise. The mod does work fine in my opinion, and I mostly need it in the intermediary stages of a run where I have quality and no mass-produced good modules, beacons and vulcanus mining drills for a resource patch.

I would love to hear more if you do see a different implementation in other mods, or see something in the API that I've missed, thank you!

New response