How to Check if Spots to a Resource are Full
ILIKEPIE2906 last edited by
I am new to the game, and I want to find a way to tell my creeps to go to a different energy deposit when the spaces to one are all filled up. Is there a method or a way to do this automatically, or will I have to use flags or something to control them?
KyberPrizrak last edited by
You need to create a list of sources in Memory and add a free spot counter there. Usually the source ID is stored in creep.memory and creeps only harvest resources from it.
Perhaps it will also help you:
const target = creep.pos.findClosestByRange(FIND_SOURCES_ACTIVE); const count = source.pos.findInRange(FIND_CREEPS, 1).length;