diff --git a/changelog.txt b/changelog.txt index dcabce6ce4..35629b6143 100644 --- a/changelog.txt +++ b/changelog.txt @@ -35,6 +35,7 @@ Template for new versions: - `caravan`: DFHack dialogs for trade screens (both ``Bring goods to depot`` and the ``Trade`` barter screen) can now filter by item origins (foreign vs. fort-made) and can filter bins by whether they have a mix of ethically acceptable and unacceptable items in them - `caravan`: If you have managed to select an item that is ethically unacceptable to the merchant, an "Ethics warning" badge will now appear next to the "Trade" button. Clicking on the badge will show you which items that you have selected are problematic. The dialog has a button that you can click to deselect the problematic items in the trade list. - `confirm`: If you have ethically unacceptable items selected for trade, the "Are you sure you want to trade" confirmation will warn you about them +- `quickfort`: ``#zone`` blueprints now integrated with `preserve-rooms` so you can create a zone and automatically assign it to a noble or administrative role ## Fixes - `timestream`: ensure child growth events (e.g. becoming an adult) are not skipped over diff --git a/gui/quickfort.lua b/gui/quickfort.lua index 2742ca7741..eae4c701fd 100644 --- a/gui/quickfort.lua +++ b/gui/quickfort.lua @@ -63,7 +63,7 @@ function BlueprintDialog:init() text_pen=COLOR_GREY, }, widgets.ToggleHotkeyLabel{ - frame={t=0, l=12}, + frame={t=0, l=12, w=20}, key='CUSTOM_ALT_L', label='Library:', options=options, @@ -72,7 +72,7 @@ function BlueprintDialog:init() on_change=self:callback('update_setting', 'show_library') }, widgets.ToggleHotkeyLabel{ - frame={t=0, l=35}, + frame={t=0, l=35, w=19}, key='CUSTOM_ALT_H', label='Hidden:', options=options, diff --git a/internal/quickfort/zone.lua b/internal/quickfort/zone.lua index 0c46eb5ca0..dbb2522cf8 100644 --- a/internal/quickfort/zone.lua +++ b/internal/quickfort/zone.lua @@ -6,10 +6,11 @@ if not dfhack_flags.module then end require('dfhack.buildings') -- loads additional functions into dfhack.buildings -local utils = require('utils') +local preserve_rooms = require('plugins.preserve-rooms') local quickfort_common = reqscript('internal/quickfort/common') local quickfort_building = reqscript('internal/quickfort/building') local quickfort_parse = reqscript('internal/quickfort/parse') +local utils = require('utils') local log = quickfort_common.log local logfn = quickfort_common.logfn @@ -227,12 +228,6 @@ local function parse_location_props(props) return location_data end -local function get_noble_unit(noble) - local unit = dfhack.units.getUnitByNobleRole(noble) - if not unit then log('could not find a noble position for: "%s"', noble) end - return unit -end - local function parse_zone_config(c, props) if not rawget(zone_db_raw, c) then return 'Invalid', nil @@ -250,13 +245,7 @@ local function parse_zone_config(c, props) props.name = nil end if props.assigned_unit then - zone_data.assigned_unit = get_noble_unit(props.assigned_unit) - if not zone_data.assigned_unit and props.assigned_unit:lower() == 'sheriff' then - zone_data.assigned_unit = get_noble_unit('captain_of_the_guard') - end - if not zone_data.assigned_unit then - log('could not find a unit assigned to noble position: "%s"', props.assigned_unit) - end + zone_data.assigned_unit = props.assigned_unit props.assigned_unit = nil end if db_entry.props_fn then db_entry.props_fn(zone_data, props) end @@ -387,11 +376,12 @@ local function create_zone(zone, data, ctx) set_location(bld, data.location, ctx) data.location = nil end - if data.assigned_unit then - dfhack.buildings.setOwner(bld, data.assigned_unit) - data.assigned_unit = nil - end + local assigned_unit = data.assigned_unit + data.assigned_unit = nil utils.assign(bld, data) + if assigned_unit then + preserve_rooms.assignToRole(assigned_unit, bld) + end return ntiles end