From b9591bb32040bc05e191430cb5b1fc2076b9d189 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 31 Dec 2023 00:24:12 -0800 Subject: [PATCH] fix handing of misery factor setting --- docs/changelog.txt | 1 + plugins/lua/misery.lua | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 0670232a5..b35907f10 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -58,6 +58,7 @@ Template for new versions: ## Fixes - `sort`: fix potential crash when removing jobs directly from the Tasks info screen +- `misery`: fix error when changing the misery factor ## Misc Improvements - wherever units are listed in DFHack tools, properties like "agitated" or (-trained-) are now shown diff --git a/plugins/lua/misery.lua b/plugins/lua/misery.lua index cd507c9b3..2ad8c06ca 100644 --- a/plugins/lua/misery.lua +++ b/plugins/lua/misery.lua @@ -22,17 +22,17 @@ function parse_commandline(...) local args, opts = {...}, {} local positionals = process_args(opts, args) - if opts.help then + if opts.help or not positionals then return false end local command = table.remove(positionals, 1) if not command or command == 'status' then status() - elseif command == 'factor' then - misery_setFactor(positionals[1]) elseif command == 'clear' then misery_clear() + elseif tonumber(command) then + misery_setFactor(tonumber(command)) else return false end