Commit Graph

3960 Commits (4ac3e62e603a81c348aaab24bd083f9a5b6a7f8a)

Author SHA1 Message Date
Nilsolm 4ac3e62e60 ignore input if selection is zero 2020-11-18 02:41:20 +01:00
lethosor 0b886399fe
zone: stop enumnick from taking priority over assign/unassign/slaughter
Fixes #1709
Ref #1652
2020-11-15 22:21:46 -05:00
lethosor 4921cb4ac7
Merge remote-tracking branch 'PatrikLundell/embark-assistant' into develop 2020-11-14 15:08:22 -05:00
PatrikLundell 0ef56ba859 another space character met its demise 2020-11-14 14:53:54 +01:00
PatrikLundell 46835c9edd reworked aquifer bit fiddling 2020-11-14 14:43:43 +01:00
myk002 59e76ae407
detect buildingplan buildings in the resume plugin 2020-11-13 12:43:46 -08:00
PatrikLundell d51b56c780 removed a blank 2020-11-13 20:28:22 +01:00
PatrikLundell 6014a45235 Fixed bug missing world tiles lacking incurson supplied resources 2020-11-13 20:11:03 +01:00
lethosor 2e4f23d49f
Merge remote-tracking branch 'myk002/myk_isplannedbuilding' into develop 2020-11-13 14:09:36 -05:00
myk002 efdba8b596
add buildingplan.isPlannedBuilding 2020-11-13 10:18:54 -08:00
myk002 10616a387f
cleaner mask-based implementation 2020-11-12 22:44:38 -08:00
myk002 6b14a92385
allow buildingplan to match metal bars 2020-11-12 19:54:00 -08:00
myk002 02a86d761a
identify bars as non_economic items
allows Job::isSuitableMaterial() to match metal bars as a building
material
2020-11-12 19:10:06 -08:00
myk002 36110902fa
don't use cached iterators across map reloads 2020-11-12 00:11:13 -08:00
lethosor 923b1b14f3
Merge remote-tracking branch 'myk002/buildingplan_persist_global_settings' into develop 2020-11-11 23:59:09 -05:00
lethosor 9c13b497bf
Merge remote-tracking branch 'myk002/myk_automaterial_buildingplan_fix' into develop 2020-11-11 23:36:42 -05:00
myk002 54702085d5
don't eat keys while building is being renamed
allows buildingplan to prevent unsuspension of planned buildings without
also eating the 's' key when the user is trying to use it to give the
building a custom name.
2020-11-11 17:12:56 -08:00
lethosor c87d5260d3
buildingplan: make hotkeys added to existing menus red
For clarity (per Lua API.rst guidelines)
2020-11-11 16:04:40 -05:00
lethosor 58079217d9
Merge remote-tracking branches 'myk002/myk_buildingplan_no_quality' and 'myk002/myk_buildingplan_pause' into develop 2020-11-03 00:09:03 -05:00
Myk Taylor 2c65113bdb detect all conditions that make the game pause 2020-10-31 03:03:05 -07:00
Myk Taylor fbc26336cf don't show quality properties for no-quality items
for items that cannot have a quality or be decorated:

in place mode, don't show quality adjustment hotkeys (or isDecorated
flag hotkey) and don't interpret the associated keycodes if they are
pressed.

in query mode, don't show quality or decorated fields.
2020-10-31 02:25:26 -07:00
Myk Taylor 65114d904c fix typo in comment 2020-10-29 11:53:31 -07:00
Myk Taylor 22ac163d55 improve UX between automaterial and buildingplan
solves the confusing behavior when both automaterial and buildingplan
are enabled for constructions. the two plugins now communicate with each
other over the Lua layer to negotiate consistent behavior.

if neither plugin is enabled, the standard DF UI acts as normal

if automaterial is enabled but buildingplan is not, then automaterial
behavior is unchanged.

if buildingplan is enabled and automaterial is not then behavior is
the same as other buildings with buildingplan (no material selection
screen, screen stays on building placement screen after placement).
this commit fixes a bug, though, where buildingplan would only lay
down a single tile of contruction instead of a solid block when a
block is requested.

if both plugins are enabled but buildingplan is not enabled for the
building type then automaterial is unchanged from previous behavior,
execpt for an additional header showing the separation between
automaterial hotkeys and buildingplan hotkeys.

finally, if both plugins are enabled and buildingplan is enabled for the
building type then buildingplan behavior prevails, but the box select and
hollow designations features of automaterial are still usable and
useful. the 'Auto Mat-select', 'Reselect Type', and "Open Placement"
automaterial hotkeys are hidden in the UI and ignored in the feed. This
is because buildingplan takes over material selection, so 'Auto
Mat-select' doesn't make sense. Buildingplan also already stays on the
placement screen after placement, so 'Reselect Type' is not necessary.
And all buildingplan-placed buildings have relaxed placement
restrictions (e.g. they can be built in mid-air) so 'Open Placement' is
also not necessary. The missing options are replaced with blank lines so
the vertical alignment of all other options stays constant.

we also remove a few extra lua_pop() calls that are made superfluous by
the StackUnwinder.
2020-10-29 11:00:49 -07:00
lethosor 08bb6ca35e
Tweak colors
Ref #1684
2020-10-29 00:03:07 -04:00
lethosor d508ad3c4b
Merge remote-tracking branch 'myk002/buildingplan_building_material_filters' into develop
Conflicts:
	docs/changelog.txt
2020-10-28 23:57:55 -04:00
Myk Taylor c1af3e2817 document what happens if no types are allowed 2020-10-26 21:13:11 -07:00
lethosor 3ab9157a2d
Merge remote-tracking branch 'myk002/buildingplan_refactor5_allbuildings_squashed2' into develop 2020-10-26 21:37:41 -04:00
lethosor b723636fe2
Merge remote-tracking branch 'myk002/buildingplan_refactor4_algorithm_squashed2' into develop 2020-10-26 21:24:05 -04:00
Myk Taylor 1a69a9b483 add more important checks for matching items
stolen (with love) from advfort.lua
2020-10-26 16:54:50 -07:00
Myk Taylor 292d40a6ba change hotkeys for adjusting min and max quality
to avoid 'q' and 'w' conflicts with the standard DF UI hotkeys for
roller speed.

min quality: 'qw' -> 'QW'
max quality: 'QW' - 'AS'
2020-10-26 16:11:34 -07:00
Myk Taylor 72b6ac781b on second thought, let UI-related settings reset
no need to have quickfort_mode stay on forever
2020-10-25 02:45:03 -07:00
Myk Taylor 486bf2719b persist global buildingplan settings
this ensures that a player's preferences are saved across map reloads.
this is particularly important for the building material filters, since
item fulfillment tasks are regenerated on map load, and any changes in
settings when buildingplan is reset will change the item vectors that will
be searched for planned buildings. if the settings were allowed to reset,
then a player who thought all walls would be made out of blocks would be
surprised to find boulders and logs being used after the map is reloaded.
2020-10-25 02:37:22 -07:00
lethosor 58917b03d1
Switch away from CheckDFObject in unprotected calls
See https://github.com/DFHack/dfhack/pull/1674#issuecomment-716028460
2020-10-24 14:27:33 -04:00
Myk Taylor a2f943e7e5 don't shift UI down for track constructions
automat doesn't have UI there to avoid
2020-10-24 09:19:15 -07:00
Myk Taylor e614d16e0e use Lua::CheckDFObject instead of static cast 2020-10-23 15:30:40 -07:00
Myk 55a52554ee
use CheckDFObject instead of static cast
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2020-10-23 13:55:14 -07:00
Myk Taylor 0f517f38f8 don't conflict with automaterial plugin
shift buildingplan text down so we don't overwrite each other
2020-10-22 22:01:45 -07:00
Myk Taylor 7e78d8802e migrate qf's buildings_use_blocks to buildingplan
- remove buildings_use_blocks setting from quickfort config file
- add a new Buildingplan Global Settings dialog to house global settings
- move Quickfort Mode (for legacy Python Quickfort) into that dialog
- add four settings to control how generic building materials are matched:
  - blocks
  - boulders
  - logs
  - bars
- ajust the buildingplan algorithm to register duplicate tasks for
  building material item filters, one for each type. since we track how
  many items we've matched for a filter, the first matched item will
  "win" and the extras will get detected as invalid and popped off the
  queue.
- ensure boulders, logs, and bars are scanned last, and in that order
- more global settings planned for the future! see
  http://www.bay12forums.com/smf/index.php?topic=176889.msg8202679#msg8202679
2020-10-22 21:37:49 -07:00
Myk Taylor 09fbaba726 buildingplan: support all building types
Allow buildingplan to handle all building types, update the docs, and add in little extra fixes to ensure all the new types work correctly.
2020-10-16 14:23:35 -07:00
Myk Taylor 100b374af7 generalize buildingplan for all building types
but restrict to only the currently supported set so we can still assume only one filter is required for each building.

changes:
- update buildingplan plugin version to 2.0
- new serialization format for planned buildings
- old persistent data is automatically migrated to new format on load
- algorithm now respects job_item filters; items must match job_item filter and buildingplan ItemFilter
- more invalid items are now filtered out, like items encased in ice. are there any others we should be checking (see BadFlags struct)
- items are sorted before job is unsuspended so final item ordering is correct regardless of what order the items were matched and attached
- item counts in filters are kept up to date so if buildingplan is disabled before all filters are matched and the building is completed by DF itself, the item counts will come out correct (though the item ordering and building "roughness" may be incorrect)
- fixes two memory leaks in building finalization code
- allows artifacts to be matched (ItemFilter defaults now top out at Masterful -- Artifact is selectable but must be manually specified)
- add gui to switch between items for buildings that require multiple item types
2020-10-16 14:08:52 -07:00
Myk Taylor 1368fb4003 buildingplan: construct buildings from lua
Replace C++ building construction code with lua constructBuilding so we can get the proper job_item filters set. these filters will be used when we replace the core buildingplan algorithm in the next PR.
2020-10-16 14:03:05 -07:00
Myk Taylor 82013c0c5e prep buildingplan for core algorithm changes
Lots of refactoring and reorganizing, with only cosmetic player-visible changes.

- show quickfort mode hotlkey label regardless of whether the current building type has buildingplan enabled. before, it was only shown after the user enabled buildingplan for the current building. this eliminates the extra step when enabling quickfort mode, which force-enables all building types.
- changed signature of lua-exported isPlannableBuilding to take subtype
  and custom type in addition to building type. this is only used by
  quickfort, and it already sends all three params in preparation for
  this change
- added lua-exported scheduleCycle(), which is like doCycle(), but only
  takes effect on the next non-paused frame. this lets quickfort
  run only one buildingplan cycle regardless of how many #build
  blueprints were run
- declared a few dfhack library methods and params const so buildingplan
  could call them from const methods
- converted buildingplan internal debug logging fn to have a printf api
- reshaped buildingplan-planner API and refactored implementation in
  preparation for upcoming core algorithm changes for supporing all
  building types (no externally-visible functionality changes)
  - changed df::building_type params to type, subtype, custom tuple keys
  - introduced capability to return multiple filters per building type
    (though the current buildings all only have one filter per)
- split monolith hook functions in buildingplan.cpp into one per scope.
  this significantly cleans up the code and preps the hooks to handle
  iterating through multiple item filters.
- got rid of send_key function and replaced with better reporting of
  whether keys have been handled
2020-10-16 13:52:23 -07:00
lethosor 895fa59c79
Merge branch 'buildingplan_refactor' into develop 2020-10-16 00:05:01 -04:00
lethosor 93520b4b00
dwarfmonitor prefs: fix segfault if item_subtype is null for some item types 2020-10-11 20:45:56 -04:00
lethosor 9c8098b4f0
Expose to_search_normalized to Lua, add test, and use in ListColumn (most useful for the `stocks` plugin) 2020-10-10 01:40:00 -04:00
lethosor 1b53c0e748
Merge remote-tracking branch 'GitOnUp/normalize_search' into develop 2020-10-09 22:18:39 -04:00
lethosor e2de358f00
Merge remote-tracking branch 'PassionateAngler/zone-qol-improvements' into develop 2020-10-09 21:43:04 -04:00
lethosor 2382247398
Update some docs links to use HTTPS 2020-10-09 19:17:59 -04:00
lethosor c9609ad590
Make `createitem inspect` consistent for PLANT_GROWTH items 2020-10-09 12:45:49 -04:00
lethosor 691b35bf04
Merge remote-tracking branch 'quietust/createitem' into develop 2020-10-09 12:35:40 -04:00