spawn setup
Opened this issue · 3 comments
Hey thPion,
I has seen the video's on the script, however, could you add a setup for the spawn that sets their memory based on certain variables?
This and building logic would would make it a good step closer to automation...
I'm not playing Screeps anymore, so don't expect any updates from me. Feel free to fork and add your own stuff however.
sure, i'll butcher some code:
var allspawns = _.filter(Game.spawns, s => s.structureType == STRUCTURE_SPAWN);
// check for each spawn the numbers are set
for (let spawns of allspawns) {
if (spawns.memory.booted != true){
//put minCreeps in memory
minCreeps = {};
//define all the roles and amount
let numberOfCreeps = {};
let creepsInRoom = spawns.room.find(FIND_MY_CREEPS);
var evolve = numberOfCreeps['miner'] = _.sum(creepsInRoom, (c) => c.memory.role == 'miner');
spawns.memory.minCreeps = minCreeps;
spawns.memory.minCreeps.upgrader = 0
spawns.memory.minCreeps.builder = 1
spawns.memory.minCreeps.repairer = 1
spawns.memory.minCreeps.wallRepairer = 1
spawns.memory.minCreeps.LongDistanceHarvester = 0
spawns.memory.minCreeps.claimer = 0
spawns.memory.minCreeps.miner = 2
spawns.memory.minCreeps.harvester = 3-evolve
spawns.memory.minCreeps.lorry = 1
spawns.memory.booted = true;
spawns.memory.minLongDistanceHarvesters = {}
spawns.memory.minLongDistanceHarvesters.W7N4 = 1
spawns.memory.minLongDistanceHarvesters.W6N3 = 1
spawns.memory.minLongDistanceHarvesters.W8N3 = 3
spawns.memory.minLongDistanceHarvesters.W8N5 = 1
//spawns.memory.minLongDistanceHarvesters.W5N3 = 1
}
}
also, i noticed LongDistanceHarvesters to change energy sources at random intervals
Well for any remote roles it depends on if you want them returning to their home room or not so maybe something with an array of homeRoom, targetRoom, roleNameAmount if you want them to come back OR targetRoom, roleNameAmount if you don't want them back. As for Claimer it'd be an array of targetRooms that would clear each claimed room. Also in any of these cases you might want to clear the memory of specific ones when you can't send into or lose access to a target room. That said the Long distance or remote ones should likely be room level memory as oppose to spawn level unless there's some reason to have them that way.