mirror of
https://github.com/paradizelost/screeps.git
synced 2024-11-25 02:14:44 -06:00
36 lines
1.5 KiB
JavaScript
36 lines
1.5 KiB
JavaScript
let buildparts = {
|
|
tick: function(roomname,role) {
|
|
console.log(roomname + ":" + role)
|
|
let energyready = Game.rooms[roomname].energyAvailable
|
|
let energymax = Game.rooms[roomname].energyCapacityAvailable
|
|
if(energyready==energymax){
|
|
let tobuild=[]
|
|
switch(role){
|
|
case 'builder':
|
|
let myspawns=Game.rooms[roomname].find(FIND_MY_SPAWNS)
|
|
for(let spawn of myspawns){
|
|
for(let totry of [
|
|
[MOVE,MOVE,MOVE,MOVE,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,CARRY,CARRY,CARRY,WORK],
|
|
[MOVE,MOVE,MOVE,MOVE,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,CARRY,CARRY,CARRY,MOVE],
|
|
[MOVE,MOVE,CARRY]
|
|
]){
|
|
let ispossible = spawn.canCreateCreep(totry)
|
|
if(ispossible==OK){
|
|
tobuild=totry
|
|
break;
|
|
}
|
|
}
|
|
console.log(tobuild)
|
|
}
|
|
break;
|
|
case 'hauler':
|
|
console.log('2')
|
|
break
|
|
default:
|
|
console.log('3')
|
|
}
|
|
}
|
|
|
|
}
|
|
};
|
|
module.exports = buildparts; |