The-International-Open-Source icon indicating copy to clipboard operation
The-International-Open-Source copied to clipboard

commune abandonment

Open CarsonBurke opened this issue 2 years ago • 3 comments

  • If there is a terminal, try to send away the most valuable resources until we are basically out of energy. Then unclaim
  • Otherwise if there is a storage, make a haulRequest to take from the room. If no responders take on the request the next tick, unclaim
  • If there are no storing structures then unclaim immediately

CarsonBurke avatar Feb 14 '23 05:02 CarsonBurke

@CarsonBurke there is an issue with the current commune abandonment implementation I found out by using the abandon flag on a few bad rooms of mine. You have to delete the room from the Memory, otherwise, it runs into an error the next tick due to all of the managers accessing it because of looping through Memory.rooms.

I told Panda the fix already in this thread: https://discord.com/channels/978303052933115925/1075753172708118548

But here it is again. Instead of this:

if (room.memory.Ab) {
  room.controller.unclaim()
  return
}

also do this:

if (room.memory.Ab) {
  room.controller.unclaim()
  if (Memory.rooms[room.name]) {
    delete Memory.rooms[room.name]
  }
  return
}

File to edit for this fix: https://github.com/The-International-Screeps-Bot/The-International-Open-Source/blob/Development/src/room/commune/commune.ts#L131

Also when you abandon a room like that. You should remove its construction sites because they get stored in the memory. Found this, but it doesn't cover this case. https://github.com/The-International-Screeps-Bot/The-International-Open-Source/blob/Development/src/international/constructionSiteManager.ts#L7

DefaultO avatar Feb 16 '23 12:02 DefaultO

The above solution doesn't seem to be enough. Map visuals show the abandoned rooms like they are still used.

DefaultO avatar Feb 16 '23 13:02 DefaultO

Latest commit should fix, please confirm is possible

CarsonBurke avatar Feb 16 '23 19:02 CarsonBurke