Commit Graph

3947 Commits (b55d844164fd2bfdc9c1088e0a356cdd6a1f3bde)

Author SHA1 Message Date
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
George Murray a3c565b243 Add to_search_normalized to search for characters with accents 2020-09-24 07:31:10 -07:00
Myk Taylor 1c2761f903 enable all in quickfort mode
and simplify logic since new bool map values are already initialized to
false
2020-09-23 20:00:04 -07:00
Myk Taylor 323d377f63 Merge remote-tracking branch 'upstream/develop' into buildingplan_refactor 2020-09-23 19:21:49 -07:00
lethosor 577bb0a258
Merge remote-tracking branch 'myk002/buildingplan_format' into develop 2020-09-23 20:04:17 -04:00
Quietust d3520a2f5f Fix createitem to properly create plant growths (#898) 2020-09-20 16:11:41 -06:00
lethosor 0e6e00af5e
getplants: fix crash when world_object_data is not present for certain blocks 2020-09-20 01:24:46 -04:00
lethosor 9c37a3a068
Add "createitem inspect" subcommand 2020-09-19 20:33:47 -04:00
lethosor 8df8eb0c5d
Remove obsolete xlsxio_project dependency 2020-09-19 16:23:21 -04:00
lethosor 5952c16d87
Merge branch 'develop' into deps-subdirectory 2020-09-19 16:19:47 -04:00
PassionateAngler 11ee3a223d enumnick: command added to 'zone' plugin and other QoL improvements
zone: enumnick command create nick for creature from given prefix and number
      uinfo displays "Matched creatures" i.e number of creatures matched by filter
      maxage, and minage filters accept float now
      slaughter flag displayed on uinfo cretures list
2020-09-19 14:52:16 +02:00
lethosor a4254a4d2c
xlsxreader: Don't link to zlib directly
It's complicated on Windows, and xlsxio already links to it directly
2020-09-18 15:04:06 -04:00
lethosor b85759620f
Switch libzip and xlsxio to be included with add_subdirectory(), disable xlsxio installation 2020-09-18 00:33:41 -04:00
lethosor 42d4d33571
Only modify xlsxreader target if it was created
Ref #1620
2020-09-17 15:41:29 -04:00