It's possible to dissappear resources from store object using withdraw.
-
By calling Creep.withdraw with nonempty string as an
amount
argument you can empty storage from resource being withdrawn and make it dissappear. Tested in sim.Edit: Steps to reproduce
- Have a storage with energy in it
- Have a creep with carry part next to the storage
- Call
creep.withdraw(creep.room.storage, RESOURCE_ENERGY, 'qwerty');
Energy should no longer be inside of storage, nor inside of creep carry parts.
-
And what must i do?
-
Seems like it might be any withdraw-able object.
Looks like a
NaN
from https://github.com/screeps/engine/blob/master/src/processor/intents/creeps/withdraw.js#L13 .Causing both creep store and target store of that resource to also be
NaN
. https://github.com/screeps/engine/blob/master/src/processor/intents/creeps/withdraw.js#L47 https://github.com/screeps/engine/blob/master/src/processor/intents/creeps/withdraw.js#L50
-
Thus, the great NaN wars started, inflicting untold devastation.
-
It should be already fixed in the upcoming update (currently on PTR), but we'll double-check this case, thank you for the report.
-
I don't think it's fixed in the PTR. https://github.com/screeps/engine/blob/87b0ab5d332496b65c3626f81f0cfa0435adf7c0/src/processor/intents/creeps/withdraw.js#L15
This would have to be
!(number >= 0)
instead ofnumber < 0
because NaNs suck.
Or_.isFinite
would should catch any other esoteric edge cases.
-
This issue is scheduled as a low-priority bug because this issue affects simulation only and can't be used on the official or any private server.