2020-10-20 17:09:06 +08:00
|
|
|
|
const init = require('init')
|
2020-10-18 22:00:22 +08:00
|
|
|
|
const util = require('utils');
|
2020-10-23 20:55:20 +08:00
|
|
|
|
const mount = require('mount')
|
2020-10-18 22:00:22 +08:00
|
|
|
|
module.exports.loop = function () {
|
2020-10-24 21:43:36 +08:00
|
|
|
|
extra()
|
2020-10-18 22:00:22 +08:00
|
|
|
|
init.init();
|
2020-10-23 20:55:20 +08:00
|
|
|
|
mount.mount()
|
2020-10-23 22:28:40 +08:00
|
|
|
|
cleanCreeps()
|
2020-10-24 15:24:24 +08:00
|
|
|
|
cleanInvalidMemoryCreep()
|
2020-10-23 22:28:40 +08:00
|
|
|
|
cleanTargetMemory()
|
2020-10-24 15:24:24 +08:00
|
|
|
|
assign_harvester_to_enery_source();
|
2020-10-24 21:43:36 +08:00
|
|
|
|
assign_transfer_to_harvester()
|
2020-10-23 20:55:20 +08:00
|
|
|
|
assign_builder_to_controller();
|
2020-10-24 15:24:24 +08:00
|
|
|
|
assign_transfer_to_builder();
|
2020-10-26 12:58:15 +08:00
|
|
|
|
let construction_site_array = Game.spawns['Spawn1'].room.find(FIND_MY_CONSTRUCTION_SITES)
|
|
|
|
|
|
_.each(construction_site_array, function (found_construction_site) {
|
|
|
|
|
|
let constuction_key = `CONSTRUCTION_${found_construction_site.id}`
|
|
|
|
|
|
if (Memory.WorkingTarget[constuction_key] && Memory.WorkingTarget[constuction_key].working_creep_names.length == 0) {
|
|
|
|
|
|
assign_builder_to_construction(found_construction_site.id)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
2020-10-23 20:55:20 +08:00
|
|
|
|
let isSpawning = false
|
|
|
|
|
|
let energy_source_number = _.filter(Game.spawns['Spawn1'].room.find(FIND_SOURCES_ACTIVE)).length;
|
|
|
|
|
|
let harvester_number = _(Game.creeps).filter({ memory: { role: 'harvester' } }).size();
|
|
|
|
|
|
if (!Game.spawns['Spawn1'].spawning) {
|
2020-10-24 15:24:24 +08:00
|
|
|
|
if (harvester_number < energy_source_number) {
|
2020-10-23 20:55:20 +08:00
|
|
|
|
isSpawning = true
|
|
|
|
|
|
createHarvestCreep();
|
|
|
|
|
|
}
|
2020-10-24 15:24:24 +08:00
|
|
|
|
if (_(Game.creeps).filter({ memory: { role: 'transfer' } }).size() < energy_source_number && !isSpawning) {
|
|
|
|
|
|
isSpawning = true
|
2020-10-23 20:55:20 +08:00
|
|
|
|
createTransferCreep();
|
|
|
|
|
|
}
|
|
|
|
|
|
let builder_number = _.filter(Game.creeps, { memory: { role: 'builder' } }).length
|
|
|
|
|
|
//创造一个builder升级room controller
|
2020-10-26 12:58:15 +08:00
|
|
|
|
if (Game.spawns['Spawn1'].room.controller && builder_number < (1 + construction_site_array.length) && !isSpawning) {
|
2020-10-24 15:24:24 +08:00
|
|
|
|
isSpawning = true
|
2020-10-23 20:55:20 +08:00
|
|
|
|
createBuilderCreep();
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断是否需要再增加1个transfer
|
|
|
|
|
|
let transfer_number = _.filter(Game.creeps, { memory: { role: 'transfer' } }).length
|
2020-10-24 15:24:24 +08:00
|
|
|
|
if ((builder_number + harvester_number) > transfer_number && !isSpawning) {
|
|
|
|
|
|
isSpawning = true
|
2020-10-18 22:00:22 +08:00
|
|
|
|
createTransferCreep();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
assign_task();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-23 20:55:20 +08:00
|
|
|
|
|
2020-10-26 12:58:15 +08:00
|
|
|
|
function extra() {
|
|
|
|
|
|
// Game.map.visual.circle(Game.getObjectById('5bbcaaeb9099fc012e6326f1').pos)
|
|
|
|
|
|
// console.log(Game.getObjectById('5f953aa1ad1f54190745a9c3').pos)
|
|
|
|
|
|
// Memory.WorkingTarget.CONSTRUCTION_5f952fea10782b5f4ec3690a.working_creep_names=[]
|
2020-10-24 21:43:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-23 20:55:20 +08:00
|
|
|
|
function cleanCreeps() {
|
|
|
|
|
|
for (let i in Memory.creeps) {
|
|
|
|
|
|
if (!Game.creeps[i]) {
|
2020-10-24 15:24:24 +08:00
|
|
|
|
console.log(`${i} is invalid, removed from Memory.creeps`)
|
2020-10-23 20:55:20 +08:00
|
|
|
|
delete Memory.creeps[i];
|
|
|
|
|
|
}
|
2020-10-18 22:00:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-26 12:58:15 +08:00
|
|
|
|
function cleanInvalidMemoryCreep() {
|
|
|
|
|
|
//清理Memory中已经不存在的creep
|
|
|
|
|
|
_.each(Memory.WorkingTarget, function (target) {
|
|
|
|
|
|
_.remove(target.working_creep_names, function (creep_name) {
|
|
|
|
|
|
if (!Game.creeps[creep_name]) {
|
|
|
|
|
|
console.log(`${creep_name} is invalid, removed from working_creep_names`)
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-24 15:24:24 +08:00
|
|
|
|
function cleanTargetMemory() {
|
|
|
|
|
|
for (let i of Object.keys(Memory.WorkingTarget)) {
|
|
|
|
|
|
let target = Memory.WorkingTarget[i]
|
|
|
|
|
|
if (!Game.getObjectById(target.id)) {
|
2020-10-26 12:58:15 +08:00
|
|
|
|
console.log(`target ${target.id} is invalid, removed from Memory.WorkingTarget.Set their creep to idle`)
|
|
|
|
|
|
_.each(Memory.WorkingTarget[i].working_creep_names, creep_name => creep_name.working_target_id = undefined)
|
2020-10-24 15:24:24 +08:00
|
|
|
|
delete Memory.WorkingTarget[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-10-23 22:28:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-23 20:55:20 +08:00
|
|
|
|
|
2020-10-26 12:58:15 +08:00
|
|
|
|
function assign_transfer(target_memory) {
|
|
|
|
|
|
const NO_IDLE_TRANSFER = -1
|
|
|
|
|
|
const OK_TRANSFER = 0
|
|
|
|
|
|
if (target_memory.length > 0) {
|
|
|
|
|
|
let idle_transfer = _.filter(Game.creeps, creep => !creep.working_target_id && (creep.memory.role == 'transfer'))
|
|
|
|
|
|
if (idle_transfer.length > 0) {//一次只安排一个creep
|
|
|
|
|
|
let opt = {
|
|
|
|
|
|
memory: target_memory,
|
|
|
|
|
|
creep_name_to_assign_array: [idle_transfer[0].name]
|
|
|
|
|
|
}
|
|
|
|
|
|
assign_creeps(opt)
|
|
|
|
|
|
return OK_TRANSFER
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return NO_IDLE_TRANSFER
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//TODO:应该和assign_transfer_to_builder合并
|
2020-10-24 21:43:36 +08:00
|
|
|
|
function assign_transfer_to_harvester() {
|
2020-10-23 20:55:20 +08:00
|
|
|
|
//判断有多少个picker的transfer为0
|
2020-10-24 21:43:36 +08:00
|
|
|
|
let harvester_without_creep = _.filter(Game.creeps, function (creep) {
|
2020-10-26 12:58:15 +08:00
|
|
|
|
return !Memory.WorkingTarget[creep.name] && creep.memory.role == 'harvester'//Memory.WorkingTarget中没有这个harvester目标
|
2020-10-23 20:55:20 +08:00
|
|
|
|
})
|
2020-10-24 21:43:36 +08:00
|
|
|
|
_.each(harvester_without_creep, function (harvester_creep) {
|
|
|
|
|
|
Memory.WorkingTarget[harvester_creep.name] = { id: harvester_creep.id, working_creep_names: [], cate: 'harvester' }//在Memory.WorkingTarget加入需要creep的Picker
|
2020-10-23 20:55:20 +08:00
|
|
|
|
})
|
2020-10-26 12:58:15 +08:00
|
|
|
|
let harvester_needs_creep_memory = _.filter(Memory.WorkingTarget, memory => memory.working_creep_names.length == 0 && memory.cate == 'harvester')//需要安排creep的harvester
|
|
|
|
|
|
assign_transfer(harvester_needs_creep_memory)
|
2020-10-23 20:55:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-18 22:00:22 +08:00
|
|
|
|
function assign_task() {
|
|
|
|
|
|
for (const creep_id in Game.creeps) {
|
|
|
|
|
|
let creep = Game.creeps[creep_id];
|
|
|
|
|
|
creep.action();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-20 17:09:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-26 12:58:15 +08:00
|
|
|
|
|
2020-10-23 22:19:47 +08:00
|
|
|
|
function assign_transfer_to_builder() {
|
2020-10-26 12:58:15 +08:00
|
|
|
|
//判断有多少个builder的transfer为0
|
2020-10-24 21:43:36 +08:00
|
|
|
|
let builder_without_creep = _.filter(Game.creeps, function (creep) {
|
2020-10-26 12:58:15 +08:00
|
|
|
|
return !Memory.WorkingTarget[creep.name] && creep.memory.role == 'builder'//Memory.WorkingTarget中没有这个builder目标
|
2020-10-23 22:19:47 +08:00
|
|
|
|
})
|
2020-10-24 21:43:36 +08:00
|
|
|
|
_.each(builder_without_creep, function (builder) {
|
2020-10-24 15:24:24 +08:00
|
|
|
|
Memory.WorkingTarget[builder.name] = { id: builder.id, working_creep_names: [], cate: 'builder' }//在Memory.WorkingTarget加入需要creep的builder
|
2020-10-23 22:19:47 +08:00
|
|
|
|
})
|
2020-10-26 12:58:15 +08:00
|
|
|
|
let builder_needs_creep_memory = _.filter(Memory.WorkingTarget, memory => memory.working_creep_names.length == 0 && memory.cate == 'builder')//需要安排creep的builder
|
|
|
|
|
|
if (assign_transfer(builder_needs_creep_memory) == -1) {
|
|
|
|
|
|
console.log(`no enough transfer to builder. Try to create a new one autmatically`)
|
|
|
|
|
|
createBuilderCreep()
|
2020-10-20 17:09:06 +08:00
|
|
|
|
}
|
2020-10-23 20:55:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-26 12:58:15 +08:00
|
|
|
|
function assign_builder_to_construction(construction_id) {
|
|
|
|
|
|
//检查construction是否已经是target
|
|
|
|
|
|
let constuction_key = `CONSTRUCTION_${construction_id}`
|
|
|
|
|
|
if (!_.find(Memory.WorkingTarget, target => target.id == construction_id)) {
|
|
|
|
|
|
Memory.WorkingTarget[constuction_key] = { id: construction_id, working_creep_names: [], cate: 'constuction_site' }
|
|
|
|
|
|
}
|
|
|
|
|
|
//安排一个builder过去
|
|
|
|
|
|
let builder = _.filter(Game.creeps, creep => creep.memory.role == 'builder' && !creep.working_target_id)
|
|
|
|
|
|
if (builder.length > 0) {
|
2020-10-24 15:24:24 +08:00
|
|
|
|
|
2020-10-26 12:58:15 +08:00
|
|
|
|
let opt = {
|
|
|
|
|
|
memory: _.filter(Memory.WorkingTarget, _memory => _memory.working_creep_names.length == 0 && _memory.cate == 'constuction_site'),
|
|
|
|
|
|
creep_name_to_assgin_array: [builder[0].name]
|
|
|
|
|
|
}
|
|
|
|
|
|
assign_creeps(opt)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.log(`no enough builder to constuction_site ${construction_id}. Try to create a new one autmatically`)
|
|
|
|
|
|
createBuilderCreep()
|
|
|
|
|
|
}
|
|
|
|
|
|
// //开始给建造constrction的每个creep安排transfer
|
|
|
|
|
|
// _.each(Memory.WorkingTarget[constuction_key].working_creep_names,function(builder_creep_name){
|
|
|
|
|
|
// if(!Memory.WorkingTarget[builder_creep_name]){
|
|
|
|
|
|
// Memory.WorkingTarget[builder_creep_name]={id:Game.creeps[builder_creep_name].id,working_creep_names: [], cate: 'builder'}
|
|
|
|
|
|
// }
|
|
|
|
|
|
// })
|
2020-10-23 20:55:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-26 12:58:15 +08:00
|
|
|
|
|
2020-10-23 20:55:20 +08:00
|
|
|
|
function assign_creeps(opt) {
|
|
|
|
|
|
let memory = opt.memory
|
2020-10-26 12:58:15 +08:00
|
|
|
|
let creep_name_to_assign_array = opt.creep_name_to_assign_array//需要分配工作的creeps
|
|
|
|
|
|
_.each(creep_name_to_assign_array, function (creep_name) {
|
2020-10-23 20:55:20 +08:00
|
|
|
|
//先计算每一个target目前有多少个creeps了
|
2020-10-24 15:24:24 +08:00
|
|
|
|
let working_creeps_of_target_array = []//记录每个target已有的creep数量
|
2020-10-23 20:55:20 +08:00
|
|
|
|
_.each(memory, m => working_creeps_of_target_array.push(m.working_creep_names.length))
|
|
|
|
|
|
let target_to_add_creep = _.filter(memory, m => m.working_creep_names.length == _.min(working_creeps_of_target_array))//选择目前已有creep最少的,对其添加creep
|
2020-10-26 12:58:15 +08:00
|
|
|
|
console.log(target_to_add_creep.length)
|
2020-10-23 20:55:20 +08:00
|
|
|
|
if (target_to_add_creep.length > 0) {
|
|
|
|
|
|
target_to_add_creep[0].working_creep_names.push(creep_name)//target记录自己安排的creep
|
|
|
|
|
|
Game.creeps[creep_name].working_target_id = target_to_add_creep[0].id//将target安排给creep
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-24 15:24:24 +08:00
|
|
|
|
function assign_harvester_to_enery_source() {
|
2020-10-23 20:55:20 +08:00
|
|
|
|
let sources = Game.spawns['Spawn1'].room.find(FIND_SOURCES_ACTIVE);
|
|
|
|
|
|
let all_memory = Memory.WorkingTarget
|
2020-10-20 17:09:06 +08:00
|
|
|
|
for (let source of sources) {
|
|
|
|
|
|
let id = source.id
|
2020-10-26 12:58:15 +08:00
|
|
|
|
if (!_.find(all_memory, f => f['id'] == id)) {
|
2020-10-24 15:24:24 +08:00
|
|
|
|
all_memory[`Energy_${id}`] = { 'id': id, 'working_creep_names': [], "cate": 'ENERGY_SOURCE' };
|
2020-10-20 17:09:06 +08:00
|
|
|
|
}
|
2020-10-23 20:55:20 +08:00
|
|
|
|
}//向Memory.WorkingTarget里添加所有的Energy Source
|
|
|
|
|
|
//寻找Energy Source的Memory
|
|
|
|
|
|
let energy_memory = _.filter(all_memory, { cate: 'ENERGY_SOURCE' })
|
|
|
|
|
|
//寻找creep为0的energy source
|
|
|
|
|
|
let energy_source_need_creep_array = _.filter(energy_memory, m => m.working_creep_names.length == 0)
|
|
|
|
|
|
if (energy_source_need_creep_array.length > 0) {
|
|
|
|
|
|
//找到一个空闲的creep
|
2020-10-24 15:24:24 +08:00
|
|
|
|
let available_creep_array = _.filter(Game.creeps, creep => !creep.working_target_id && creep.memory.role == 'harvester')
|
2020-10-23 20:55:20 +08:00
|
|
|
|
if (available_creep_array.length > 0) {//每次只安排一个
|
|
|
|
|
|
let opt = {
|
|
|
|
|
|
memory: energy_memory,
|
2020-10-26 12:58:15 +08:00
|
|
|
|
creep_name_to_assign_array: [available_creep_array[0].name]
|
2020-10-20 17:09:06 +08:00
|
|
|
|
}
|
2020-10-23 20:55:20 +08:00
|
|
|
|
assign_creeps(opt)
|
2020-10-20 17:09:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-23 20:55:20 +08:00
|
|
|
|
}
|
2020-10-20 17:09:06 +08:00
|
|
|
|
|
2020-10-23 20:55:20 +08:00
|
|
|
|
function assign_builder_to_controller() {
|
2020-10-26 12:58:15 +08:00
|
|
|
|
//如果存在正在建造的construction,且没有多余的builder,就暂停upgrade controller
|
|
|
|
|
|
if (Game.spawns['Spawn1'].room.find(FIND_MY_CONSTRUCTION_SITES).length > 0) {
|
|
|
|
|
|
let working_builder = _.filter(Game.creeps, creep => creep.memory.role == 'builder' && !creep.working_target_id)
|
|
|
|
|
|
if (working_builder.length == 0) {//没有可以用的builder了
|
|
|
|
|
|
let controller_id = Game.spawns['Spawn1'].room.controller.id
|
|
|
|
|
|
let controller_memory = Memory.WorkingTarget[`RoomController_${controller_id}`]
|
|
|
|
|
|
if (controller_memory) {
|
|
|
|
|
|
_.each(controller_memory.working_creep_names, creep_name => Game.creeps[creep_name].working_target_id = 0)
|
|
|
|
|
|
memory.working_creep_names = []
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-10-23 20:55:20 +08:00
|
|
|
|
//判断room controller 是否有creep,没有则添加
|
|
|
|
|
|
if (!_.find(Memory.WorkingTarget, target => target.id == Game.spawns['Spawn1'].room.controller.id)) {
|
2020-10-24 15:24:24 +08:00
|
|
|
|
Memory.WorkingTarget[`RoomController_${Game.spawns['Spawn1'].room.controller.id}`] = { id: Game.spawns['Spawn1'].room.controller.id, working_creep_names: [], cate: 'ROOM_CONTROLLER' }
|
2020-10-23 20:55:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
let room_controller_mem = _.filter(Memory.WorkingTarget, { cate: 'ROOM_CONTROLLER' })
|
|
|
|
|
|
//寻找creep为0的room controller
|
2020-10-26 12:58:15 +08:00
|
|
|
|
let room_controller_need_creep_array = _.filter(room_controller_mem, m => m.working_creep_names.length == 0 && m.cate == 'ROOM_CONTROLLER')
|
2020-10-23 20:55:20 +08:00
|
|
|
|
if (room_controller_need_creep_array.length > 0) {
|
2020-10-26 12:58:15 +08:00
|
|
|
|
let builder_creep = _.filter(Game.creeps, creep => !creep.working_target_id && creep.memory.role == 'builder')
|
2020-10-23 20:55:20 +08:00
|
|
|
|
if (builder_creep.length > 0) {
|
|
|
|
|
|
let opt = {
|
|
|
|
|
|
memory: room_controller_mem,
|
2020-10-26 12:58:15 +08:00
|
|
|
|
creep_name_to_assign_array: [builder_creep[0].name]
|
2020-10-23 20:55:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
assign_creeps(opt)
|
2020-10-26 12:58:15 +08:00
|
|
|
|
}
|
2020-10-23 20:55:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-10-20 17:09:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
2020-10-18 22:00:22 +08:00
|
|
|
|
|
2020-10-24 15:24:24 +08:00
|
|
|
|
|
2020-10-18 22:00:22 +08:00
|
|
|
|
|
|
|
|
|
|
function createHarvestCreep() {
|
|
|
|
|
|
//create new creep
|
|
|
|
|
|
let new_creep_name = "AUTO_CREATE_Harvester_" + util.uuid();
|
|
|
|
|
|
let Re_code;
|
|
|
|
|
|
Re_code = Game.spawns['Spawn1'].createCreep([MOVE, CARRY, WORK], new_creep_name)
|
|
|
|
|
|
if (Re_code == new_creep_name) {
|
|
|
|
|
|
Game.creeps[new_creep_name].memory.role = 'harvester';
|
2020-10-24 15:24:24 +08:00
|
|
|
|
console.log('Create new creep ' + new_creep_name);
|
2020-10-18 22:00:22 +08:00
|
|
|
|
} else {
|
2020-10-23 20:55:20 +08:00
|
|
|
|
// console.log(`failed to create harvester with code ${Re_code}`);
|
2020-10-18 22:00:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function createTransferCreep() {
|
|
|
|
|
|
//create new creep
|
|
|
|
|
|
let new_creep_name = "AUTO_CREATE_Transfer_" + util.uuid();
|
|
|
|
|
|
let Re_code;
|
|
|
|
|
|
Re_code = Game.spawns['Spawn1'].createCreep([MOVE, CARRY, CARRY], new_creep_name);
|
|
|
|
|
|
if (new_creep_name == Re_code) {
|
|
|
|
|
|
Game.creeps[new_creep_name].memory.role = 'transfer';
|
2020-10-24 15:24:24 +08:00
|
|
|
|
console.log('Create new creep ' + new_creep_name);
|
2020-10-18 22:00:22 +08:00
|
|
|
|
} else {
|
2020-10-23 20:55:20 +08:00
|
|
|
|
// console.log(`failed to create transfer with code ${Re_code}`);
|
2020-10-18 22:00:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-10-23 20:55:20 +08:00
|
|
|
|
|
|
|
|
|
|
function createBuilderCreep() {
|
|
|
|
|
|
//create new creep
|
|
|
|
|
|
let new_creep_name = "AUTO_CREATE_Builder_" + util.uuid();
|
|
|
|
|
|
let Re_code;
|
2020-10-23 22:19:47 +08:00
|
|
|
|
Re_code = Game.spawns['Spawn1'].createCreep([MOVE, CARRY, WORK], new_creep_name)
|
2020-10-23 20:55:20 +08:00
|
|
|
|
if (Re_code == new_creep_name) {
|
|
|
|
|
|
Game.creeps[new_creep_name].memory.role = 'builder';
|
2020-10-24 15:24:24 +08:00
|
|
|
|
console.log('Create new creep ' + new_creep_name);
|
2020-10-23 20:55:20 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
// console.log(`failed to create builder with code ${Re_code}`);
|
|
|
|
|
|
}
|
2020-10-26 12:58:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|