diff --git a/changelog.txt b/changelog.txt index fb0800d14b..80cb86fad8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -65,6 +65,7 @@ Template for new versions: - `gui/unit-info-viewer`: add precise unit size in cc (cubic centimeters) for comparison against the wiki values. you can set your preferred number format for large numbers like this in the preferences of `control-panel` or `gui/control-panel` - `gui/quickfort`: delete blueprints from the blueprint load dialog - `quickfort`: new ``delete`` command for deleting player-owned blueprints (library and mod-added blueprints cannot be deleted) +- `quickfort`: support enabling `logistics` features for autoforbid and autoclaim on stockpiles - `gui/quickfort`: allow farm plots, dirt roads, and paved roads to be designated around partial obstructions without callling it an error, matching vanilla behavior - `gui/launcher`: refresh default tag filter when mortal mode is toggled in `gui/control-panel` so changes to which tools autocomplete take effect immediately - `gui/civ-alert`: you can now register multiple burrows as civilian alert safe spaces diff --git a/internal/quickfort/place.lua b/internal/quickfort/place.lua index 2a5d8d95a4..c3533103f4 100644 --- a/internal/quickfort/place.lua +++ b/internal/quickfort/place.lua @@ -163,6 +163,15 @@ local function make_db_entry(keys) return db_entry end +local logistics_props = { + 'automelt', + 'autotrade', + 'autodump', + 'autotrain', + 'autoforbid', + 'autoclaim', +} + local function custom_stockpile(_, keys) local token_and_label, props, adjustments = parse_keys(keys) local db_entry = make_db_entry(token_and_label.token) @@ -176,21 +185,11 @@ local function custom_stockpile(_, keys) end -- logistics properties - if props.automelt == 'true' then - db_entry.logistics.automelt = true - props.automelt = nil - end - if props.autotrade == 'true' then - db_entry.logistics.autotrade = true - props.autotrade = nil - end - if props.autodump == 'true' then - db_entry.logistics.autodump = true - props.autodump = nil - end - if props.autotrain == 'true' then - db_entry.logistics.autotrain = true - props.autotrain = nil + for _, logistics_prop in ipairs(logistics_props) do + if props[logistics_prop] == 'true' then + db_entry.logistics[logistics_prop] = true + props[logistics_prop] = nil + end end -- convert from older parsing style to properties @@ -324,17 +323,8 @@ local function create_stockpile(s, link_data, dry_run) end if next(db_entry.logistics) then local logistics_command = {'logistics', 'add', '-s', tostring(bld.stockpile_number)} - if db_entry.logistics.automelt then - table.insert(logistics_command, 'melt') - end - if db_entry.logistics.autotrade then - table.insert(logistics_command, 'trade') - end - if db_entry.logistics.autodump then - table.insert(logistics_command, 'dump') - end - if db_entry.logistics.autotrain then - table.insert(logistics_command, 'train') + for logistics_prop in pairs(db_entry.logistics) do + table.insert(logistics_command, logistics_prop:sub(5)) end log('running logistics command: "%s"', table.concat(logistics_command, ' ')) dfhack.run_command(logistics_command)