From 1400be4c00f8fd43d7501e8731af9aa2f3d7aa1f Mon Sep 17 00:00:00 2001 From: Squid Coder Date: Wed, 21 May 2025 13:42:37 -0500 Subject: [PATCH 1/2] Add id option --- docs/plugins/strangemood.rst | 4 ++++ plugins/strangemood.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) 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); From 23a9e3c9d424c75f574345d42b4f4a69e79425ec Mon Sep 17 00:00:00 2001 From: Squid Coder Date: Wed, 21 May 2025 13:45:44 -0500 Subject: [PATCH 2/2] Update changelog.txt --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) 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