From 306822b1750084d0e7475915fa3f3ce960edaeeb Mon Sep 17 00:00:00 2001 From: Tachytaenius Date: Sun, 10 Jul 2022 18:05:16 +0100 Subject: [PATCH 01/12] Update changelog.txt --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 955298b47..2cbf253d4 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -57,6 +57,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - UX: You can now click on the hotkey hint text in many ``gui/`` script windows to activate the hotkey, like a button. Not all scripts have been updated to use the clickable widget yet, but you can try it in `gui/blueprint` or `gui/quickfort`. ## Documentation +- Made ``DFHACK_`` prefix in ``custom-raw-tokens``' documentation ``EXAMPLE_MOD_`` and explained why. ## API - Removed "egg" ("eggy") hook support (Linux only). The only remaining method of hooking into DF is by interposing SDL calls, which has been the method used by all binary releases of DFHack. From 155525b853edd377d7711aeaebc6fc677169625f Mon Sep 17 00:00:00 2001 From: Tachytaenius Date: Sun, 10 Jul 2022 18:10:40 +0100 Subject: [PATCH 02/12] Update Lua API.rst --- docs/Lua API.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/Lua API.rst b/docs/Lua API.rst index ebd7a1287..14770c16d 100644 --- a/docs/Lua API.rst +++ b/docs/Lua API.rst @@ -3348,24 +3348,27 @@ A module for reading custom tokens added to the raws by mods. The same as ``getToken(plantGrowthItem, token)`` but with a specified plant and growth, using growth name (e.g. "LEAVES") instead of number. +It is recommended to prefix custom raw tokens with the name of your mod to avoid duplicate behaviour where +two mods make callbacks that work on the same tag. + Examples: * Using an eventful onReactionComplete hook, something for disturbing dwarven science:: - if customRawTokens.getToken(reaction, "DFHACK_CAUSES_INSANITY") then + if customRawTokens.getToken(reaction, "EXAMPLE_MOD_CAUSES_INSTANITY") then -- make unit who performed reaction go insane * Using an eventful onProjItemCheckMovement hook, a fast or slow-firing crossbow:: -- check projectile distance flown is zero, get firer, etc... - local multiplier = tonumber(customRawTokens.getToken(bow, "DFHACK_FIRE_RATE_MULTIPLIER")) or 1 + local multiplier = tonumber(customRawTokens.getToken(bow, "EXAMPLE_MOD_FIRE_RATE_MULTIPLIER")) or 1 firer.counters.think_counter = firer.counters.think_counter * multiplier * Something for a script that prints help text about different types of units:: local unit = dfhack.gui.getSelectedUnit() if not unit then return end - local helpText = customRawTokens.getToken(unit, "DFHACK_HELP_TEXT") + local helpText = customRawTokens.getToken(unit, "EXAMPLE_MOD_HELP_TEXT") if helpText then print(helpText) end * Healing armour:: @@ -3374,7 +3377,7 @@ Examples: local healAmount = 0 for _, entry in ipairs(unit.inventory) do if entry.mode == 2 then -- Worn - healAmount = healAmount + tonumber((customRawTokens.getToken(entry.item, "DFHACK_HEAL_AMOUNT")) or 0) + healAmount = healAmount + tonumber((customRawTokens.getToken(entry.item, "EXAMPLE_MOD_HEAL_AMOUNT")) or 0) end end unit.body.blood_count = math.min(unit.body.blood_max, unit.body.blood_count + healAmount) From 0b6178f5d23f806fa10ac8165c7dd33f53a58374 Mon Sep 17 00:00:00 2001 From: Tachytaenius Date: Sat, 27 Aug 2022 15:24:22 +0100 Subject: [PATCH 03/12] Apply suggestions from code review Co-authored-by: Myk --- docs/Lua API.rst | 2 +- docs/changelog.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/Lua API.rst b/docs/Lua API.rst index 14770c16d..b20377958 100644 --- a/docs/Lua API.rst +++ b/docs/Lua API.rst @@ -3355,7 +3355,7 @@ Examples: * Using an eventful onReactionComplete hook, something for disturbing dwarven science:: - if customRawTokens.getToken(reaction, "EXAMPLE_MOD_CAUSES_INSTANITY") then + if customRawTokens.getToken(reaction, "EXAMPLE_MOD_CAUSES_INSANITY") then -- make unit who performed reaction go insane * Using an eventful onProjItemCheckMovement hook, a fast or slow-firing crossbow:: diff --git a/docs/changelog.txt b/docs/changelog.txt index 2cbf253d4..955298b47 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -57,7 +57,6 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - UX: You can now click on the hotkey hint text in many ``gui/`` script windows to activate the hotkey, like a button. Not all scripts have been updated to use the clickable widget yet, but you can try it in `gui/blueprint` or `gui/quickfort`. ## Documentation -- Made ``DFHACK_`` prefix in ``custom-raw-tokens``' documentation ``EXAMPLE_MOD_`` and explained why. ## API - Removed "egg" ("eggy") hook support (Linux only). The only remaining method of hooking into DF is by interposing SDL calls, which has been the method used by all binary releases of DFHack. From 27e189fef2411b61646cb77469b2935e881a96c1 Mon Sep 17 00:00:00 2001 From: myk002 Date: Mon, 29 Aug 2022 15:17:17 -0700 Subject: [PATCH 04/12] no cursor position reset when updating list filter --- library/lua/gui/widgets.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 788e16c4f..8d5b4f8ab 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -1204,7 +1204,9 @@ function FilteredList:setFilter(filter, pos) local cidx = nil filter = filter or '' - self.edit:setText(filter) + if filter ~= self.edit.text then + self.edit:setText(filter) + end if filter ~= '' then local tokens = filter:split() From 8804dab18246aa4882de770a2f6e11daa1d8709d Mon Sep 17 00:00:00 2001 From: myk002 Date: Mon, 29 Aug 2022 22:04:22 -0700 Subject: [PATCH 05/12] update dreamfort traffic designations --- data/blueprints/library/dreamfort.csv | 106 +++++++++++++++++++++++++- docs/changelog.txt | 1 + 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/data/blueprints/library/dreamfort.csv b/data/blueprints/library/dreamfort.csv index ff0b8b4fc..d13b71795 100644 --- a/data/blueprints/library/dreamfort.csv +++ b/data/blueprints/library/dreamfort.csv @@ -33,7 +33,7 @@ Put that file in your dfhack-config/init/ directory -- the same directory that h "" "Also check out https://docs.dfhack.org/en/stable/docs/Plugins.html#professions for more information on the default labor professions that are distributed with DFHack, including suggestions on how many dwarves of each profession you are likely to need at each stage of fort maturity." "" -"Once you have your starting surface workshops up and running, you might want to configure buildingplan (in its global settings, accessible from any building placement screen, e.g.: b-a-G) to only use blocks for constructions so it won't use your precious wood, boulders, and bars to build floors and walls. If you bring at least 7 blocks with you on embark, you can even set this in your onMapLoad.init file like this:" +"Once you have your starting surface workshops up and running, you might want to configure buildingplan (in its global settings, accessible from any building placement screen, e.g.: b-a-G) to only use blocks for constructions so it won't use your precious wood, boulders, and bars to build floors and walls. If you bring at least 7 blocks with you on embark, you can even set this in your dfhack-config/init/onMapLoad.init file like this:" on-new-fortress buildingplan set boulders false; buildingplan set logs false "" "Directly after embark, run ""quickfort run library/dreamfort.csv -n /setup"" with your cursor on your wagon to set settings, and get started building your fort with ""quickfort run library/dreamfort.csv -n /surface1"" on the surface (see /surface_help for how to select a good spot). Read the walkthroughs for each level to understand what's going on and follow the checklist to keep track of where you are in the building process. Good luck, and have fun building an awesome Dreamfort-based fort!" @@ -50,6 +50,7 @@ interactively." "" -- Preparation (before you embark!) -- Copy hack/examples/init/onMapLoad_dreamfort.init to your dfhack-config/init directory inside your DF installation +Optionally copy the premade Dreamfort embark profile from the online spreadsheets to the data/init/embark_profiles.txt file "" -- Set settings and preload initial orders -- quickfort run library/dreamfort.csv -n /setup,# Run before making any manual adjustments to settings! Run the /setup_help blueprint for details on what this blueprint does. @@ -360,6 +361,7 @@ Once the marked trees are cleared and at least the beehives and weapon rack have place/surface_place build/surface_build query/surface_query +traffic/surface_traffic clear_large/surface_clear_large "" "#meta label(surface6) start(central stairs) message(Remember to enqueue manager orders for this blueprint. @@ -979,6 +981,40 @@ You might also want to set the ""trade goods quantum"" stockpile to Auto Trade i +#dig label(surface_traffic) start(19; 19) hidden() set traffic designations + + + +,,,`,,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,,` +,,,`,,`,,,,,,,,,,,,,,,,,,,,,,,,,,`,,` +,,,`,,`,,,,,,,,,,,,,,,,,,,,,,,,,,`,,` +,,,`,,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,ol,ol,ol,ol,ol,ol,`,`,`,`,`,`,`,`,`,`,`,` +,,,,,,,,,,,,,,,ol,ol,ol,ol,ol,ol,ol +,,,,,,,,,,,,,,,ol,ol,ol,ol,ol,ol,ol + #dig label(surface_clear_large) start(19; 19) hidden() clear wider area of trees t1(37x33) @@ -1529,6 +1565,7 @@ Farming Walkthrough: Once furniture has been placed, continue with /farming3.) workshops, stockpiles, and important furniture" build/farming_build place/farming_place +traffic/farming_traffic query_stockpiles/farming_query_stockpiles link_stockpiles/farming_link "" @@ -1601,6 +1638,37 @@ build3/farming_build3 ,,,,,,,,,,,,,,,ry +#dig label(farming_traffic) start(16; 18) hidden() keep hungry dwarves away from the crops and food stores so they prefer the prepared meals + + +,,,,,,,,,ol,ol,ol,,or,or,or,or,or,,ol,ol,ol,ol +,,,,,,,,,ol,ol,ol,,or,or,or,or,or,,ol,ol,ol,ol +,,,,,,,,,ol,ol,ol,,or,or,or,or,or,,ol,ol,ol,ol +,,,,,,,,,,,ol,,or,or,or,or,or,,ol,ol,ol,ol +,,,,,,,ol,ol,ol,,ol,,or,or,or,or,or,,ol,ol,ol,ol +,,,,,,,ol,ol,ol,ol,ol,,or,or,or,or,or,,ol,ol,ol,ol +,,,,,,,ol,ol,ol,,ol,,or,or,or,or,or,,ol +,,,,,,,,,,,ol,,or,or,or,or,or,,ol,,ol,ol,ol +,,,,,,ol,ol,ol,ol,,ol,,or,or,or,or,or,,ol,ol,ol,ol,ol +,,,,,,ol,ol,ol,ol,,ol,,or,or,or,or,or,,ol,,ol,ol,ol +,,,ol,ol,,ol,ol,ol,ol,,ol,,or,or,or,or,or,,ol +,,ol,ol,ol,,ol,ol,ol,ol,,ol,,or,or,or,or,or,,ol,,ol,ol,ol,,ol,ol,ol +,,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,,or,,or,,,ol,ol,ol,ol,ol,ol,ol,ol,ol +,,,ol,ol,,ol,ol,ol,ol,,ol,ol,ol,ol,ol,ol,ol,ol,ol,,ol,ol,ol,,ol,ol,ol +,,,,or,,,or,,,,,,ol,`,`,`,ol,,,,,or,,,,or +,,or,or,or,or,or,or,or,or,or,or,,ol,`,~,`,ol,,or,or,or,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,or,or,or,or,ol,`,`,`,ol,or,or,or,or,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,or,or,or,,ol,ol,ol,ol,ol,,or,or,or,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,or,or,,,,ol,,ol,,,,or,or,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,or,,,ol,ol,ol,ol,ol,ol,ol,,,or,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,or,,ol,ol,,,ol,,,ol,ol,,or,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,,,ol,ol,,ol,ol,ol,,ol,ol,,,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,,ol,ol,ol,,ol,ol,ol,,ol,ol,ol,,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,,ol,ol,ol,,ol,ol,ol,,ol,ol,ol,,or,or,or,or,or,or,or +,,or,or,or,or,or,or,or,,ol,ol,ol,,,ol,,,ol,ol,ol,,or,or,or,or,or,or,or +,,,,,,,,,,,,,,,ol + + "#query label(farming_query_stockpiles) start(16; 18) hidden() message(remember to: - assign a minecart to the refuse quantum stockpile (run ""assign-minecarts all"") - if the industry level is already built, configure the jugs, pots, and bags stockpiles to take from the ""Goods"" quantum stockpile on the industry level) config stockpiles" @@ -2507,6 +2575,42 @@ query_jail/services_query_jail ,,,,,,,,,,,,,,,`,`,`,`,` ,,,,,,,,,,,,,,,`,`,`,`,` +#dig label(services_traffic) start(18; 18) hidden() promote the tavern as the place to eat + +,ol,ol,ol,,ol,ol,ol,,ol,ol,ol,,or,or,or,,or,,or,or,or +,ol,ol,ol,,ol,ol,ol,,ol,ol,ol,,or,or,or,or,or,or,or,or,or +,ol,ol,ol,,ol,ol,ol,,ol,ol,ol,,or,or,or,,or,,or,or,or +,,ol,,,,ol,,,,ol,,,,,,,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,or,or,or,,or,,or,or,or,,or,or,or,or,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,or,or,or,or,or,or,or,or,or,,or,or,or,or,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,or,or,or,,or,,or,or,or,,or,or,or,or,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,,,,,or,,,,,,or,or,or,or,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,or,or,or,or,or,or,or,or,or,,or,or,or,or,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,or,or,or,or,or,or,or,or,or,,,,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,or,or,or,or,or,or,or,or,or,or,or,or,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,or,or,or,or,or,or,or,or,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,or,or,or,or,or,or,or,or,or,,or,,or,,or,,or +,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,ol,,,,,or,,or,,,,,or,,or,,or,,or +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,,,,oh,oh,oh,oh,oh,,,,or,or,or,or,or,or,or,or,or +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,`,`,`,oh,oh,oh,oh,oh,oh,oh,oh,oh,or,or +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,,`,,oh,`,`,`,oh,,`,,oh,oh,oh,`,oh,or,or,or,or +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,`,`,`,oh,oh,oh,oh,oh,oh,oh,oh,oh,or,or +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,,,,oh,oh,oh,oh,oh,,,,or,or,or,or,or,or,or,or,or +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,,,,,,`,,,,,,or,,or,,or,,or +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,,,,,,,,,,,,or,,or,,or,,or +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh,oh +,,,,oh,oh,,oh,oh +,oh,oh,oh,oh,oh,,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,,oh,oh,oh,oh,oh +,oh,oh,oh,oh,oh,,oh,oh,oh,oh,oh + "#build label(services_build3) start(18; 18) hidden() jail, statues" ,~,~,~,,~,~,~,,~,~,~,,t,l,b,,`,,t,l,b diff --git a/docs/changelog.txt b/docs/changelog.txt index 955298b47..ba2ddbc49 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -55,6 +55,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `seedwatch`: ``seedwatch all`` now adds all plants with seeds to the watchlist, not just the "basic" crops. - UX: You can now move the cursor around in DFHack text fields in ``gui/`` scripts (e.g. `gui/blueprint`, `gui/quickfort`, or `gui/gm-editor`). You can move the cursor by clicking where you want it to go with the mouse or using the Left/Right arrow keys. Ctrl+Left/Right will move one word at a time, and Alt+Left/Right will move to the beginning/end of the text. - UX: You can now click on the hotkey hint text in many ``gui/`` script windows to activate the hotkey, like a button. Not all scripts have been updated to use the clickable widget yet, but you can try it in `gui/blueprint` or `gui/quickfort`. +- `quickfort`: `Dreamfort ` blueprint set improvements: set traffic designations to encourage dwarves to eat in the grand hall instead of the manager's office and to eat cooked food instead of raw ingredients ## Documentation From 2b7a153509f725bf39c849c5b5ba2167d663a22e Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Tue, 30 Aug 2022 07:26:41 +0000 Subject: [PATCH 06/12] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index f6c877881..d619a2cf5 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit f6c8778817b760a0d53c6fc8a176679df7a6e660 +Subproject commit d619a2cf5fc9883d6f24a7ebb1c1e53bfc9c9848 From 074a6ec5cdfc82066dcad4782027cfc4d86b8f7b Mon Sep 17 00:00:00 2001 From: myk002 Date: Mon, 29 Aug 2022 11:40:56 -0700 Subject: [PATCH 07/12] allow EditFields to ignore specified keys like "+" and "-", so you can use them as hotkeys in the parent view --- docs/Lua API.rst | 4 ++++ docs/changelog.txt | 2 ++ library/lua/gui/widgets.lua | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/docs/Lua API.rst b/docs/Lua API.rst index b20377958..77194c59b 100644 --- a/docs/Lua API.rst +++ b/docs/Lua API.rst @@ -3986,6 +3986,9 @@ Attributes: widgets while it has focus. You can set this to ``true``, for example, if you don't want a ``List`` widget to react to arrow keys while the user is editing. +:ignore_keys: If specified, must be a list of key names that the edit field + should ignore. This is useful if you have plain string characters + that you want to use as hotkeys (like ``+``). An ``EditField`` will only read and process text input if it has keyboard focus. It will automatically acquire keyboard focus when it is added as a subview to @@ -4311,6 +4314,7 @@ supports: :edit_pen: If specified, used instead of ``cursor_pen`` for the edit field. :edit_below: If true, the edit field is placed below the list instead of above. :edit_key: If specified, the edit field is disabled until this key is pressed. +:edit_ignore_keys: If specified, must be a list of key names that the filter edit field should ignore. :not_found_label: Specifies the text of the label shown when no items match the filter. The list choices may include the following attributes: diff --git a/docs/changelog.txt b/docs/changelog.txt index ba2ddbc49..054ae8cb1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -73,6 +73,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - ``tile-material``: fix the order of declarations. The ``GetTileMat`` function now returns the material as intended (always returned nil before). Also changed the license info, with permission of the original author. - ``widgets.EditField``: new ``onsubmit2`` callback attribute is called when the user hits Shift-Enter. - ``widgets.EditField``: new function: ``setCursor(position)`` sets the input cursor. +- ``widgets.EditField``: new attribute: ``ignore_keys`` lets you ignore specified characters if you want to use them as hotkeys +- ``widgets.FilteredList``: new attribute: ``edit_ignore_keys`` gets passed to the filter EditField as ``ignore_keys`` - ``widgets.Label``: ``scroll`` function now interprets the keywords ``+page``, ``-page``, ``+halfpage``, and ``-halfpage`` in addition to simple positive and negative numbers. - ``widgets.HotkeyLabel``: clicking on the widget will now call ``on_activate()``. - ``widgets.CycleHotkeyLabel``: clicking on the widget will now cycle the options and trigger ``on_change()``. This also applies to the ``ToggleHotkeyLabel`` subclass. diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 8d5b4f8ab..d05749417 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -188,6 +188,7 @@ EditField.ATTRS{ key = DEFAULT_NIL, key_sep = DEFAULT_NIL, modal = false, + ignore_keys = DEFAULT_NIL, } function EditField:preinit(init_table) @@ -270,6 +271,12 @@ function EditField:onInput(keys) return self:inputToSubviews(keys) end + if self.ignore_keys then + for _,ignore_key in ipairs(self.ignore_keys) do + if keys[ignore_key] then return false end + end + end + if self.key and keys.LEAVESCREEN then local old = self.text self:setText(self.saved_text) @@ -1099,6 +1106,7 @@ FilteredList = defclass(FilteredList, Widget) FilteredList.ATTRS { edit_below = false, edit_key = DEFAULT_NIL, + edit_ignore_keys = DEFAULT_NIL, } function FilteredList:init(info) @@ -1108,6 +1116,7 @@ function FilteredList:init(info) on_change = self:callback('onFilterChange'), on_char = self:callback('onFilterChar'), key = self.edit_key, + ignore_keys = self.edit_ignore_keys, } self.list = List{ frame = { t = 2 }, From c178fa35a2e982f250248c0198d200e951ba4ead Mon Sep 17 00:00:00 2001 From: myk002 Date: Mon, 29 Aug 2022 11:49:12 -0700 Subject: [PATCH 08/12] unit test EditField ignore_keys --- test/library/gui/widgets.EditField.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/library/gui/widgets.EditField.lua b/test/library/gui/widgets.EditField.lua index 15acfddb0..23558987b 100644 --- a/test/library/gui/widgets.EditField.lua +++ b/test/library/gui/widgets.EditField.lua @@ -54,3 +54,18 @@ function test.editfield_click() expect.eq(3, e.cursor) end) end + +function test.editfield_ignore_keys() + local e = widgets.EditField{ignore_keys={'CUSTOM_B', 'CUSTOM_C'}} + e:setFocus(true) + + e:onInput{_STRING=string.byte('a'), CUSTOM_A=true} + expect.eq('a', e.text, '"a" should be accepted') + e:onInput{_STRING=string.byte('b'), CUSTOM_B=true} + expect.eq('a', e.text, '"b" should be rejected') + e:onInput{_STRING=string.byte('c'), CUSTOM_C=true} + expect.eq('a', e.text, '"c" should be rejected') + e:onInput{_STRING=string.byte('d'), CUSTOM_D=true} + expect.eq('ad', e.text, '"d" should be accepted') + +end From 75b14336a70d8d8c5ac0ce770b51c12ad39d4849 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Wed, 31 Aug 2022 17:36:55 +0000 Subject: [PATCH 09/12] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index d619a2cf5..f18758d93 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit d619a2cf5fc9883d6f24a7ebb1c1e53bfc9c9848 +Subproject commit f18758d93b8877ea623f0eef851602d9844741aa From ecb0a470d2525c10a7b2c1d2fb8e3e9a1b3e8eef Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 31 Aug 2022 17:38:12 -0700 Subject: [PATCH 10/12] declare zone before building chest for hospital otherwise the hospital doesn't get stocked --- data/blueprints/library/dreamfort.csv | 132 +++++++++++++------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/data/blueprints/library/dreamfort.csv b/data/blueprints/library/dreamfort.csv index d13b71795..72e2161fe 100644 --- a/data/blueprints/library/dreamfort.csv +++ b/data/blueprints/library/dreamfort.csv @@ -1003,12 +1003,12 @@ You might also want to set the ""trade goods quantum"" stockpile to Auto Trade i ,,,`,,`,,,,,,,,,,`,,`,`,`,,`,,,,,,,,,,`,,` ,,,`,,`,,`,,,,,,,,,,`,`,`,,,,,,,,,,,,`,,` ,,,`,,`,,`,,,,,,,,`,,,,,,`,,,,,,,,,,`,,` -,,,`,,`,`,`,`,`,`,`,,`,`,`,`,,`,,`,`,`,`,,`,`,`,`,`,`,`,,` -,,,`,,`,,,,,,,,,`,,ol,ol,ol,ol,ol,,`,,,,,,,,,`,,` -,,,`,,`,,,,,,,,,ol,ol,ol,ol,ol,ol,ol,ol,ol,,,,,,,,,`,,` -,,,`,,`,,,,,,,,,ol,ol,,,,,,ol,ol,,,,,,,,,`,,` -,,,`,,`,,,,,,,,,ol,ol,,,,,,ol,ol,,,,,,,,,`,,` -,,,`,,`,,,,,,,,,`,,,,,,,,`,,,,,,,,,`,,` +,,,`,,`,`,`,`,`,`,`,,`,`,`,`,,`,,`,`,`,`,or,`,`,`,`,`,`,`,,` +,,,`,,`,,,,,,,,,`,,ol,ol,ol,ol,ol,,`,or,,,,,,,,`,,` +,,,`,,`,,,,,,,,,ol,ol,ol,ol,ol,ol,ol,ol,ol,or,,,,,,,,`,,` +,,,`,,`,,,,,,,,,ol,ol,,,,,,ol,ol,or,,,,,,,,`,,` +,,,`,,`,,,,,,,,,ol,ol,,,,,,ol,ol,or,,,,,,,,`,,` +,,,`,,`,,,,,,,,,`,,,,,,,,`,or,,,,,,,,`,,` ,,,`,,`,`,`,`,`,`,`,`,`,`,,,,,,,,`,`,`,`,`,`,`,`,`,`,,` ,,,`,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,` ,,,`,`,`,`,`,`,`,`,`,`,`,`,ol,ol,ol,ol,ol,ol,ol,`,`,`,`,`,`,`,`,`,`,`,` @@ -1737,7 +1737,7 @@ build3/farming_build3 ,,,,,,,,,`,`,`,,`,`,`,`,`,,`,`,`,` -,,,,,,,,,r&,`,`,,`,`,`,`,`,,`,`,`,` +,,,,,,,,,r&a+&,,,,`,`,`,`,`,,`,`,`,` ,,,,,,,,,`,`,`,,`,`,`,`,`,,`,`,r+&h ,,,,,,,,,,,`,,`,`,`,`,`,,`,`,`,` ,,,,,,,`,`,`,,`,,`,`,`,`,`,,`,`,`,` @@ -2206,9 +2206,9 @@ Services Walkthrough: "#meta label(services2) start(central stairs) message(Remember to enqueue manager orders for this blueprint. Once furniture has been placed, continue with /services3.) dining hall anchors, stockpiles, hospital, garbage dump" +zones/services_zones build/services_build place/services_place -zones/services_zones name_zones/services_name_zones query_stockpiles/services_query_stockpiles "" @@ -2221,6 +2221,64 @@ build2/services_build2 build3/services_build3 place_jail/services_place_jail query_jail/services_query_jail +"#zone label(services_zones) start(18; 18) hidden() message(If you'd like to fill your wells via bucket brigade, activate the inactive pond zones one level down from where the wells will be built.) garbage dump, hospital, and pond zones" + +,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,,`,`,` +,`,`,`,,`,`,`,,`,`,`,,`,`,`,`,`,`,`,`,` +,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,,`,`,` +,,`,,,,`,,,,`,,,,,,,` +,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,,`,,`,`,`,,`,`,`,`,` +,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,`,`,`,`,`,`,,`,`,`,`,` +,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,,`,,`,`,`,,`,`,`,`,` +,`,`,`,`,`,`,`,`,`,`,`,,,,,,`,,,,,,`,`,`,`,` +,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,`,`,`,`,`,`,,`,`,`,`,` +,`,`,`,`,`,`,`,`,`,`,`,,`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,,,,,,,,,,,,`,`,`,`,`,`,`,`,` +,,,,,,,,,,,,,,,,,` +,,,,,,,,,,,,,,,,,` +,,,,,,,,,,,,,`,apPf,`,,`,,`,apPf,` +,,,,,,,,,,,,,`,`,`,`,`,`,`,`,` +,,,,,,,,,,,,,,,,,` +,,,,,,,,,,,,,,,,,` +,,,,,,,,,,,,,,,,,` +,,,,,,,,,,,,,,,,,` +,,,,,,,,,,,,,,,,,` +,,,,,,,,,,,,,,,,,`,`,`,`,`,`,`,`,`,` +,,,,,,,,,,,,,,,,,`,,,,,,,,,` +,,,,,,,,,,,,,,,,,`,,,,,,,,,` +,,,,,,,,,,,,,,,`,`,`,`,`,,,,,,,` +,,,,,,,,,,,,,,,`,`,`,`,`,,,,,,`,`,` +,,,,,,,,,,,,,,,`,`,`,`,`,,,,,,`,apPf,` +,,,,,,,,,,,,,,,`,`,`,`,` +,,,,,,,,,,,,,,,`,`,`,`,` + #build label(services_build) start(18; 18) hidden() build basic hospital and dining room anchor ,b,b,b,,b,b,b,,b,b,b,,`,`,`,,`,,`,`,` @@ -2293,64 +2351,6 @@ query_jail/services_query_jail ,`,`,`,`,`,,`,`,`,`,` ,`,`,`,`,`,,`,`,`,`,` -"#zone label(services_zones) start(18; 18) hidden() message(If you'd like to fill your wells via bucket brigade, activate the inactive pond zones one level down from where the wells will be built.) hospital, garbage dump, and pond zones" - -,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,,`,`,` -,`,`,`,,`,`,`,,`,`,`,,`,`,`,`,`,`,`,`,` -,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,,`,`,` -,,`,,,,`,,,,`,,,,,,,` -,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,,`,,`,`,`,,`,`,`,`,` -,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,`,`,`,`,`,`,,`,`,`,`,` -,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,,`,,`,`,`,,`,`,`,`,` -,`,`,`,`,`,`,`,`,`,`,`,,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,,,,,,,,`,apPf,`,,`,,`,apPf,` -,,,,,,,,,,,,,`,`,`,`,`,`,`,`,` -,,,,,,,,,,,,,,,,,` -,,,,,,,,,,,,,,,,,` -,,,,,,,,,,,,,`,apPf,`,,`,,`,apPf,` -,,,,,,,,,,,,,`,`,`,`,`,`,`,`,` -,,,,,,,,,,,,,,,,,` -,,,,,,,,,,,,,,,,,` -,,,,,,,,,,,,,,,,,` -,,,,,,,,,,,,,,,,,` -,,,,,,,,,,,,,,,,,` -,,,,,,,,,,,,,,,,,`,`,`,`,`,`,`,`,`,` -,,,,,,,,,,,,,,,,,`,,,,,,,,,` -,,,,,,,,,,,,,,,,,`,,,,,,,,,` -,,,,,,,,,,,,,,,`,`,`,`,`,,,,,,,` -,,,,,,,,,,,,,,,`,`,`,`,`,,,,,,`,`,` -,,,,,,,,,,,,,,,`,`,`,`,`,,,,,,`,apPf,` -,,,,,,,,,,,,,,,`,`,`,`,` -,,,,,,,,,,,,,,,`,`,`,`,` - #query label(services_name_zones) start(18; 18) hidden() ,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,,`,`,` From 3d162a52ce9173ede65edcd3133bc763f8bec6d4 Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 31 Aug 2022 22:47:43 -0700 Subject: [PATCH 11/12] Add removed scripts to the graveyard --- docs/Removed.rst | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/docs/Removed.rst b/docs/Removed.rst index e94b04cf8..ca198d802 100644 --- a/docs/Removed.rst +++ b/docs/Removed.rst @@ -10,14 +10,6 @@ work (e.g. links from the `changelog`). :local: :depth: 1 -.. _devel/unforbidall: - -devel/unforbidall -================= - -Replaced by the `unforbid` script. Run ``unforbid all --quiet`` to match the -behavior of the original ``devel/unforbidall`` script. - .. _deteriorateclothes: deteriorateclothes @@ -39,6 +31,13 @@ deterioratefood Replaced by the new combined `deteriorate` script. Run ``deteriorate --types=food``. +.. _devel/unforbidall: + +devel/unforbidall +================= +Replaced by the `unforbid` script. Run ``unforbid all --quiet`` to match the +behavior of the original ``devel/unforbidall`` script. + .. _digfort: digfort @@ -49,6 +48,12 @@ existing .csv files. Just move them to the ``blueprints`` folder in your DF installation, and instead of ``digfort file.csv``, run ``quickfort run file.csv``. +.. _fix/build-location: + +fix/build-location +================== +The corresponding DF :bug:`5991` was fixed in DF 0.40.05. + .. _fortplan: fortplan @@ -59,8 +64,22 @@ script instead. You can use your existing .csv files. Just move them to the ``blueprints`` folder in your DF installation, and instead of ``fortplan file.csv`` run ``quickfort run file.csv``. +.. _gui/hack-wish: + +gui/hack-wish +============= +Replaced by `gui/create-item`. + +.. _gui/no-dfhack-init: + +gui/no-dfhack-init +================== +No longer useful since the user doesn't have to create their own ``dfhack.init`` +file now that init files have moved to ``dfhack-config/init``. It used to show +a warning at startup if :file:`dfhack.init` file was not found. + .. _warn-stuck-trees: warn-stuck-trees ================ -The corresponding DF bug, :bug:`9252` was fixed in DF 0.44.01. +The corresponding DF :bug:`9252` was fixed in DF 0.44.01. From 6edd012e6adda010720ce80f2da695f05712ae5c Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Thu, 1 Sep 2022 05:56:18 +0000 Subject: [PATCH 12/12] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index f18758d93..7bae77756 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit f18758d93b8877ea623f0eef851602d9844741aa +Subproject commit 7bae77756f974aad765251096516a89d9d035977