Order of operations issue with stronghold deployment
-
https://screeps.com/a/#!/history/shard2/W11S46?t=19714863
As you can see this stronghold is about to deploy. As it appeared before my code knew about strongholds, it's under attack. There seems to be a problem in the order of operations when it's deployed.
- Tick ...864 it loses invulverability
- Tick ...865 the towers and ramparts spawn.
This leads to two issues:
Issue 1: I damaged the invader core without having to break through ramparts. Issue 2: It's a pain if you spawn creeps just at the right moment as it looks like a core with no defense.
I think the spawning of the new objects needs to be on the same tick as it loses invulverability and ticksToDeploy goes undefined. ie. when ticksToDeploy == 1 the intents should be registered.
-
I think this commit was meant to fix this: https://github.com/screeps/engine/commit/8d73d7a41b9f4a63bbf9d79733ed3a4d3d5cd906
But I think it's wrong. I think it should be
if(core.deployTime && (core.deployTime <= (gameTime+1))) {
Not
if(core.deployTime && (core.deployTime <= (gameTime-1))) {
The change actually made it worse as far as I can tell!
-
@tigga I'll double-check this, thanks