Commands the worker to repair a structure, repleneshing health to it. This can only be done to structures which have been fully built. NoSuchUnit - either unit does not exist (within the vision range). TeamNotAllowed - either unit is not on the current player's team. UnitNotOnMap - the worker is not on the map. InappropriateUnitType - the unit is not a worker, or the target is not a structure. Ov
(&mut self, worker_id: UnitID, structure_id: UnitID)
| 1407 | /// * OutOfRange - the worker is not adjacent to the structure. |
| 1408 | /// * StructureNotYetBuilt - the structure has not been completed. |
| 1409 | pub fn repair(&mut self, worker_id: UnitID, structure_id: UnitID) -> Result<(), GameError> { |
| 1410 | self.ok_if_can_repair(worker_id, structure_id)?; |
| 1411 | self.my_unit_mut(worker_id).unwrap().worker_act(); |
| 1412 | |
| 1413 | let repair_health = self.my_unit(worker_id).unwrap().worker_repair_health().unwrap(); |
| 1414 | self.my_unit_mut(structure_id).unwrap().be_healed(repair_health); |
| 1415 | Ok(()) |
| 1416 | } |
| 1417 | |
| 1418 | fn ok_if_can_replicate(&self, worker_id: UnitID, direction: Direction) |
| 1419 | -> Result<(), GameError> { |
no test coverage detected