Returns OK if the factory can produce a robot of this type. InappropriateUnitType - the unit is not a factory or the unit type is not a robot. StructureNotYetBuilt - the structure has not yet been built. FactoryBusy - the factory is already producing a unit.
(&self, unit_type: UnitType)
| 1058 | /// * StructureNotYetBuilt - the structure has not yet been built. |
| 1059 | /// * FactoryBusy - the factory is already producing a unit. |
| 1060 | pub(crate) fn ok_if_can_produce_robot(&self, unit_type: UnitType) -> Result<(), GameError> { |
| 1061 | self.ok_if_unit_type(Factory)?; |
| 1062 | self.ok_if_structure_built()?; |
| 1063 | if !unit_type.is_robot() { |
| 1064 | Err(GameError::InappropriateUnitType)?; |
| 1065 | } |
| 1066 | if self.factory_unit_type.is_some() { |
| 1067 | Err(GameError::FactoryBusy)?; |
| 1068 | } |
| 1069 | Ok(()) |
| 1070 | } |
| 1071 | |
| 1072 | /// Starts producing a robot of this type. |
| 1073 | /// Assumes the unit can produce a robot. |
nothing calls this directly
no test coverage detected