| 125 | } |
| 126 | |
| 127 | command_result do_command(color_ostream &out, vector<string> & parameters) { |
| 128 | if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) { |
| 129 | out.printerr("Cannot run {} without a loaded fort.\n", plugin_name); |
| 130 | return CR_FAILURE; |
| 131 | } |
| 132 | |
| 133 | if (parameters.size() == 0 || parameters[0] == "status") { |
| 134 | out.print("{} is {}\n\n", plugin_name, is_enabled ? "enabled" : "not enabled"); |
| 135 | out.print("population cap per species: {}\n", config.get_int(CONFIG_POP_CAP)); |
| 136 | out.print("updating pregnancies every {} ticks\n", config.get_int(CONFIG_FREQ)); |
| 137 | out.print("pregancies last {} ticks\n", config.get_int(CONFIG_PREG_TIME)); |
| 138 | } else if (parameters[0] == "now") { |
| 139 | impregnateMany(out, true); |
| 140 | } else { |
| 141 | if (parameters.size() < 2) |
| 142 | return CR_WRONG_USAGE; |
| 143 | string command = parameters[0]; |
| 144 | int val = std::max(0, string_to_int(parameters[1])); |
| 145 | if (command == "cap") |
| 146 | config.set_int(CONFIG_POP_CAP, val); |
| 147 | else if (command == "every") |
| 148 | config.set_int(CONFIG_FREQ, val); |
| 149 | else if (command == "pregtime") |
| 150 | config.set_int(CONFIG_PREG_TIME, val); |
| 151 | else |
| 152 | return CR_WRONG_USAGE; |
| 153 | } |
| 154 | |
| 155 | return CR_OK; |
| 156 | } |
| 157 | |
| 158 | DFhackCExport command_result plugin_init(color_ostream &out, vector<PluginCommand> &commands) { |
| 159 | commands.push_back(PluginCommand( |
nothing calls this directly
no test coverage detected