Starts producing the robot of the given type. NoSuchUnit - the factory does not exist (inside the vision range). TeamNotAllowed - the factory is not on the current player's team. InappropriateUnitType - the unit is not a factory, or the unit type is not a robot. StructureNotYetBuilt - the factory has not yet been completed. FactoryBusy - the factory is already producing a unit. InsufficientKarbon
(&mut self, factory_id: UnitID, robot_type: UnitType)
| 1874 | /// * InsufficientKarbonite - your team does not have enough Karbonite to |
| 1875 | /// produce the given robot. |
| 1876 | pub fn produce_robot(&mut self, factory_id: UnitID, robot_type: UnitType) |
| 1877 | -> Result<(), GameError> { |
| 1878 | self.ok_if_can_produce_robot(factory_id, robot_type)?; |
| 1879 | self.my_team_mut().karbonite -= robot_type.factory_cost().expect("unit type is ok"); |
| 1880 | let factory = self.my_unit_mut(factory_id).expect("factory exists"); |
| 1881 | factory.produce_robot(robot_type); |
| 1882 | Ok(()) |
| 1883 | } |
| 1884 | |
| 1885 | /// Process the end of the turn for factories. If a factory added a unit |
| 1886 | /// to its garrison, also mark that unit down in the game world. |
no test coverage detected