From 616b75b802d7a24269a7262dc74f15dccd2bd60f Mon Sep 17 00:00:00 2001 From: DoctorVanGogh Date: Sun, 30 Nov 2025 19:06:48 +0100 Subject: [PATCH 1/4] empty-bin: change `--liquids` parameter to generalized `--force` and also apply to powders --- docs/empty-bin.rst | 20 +++++++++++--------- empty-bin.lua | 11 ++++++----- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/docs/empty-bin.rst b/docs/empty-bin.rst index 1d45eb81aa..e6e8bf4088 100644 --- a/docs/empty-bin.rst +++ b/docs/empty-bin.rst @@ -25,18 +25,20 @@ Examples -------- ``empty-bin`` - Empty the contents of selected containers or all containers in the selected stockpile or building, except containers with liquids, onto the floor. + Empty the contents of selected containers or all containers in the selected stockpile or building, except containers with liquids or powders, onto the floor. -``empty-bin --liquids`` - Empty the contents of selected containers or all containers in the selected stockpile or building, including containers with liquids, onto the floor. +``empty-bin --force`` + Empty the contents of selected containers or all containers in the selected stockpile or building, including containers with liquids or powders, onto the floor. + +``empty-bin --recursive --force`` + Empty the contents of selected containers or all containers in the selected stockpile or building, including containers with liquids/powders and containers contents that are containers, such as a bags of seeds or filled waterskins, onto the floor. -``empty-bin --recursive --liquids`` - Empty the contents of selected containers or all containers in the selected stockpile or building, including containers with liquids and containers contents that are containers, such as a bags of seeds or filled waterskins, onto the floor. Options --------------- +------- ``-r``, ``--recursive`` - Recursively empty containers. -``-l``, ``--liquids`` - Move contained liquids (DRINK and LIQUID_MISC) to the floor, making them unusable. + Recursively empty containers. + +``-f``, ``--force`` + Move contained liquid and powders (DRINK, LIQUID_MISC and POWDER_MISC) to the floor, making them unusable. diff --git a/empty-bin.lua b/empty-bin.lua index 8e38c13d80..2b5700932e 100644 --- a/empty-bin.lua +++ b/empty-bin.lua @@ -8,7 +8,7 @@ local argparse = require('argparse') local options, args = { help = false, recursive = false, - liquids = false + force = false }, {...} @@ -18,9 +18,10 @@ local function emptyContainer(container) print('Emptying ' .. dfhack.items.getReadableDescription(container)) local pos = xyz2pos(dfhack.items.getPosition(container)) for _, item in ipairs(items) do - local skip_liquid = not options.liquids and (item:getType() == df.item_type.LIQUID_MISC or item:getType() == df.item_type.DRINK) - if skip_liquid then - print(' ' .. dfhack.items.getReadableDescription(item) .. ' was skipped because the --liquids flag was not provided') + local itemType = item:getType() + local skip = not options.force and (itemType == df.item_type.LIQUID_MISC or itemType == df.item_type.DRINK or itemType == df.item_type.POWDER_MISC) + if skip then + print(' ' .. dfhack.items.getReadableDescription(item) .. ' was skipped because the --force flag was not provided') else print(' ' .. dfhack.items.getReadableDescription(item)) dfhack.items.moveToGround(item, pos) @@ -35,7 +36,7 @@ end argparse.processArgsGetopt(args,{ { 'h', 'help', handler = function() options.help = true end }, { 'r', 'recursive', handler = function() options.recursive = true end }, - { 'l', 'liquids', handler = function() options.liquids = true end } + { 'f', 'force', handler = function() options.force = true end } }) if options.help then From f39de0fb94e754cbab399eea17c033f41abc3c08 Mon Sep 17 00:00:00 2001 From: DoctorVanGogh Date: Sun, 30 Nov 2025 19:51:40 +0100 Subject: [PATCH 2/4] add changelog entry for `empty-bin` changes --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index d84f46e54d..1481938f86 100644 --- a/changelog.txt +++ b/changelog.txt @@ -31,6 +31,7 @@ Template for new versions: ## New Features ## Fixes +- `empty-bin`: renamed `--liquids` parameter to `--force` and made emptying of containers (bags) with powders contingent on that parameter. Previously powders would just always get disposed. ## Misc Improvements From 3ae5b6f625725a8d25d5805d0550d45144bb0f5e Mon Sep 17 00:00:00 2001 From: DoctorVanGogh Date: Thu, 4 Dec 2025 23:07:53 +0100 Subject: [PATCH 3/4] empty-bin: update phrasing for skipped containers --- empty-bin.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/empty-bin.lua b/empty-bin.lua index 2b5700932e..0f2a183db1 100644 --- a/empty-bin.lua +++ b/empty-bin.lua @@ -21,7 +21,7 @@ local function emptyContainer(container) local itemType = item:getType() local skip = not options.force and (itemType == df.item_type.LIQUID_MISC or itemType == df.item_type.DRINK or itemType == df.item_type.POWDER_MISC) if skip then - print(' ' .. dfhack.items.getReadableDescription(item) .. ' was skipped because the --force flag was not provided') + print(' ' .. dfhack.items.getReadableDescription(item) .. ' was skipped (use --force to override)') else print(' ' .. dfhack.items.getReadableDescription(item)) dfhack.items.moveToGround(item, pos) From d066733a0a287b4071d4c2afb3b2002ea13c47c9 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Fri, 5 Dec 2025 20:03:34 -0600 Subject: [PATCH 4/4] fix changelog --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 1481938f86..7b84ea034f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -31,7 +31,7 @@ Template for new versions: ## New Features ## Fixes -- `empty-bin`: renamed `--liquids` parameter to `--force` and made emptying of containers (bags) with powders contingent on that parameter. Previously powders would just always get disposed. +- `empty-bin`: renamed ``--liquids`` parameter to ``--force`` and made emptying of containers (bags) with powders contingent on that parameter. Previously powders would just always get disposed. ## Misc Improvements