Mirroar / hivemind

Fully automated open source AI core for the game screeps. Also usable as an opponent on private servers.
MIT License
29 stars 10 forks source link

Too many mineral harvesters being spawned. #62

Closed FutureAstroMiner closed 2 years ago

FutureAstroMiner commented 2 years ago

Mineral harvesters were being spawned with "harvester" as the role but the filter on the spawn role was looking for "harvester.mineral".

This fixes the filter on the spawn role to look for the correct role by using the prototype on the mineral.

Mirroar commented 2 years ago

Interesting. I like skipping the find-check for the extractor when there are no minerals.

Also, I would have just changed the return value of getCreepMemory() to use the role harvester.minerals as before, but this way is actually even better and allows us to get rid of that pseudo-role. So thanks for the PR.

The code style isn't quite perfect, but I'll merge this anyway since I'm in the process of cleaning up the codebase anyway, so I can fix it later.