STRUCTURE_STORAGE?
-
I'm trying to set up my links to transfer energy to storage, but the filter with STRUCTURE_STORAGE isn't working? What's the global for a storage structure?
-
The ENUM isn't in the API documentation yet, maybe they forgot to implement it.
For the meanwhile you can probably use "storage" (as a string).
-
Current global object is under Game.rooms.room.storage
-
So I haven't had any luck transferring energy to storage, I can get the links to transfer to one another, but no matter what I do I can't get either the link to transfer to storage (I suspect that this can't be done) or get a creep to transfer energy to storage.
Anyone have a snippet to get me on the right track?
-
This is something I use:
var storage = Game.spawns.playerName.room.storage;
if (creep.pos.isNearTo(storage)) {
creep.transferEnergy(storage);
} else {
creep.moveTo(storage);
}
-
Thank you, I was able to use that and make it work!
-
Awesome, I hope it works well!
-
Actually, energy can only be transferred from creeps to building and vice versa, not from building to building. The spec is a bit vague about that.
-
The
STORAGE_STRUCTURE
constant has been available in the API all the time, but we indeed forgot to add it to the docs. Now it is added, thanks for the reminder.
-
I don't think STORAGE_STRUCTURE or STRUCTURE_STORAGE is in the API, except for the docs. Neither works in game for me.