Guest User

Untitled

a guest
May 31st, 2018
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports.loop = function () {
  2. if(Game.shard.name === 'shard2'){
  3. console.log('Before my script starts')
  4. console.log(JSON.stringify(Memory.remoteRooms['E16S37']))
  5. }
  6. ConfigCreeps.setConfig()
  7.  
  8. Object.values(Memory.ownedRooms).forEach(room => ControllerRooms.manage(room))
  9. if(Game.time % 11 === 0){
  10. if(Memory.creeps && Object.values(Memory.creeps).length !== Object.values(Game.creeps).length){
  11. ConfigCreeps.removeDeadCreeps()
  12. ConfigRooms.removeDeadCreeps()
  13. }
  14. }
  15. if(Game.time % 1 === 0 ){
  16. ConfigRooms.init()
  17. }
  18.  
  19. Object.values(Game.creeps).filter(creep => !creep.spawning).map((creep)=>{
  20. let controller = ConfigCreeps.getControllerByRole(creep.memory.role)
  21. if(controller){
  22. let start = Game.cpu.getUsed()
  23. controller.work(creep)
  24. let used = Game.cpu.getUsed() - start
  25.  
  26. //new RoomVisual(creep.pos.roomName).text(used.toFixed(3),creep.pos.x,creep.pos.y+1,{color: 'yellow',stroke:2, font: 1.0})
  27. }
  28. })
  29. if(!Memory.cpu){
  30. Memory.cpu = {}
  31. }
  32. Memory.cpu.total += Game.cpu.getUsed()
  33. if(Game.time % 1500 === 0){
  34. Memory.cpu.average = Memory.cpu.total / 1500.00
  35. Memory.cpu.bigTotal += Memory.cpu.total
  36. Memory.cpu.total = 0
  37. }
  38. if(Game.time % 15000 === 0){
  39. Memory.cpu.bigAverage = Memory.cpu.bigTotal / 15000.00
  40. Memory.cpu.bigTotal = 0
  41. }
  42. if(Game.shard.name === 'shard2'){
  43. console.log('The very end of my script')
  44. console.log(JSON.stringify(Memory.remoteRooms['E16S37']))
  45. }
  46. }
RAW Paste Data