StructureNuker is not a valid creep.withdraw() target.
-
The API documentation states that creep.withdraw() will: "Withdraw resources from a structure. "
But using .withdraw() on a STRUCTURE_NUKER results in an "invalid target" (-7) error.
I'd planned to use the 300k Energy in a nuker to rebuild a room that had its storage+terminal nuked. The undocumented invalidity of withdrawing from a Nuker left that room in pitiful shape until I could write more code.
So I'm requesting the API docs be updated to prevent this niche and unfortunate fate befalling others.
-
The documentation update could be achieved with two sentences in italics below:
http://docs.screeps.com/api/#Creep.withdraw
Withdraw resources from a structure. The target has to be at adjacent square to the creep. Multiple creeps can withdraw from the same structure in the same tick. Your creeps can withdraw resources from hostile structures as well, in case if there is no hostile rampart on top of it. StructureNukers are an exception and cannot be withdrawn from.
http://docs.screeps.com/api/#StructureNuker
Launches a nuke to another room dealing huge damage to the landing area. Each launch has a cooldown and requires energy and ghodium resources. Launching creates a Nuke object at the target room position which is visible to any player until it is landed. Incoming nuke cannot be moved or cancelled. Nukes cannot be launched from or to novice rooms. Energy placed into a StructureNuker cannot be withdrawn.
-
Hi kirk,
This is by design. A filled nuke is considered spent energy. You can see it as a converted missile.
We will edit the documentation accordingly.
-
PR is open: https://github.com/screeps/docs/pull/56
I would not place this inside the withdraw method as the list could grow/shrink with new structures .
-
On thing you currently can do if you don't plan to use the nuker any more: Destroying it will cause all stored energy and Ghodium to drop to the floor, so you can try and pick up as much of it as you can.