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;