Inconsistent isActive() checks (re-claimed rooms)
-
Hey, I found a bug. Seems like there's inconsistency in several areas of the code. I believe it has to do with this latest patch:
https://github.com/screeps/engine/commit/91c9bf03a13743d3837b082f26b0a7689021237d
To sum it up - Active structures are determined by range to the controller. But ties aren't broken consistently. Extensions (and other structures probably) in re-claimed rooms are messed up. I'm getting 4 different sets of information.
1. Visual - Some extensions look normal, some are red (duh).
2. Structure.isActive() - One of the red extensions returns TRUE. One of the normal extensions returns FALSE.
3. Room.energyAvailable - The number agrees with what I see visually (not from isActive() )
4. Spawn.createCreep() - This will pull energy from extensions that are visually (#1) marked as active, rather than checking isActive().
What causes the issue?
I think isActive() is based on range to the controller. Ties aren't resolved consistently.
Why is this an issue?
When I'm re-claiming a room, I inherit the extensions. To keep my extension fillers focused, I filter the extensions based in isActive().... So yeah, the room never fills up, and my spawn process gets choked up.
How'd I resolve it?
Well, on my end - I kept deleting extensions until the problematic extensions were on a path frequented often, so they got filled up in passing. Not totally ideal.
Thanks! Hopefully someone better at this than me can take a look!
Dewey
p.s. I started deleting extensions soon after this: https://screeps.com/a/#!/history/W59N46?t=19734400
Currently marked normal, but isActive() == false: 5927f47427ccaf9c36aae085Currently marked red,but isActive() == true: 5925da43966ccf98054823e9