Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports.loop = function () {
- if(Game.shard.name === 'shard2'){
- console.log('Before my script starts')
- console.log(JSON.stringify(Memory.remoteRooms['E16S37']))
- }
- ConfigCreeps.setConfig()
- Object.values(Memory.ownedRooms).forEach(room => ControllerRooms.manage(room))
- if(Game.time % 11 === 0){
- if(Memory.creeps && Object.values(Memory.creeps).length !== Object.values(Game.creeps).length){
- ConfigCreeps.removeDeadCreeps()
- ConfigRooms.removeDeadCreeps()
- }
- }
- if(Game.time % 1 === 0 ){
- ConfigRooms.init()
- }
- Object.values(Game.creeps).filter(creep => !creep.spawning).map((creep)=>{
- let controller = ConfigCreeps.getControllerByRole(creep.memory.role)
- if(controller){
- let start = Game.cpu.getUsed()
- controller.work(creep)
- let used = Game.cpu.getUsed() - start
- //new RoomVisual(creep.pos.roomName).text(used.toFixed(3),creep.pos.x,creep.pos.y+1,{color: 'yellow',stroke:2, font: 1.0})
- }
- })
- if(!Memory.cpu){
- Memory.cpu = {}
- }
- Memory.cpu.total += Game.cpu.getUsed()
- if(Game.time % 1500 === 0){
- Memory.cpu.average = Memory.cpu.total / 1500.00
- Memory.cpu.bigTotal += Memory.cpu.total
- Memory.cpu.total = 0
- }
- if(Game.time % 15000 === 0){
- Memory.cpu.bigAverage = Memory.cpu.bigTotal / 15000.00
- Memory.cpu.bigTotal = 0
- }
- if(Game.shard.name === 'shard2'){
- console.log('The very end of my script')
- console.log(JSON.stringify(Memory.remoteRooms['E16S37']))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement