diff --git a/docs/changelog.txt b/docs/changelog.txt index abd1b845fc..1cf3d0d070 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -71,6 +71,7 @@ Template for new versions: - `spectate`: added prefer nicknamed units - `blueprint`: support for recording zones - `blueprint`: support for recording stockpile properties like names and stockpile links; does not yet support recording detailed contents configuration +- `strangemood`: support added for specifying unit id instead of selected unit or random one. ## Documentation diff --git a/docs/plugins/strangemood.rst b/docs/plugins/strangemood.rst index b7d87196e2..e9f0033783 100644 --- a/docs/plugins/strangemood.rst +++ b/docs/plugins/strangemood.rst @@ -29,6 +29,10 @@ Options Make the strange mood strike the selected unit instead of picking one randomly. Unit eligibility is still enforced (unless ``--force`` is also specified). +``--id`` + Make the strange mood strike the unit with the given id instead of picking one + randomly. Unit eligibility is still enforced (unless ``--force`` is also + specified). ``--type `` Force the mood to be of a particular type instead of choosing randomly based on happiness. Valid values are "fey", "secretive", "possessed", "fell", and diff --git a/plugins/strangemood.cpp b/plugins/strangemood.cpp index 98b8b4b725..3bdd9431df 100644 --- a/plugins/strangemood.cpp +++ b/plugins/strangemood.cpp @@ -164,6 +164,18 @@ command_result df_strangemood (color_ostream &out, vector & parameters) return CR_WRONG_USAGE; else if(parameters[i] == "--force") force = true; + else if(parameters[i] == "--id") + { + i++; + if (i == parameters.size()) + { + out.printerr("No unit id specified!\n"); + return CR_WRONG_USAGE; + } + unit = df::unit::find(std::stoi(parameters[i])); + if (!unit) + return CR_FAILURE; + } else if(parameters[i] == "--unit") { unit = DFHack::Gui::getSelectedUnit(out);