Unloads a robot from the garrison of the specified structure into an adjacent space. Robots are unloaded in the order they were loaded. NoSuchUnit - the unit does not exist (inside the vision range). TeamNotAllowed - either unit is not on the current player's team. UnitNotOnMap - the structure is not on the map. InappropriateUnitType - the unit is not a structure. StructureNotYetBuilt - the struc
(&mut self, structure_id: UnitID, direction: Direction)
| 1829 | /// occupied. |
| 1830 | /// * Overheated - the robot inside the structure is not ready to move again. |
| 1831 | pub fn unload(&mut self, structure_id: UnitID, direction: Direction) |
| 1832 | -> Result<(), GameError> { |
| 1833 | self.ok_if_can_unload(structure_id, direction)?; |
| 1834 | let (robot_id, structure_loc) = { |
| 1835 | let structure = self.my_unit_mut(structure_id)?; |
| 1836 | (structure.unload_unit(), structure.location().map_location()?) |
| 1837 | }; |
| 1838 | let robot_loc = structure_loc.add(direction); |
| 1839 | self.my_unit_mut(robot_id)?.move_to(robot_loc); |
| 1840 | self.place_unit(robot_id); |
| 1841 | Ok(()) |
| 1842 | } |
| 1843 | |
| 1844 | // ************************************************************************ |
| 1845 | // ************************** FACTORY METHODS ***************************** |
no test coverage detected