- Introduced
Creep.withdraw
method. It replaces all structures’transfer
methods which are now considered deprecated. - Executing
StructureSpawn.createCreep
now inserts a new dummyCreep
object intoGame.creeps
hash immediately. Theid
property of such object is undefined until the next tick. - Executing
Room.createFlag
now inserts a newFlag
object intoGame.flags
hash immediately.
Changelog 2016-07-11
Have more questions? Submit a request
With the 'transfer' methods, it was possible in the same tick for, say, refill the creep's carry AND do something else like move or upgradeController.
I guess with the withdraw method this will not be possible anymore?
Given that they'd have to make a special exception in the loop to allow two actions to be performed by the creep now, no, you wouldn't be able to do it in the same tick anymore.
Were structures limited to one action per tick? Because this would now open up the ability to have two creep withdraw from the same structure at once if they couldn't before.
Yes, containers could previously only make one action per tick, which got annoying if you had units doing upgrades or builds within reach of the stockpile. I'm also looking forward to this change as a nice CPU saver too (no longer having to scan my whole array of n creeps for y containers).
It looks like you can use withdraw and upgradeController at the same time, here it is in action: https://gfycat.com/CourageousNervousGuillemot
As you can see, the quantity of the link is going down but all three creeps never miss a tick with upgradeController.
@CAFontana there are actually a lot of other examples of simultaneous actions, certain ones are allowed and certain aren't. Take a look at this article for more info: http://support.screeps.com/hc/en-us/articles/203137792-Simultaneous-execution-of-creep-actions
Would you like your archers to move and rangedAttack and heal themselves in the same tick? they can do that!
Creep.withdraw
can be used with any other method simultaneously, includingCreep.transfer
.Hey Artem,
We were just looking through the code of withdraw, it seems we can withdraw energy and ghodium from the nuker. I thought the nuker was input only:
http://support.screeps.com/hc/en-us/community/posts/206757749-Missing-method-transfer-on-StructureNuker
Will using .withdraw make the resource available immediately?
As in Creep has 0 energy
witdraw(storage, RESOURCE_ENERGY)
Creep now has X energy
transfer(terminal, RESOURCE_ENERGY);
Creep now has 0 energy again.
Will this result in a creep picking up and dropping energy in 1 tick?
In the tick when you call `Spawn.createCreep` , the resulting creep object being added has `Creep.carryCapacity` equals to 0, even if the creep has CARRY part .
No, you shouldn’t be able to. If you can, please report.
The command flow is the same as with
transfer
and all other operations. You schedule the command first, and it is processed after the tick ends.Right, thanks for reporting, fixed.
@artem
Code responsible is inside Creep.prototype.withdraw
It's just leftover code. There is a check in the top which doesn't allow passing a nuker as a target. But of course we should remove this for consistency.
If StrutureSpawn.createCreep creates a creep within in that exact tick shouldn't StructureSpawn.spawning also be set to the spawning object as well? Otherwise you end up creating 5 dumby creeps because they have no way of checking if the Spawner already has a creep being spawned...
* Sidenote: Editing a comment is missing CSS to make it so text in the edit field is white instead of black.