Commit Graph

227 Commits (e95d8c729621df2a28fc562f746771075cf8f95c)

Author SHA1 Message Date
Josh Cooper fe29bff845
Adds cxxrandom unit test and fixes interface problems (#2099)
* Adds cxxrandom unit test and fixes interface problems

* Tightens braces

* Adds detection code for Shuffle's seqID/engID

* Adds usage examples for cxxrandom

* Gives cxxrandom objects id ranges, sort of

* Updates changelog

* Updates changelog.txt

* Increases id space for cxxrandom

* Fixes bool distribution error message and improves check

* Adds comment explaining the seeded RNG tests for cxxrandom

* Fixes type problem for 32bit builds

* Reduces loop count a few magnitudes

* Fixes a mistake in test.cxxrandom_seed
2022-04-30 21:46:47 -07:00
lethosor d1f0edd33b
Apply initial pre-commit config 2022-04-12 14:48:19 -04:00
myk002 54e8761aa0 capture fortifications and engravings in blueprint 2022-04-01 12:20:37 -07:00
Josh Cooper ba5710f263 Adds new event type NEW_UNIT_ACTIVE 2022-03-12 11:33:27 -08:00
Josh Cooper 2b8024e62f Updates eventful plugin with new EventManager event JOB_STARTED 2022-03-12 11:33:27 -08:00
myk002 434d072919 implement zone phase for blueprint 2021-10-04 15:32:26 -07:00
myk002 ffe5bad66b implement "track" phase in blueprint
required decoupling phases from modes since now we have two "dig" phases
2021-10-04 12:53:31 -07:00
myk002 c23970f36b add unit tests 2021-09-20 16:10:15 -07:00
myk002 596f72f06b implement --playback-start param and logic 2021-09-20 16:10:15 -07:00
myk002 772e386427 implement --format option for minimal and pretty
pretty is currently equivalent to the previous format, though there will
be changes in the future
2021-09-17 10:57:26 -07:00
myk002 0747f872b0 add --splitby param to blueprint
--splitby=none is the new default, allowing all blueprint phases to be
written to a single file. old behavior of one phase per file is
supported via --splitby=phase.
2021-09-09 09:58:53 -07:00
myk002 8fb456313f
allow only one positional param to be specified 2021-07-30 13:09:20 -07:00
myk002 95fa9f3d7a
use new library functions in dig-now 2021-07-30 13:09:20 -07:00
myk002 71c605afd4
make options configurable and document 2021-07-30 13:09:13 -07:00
myk002 20dbd746a8
fix typo 2021-07-09 21:58:32 -07:00
myk002 aba1750bac
use new argparse functions 2021-07-09 21:58:32 -07:00
myk002 a09f4d9b63
add --cursor and --quiet options to tiletypes-here 2021-07-09 21:58:32 -07:00
myk002 f62ff3ecc0
migrate existing lua code to use new library fns 2021-07-05 15:48:51 -07:00
myk002 367fdbd31c
normalize pathnames and handle dirs as basenames 2021-06-29 14:25:30 -07:00
lethosor 2fc5fbacb5
Merge remote-tracking branch 'myk002/myk_reveal_unhideFlood' into develop 2021-06-19 01:08:05 -04:00
myk002 fb8d6614c7
expose core flood unhide logic to Lua
refactor is a straight copy-paste. this code could really stand some
cleanup (unused vars, unnecessary use of the MapCache layer, forced
allocation of all blocks even if they are not being unhidden, etc.), but
that can come in a later PR.
2021-06-02 14:49:19 -07:00
myk002 1b1b4245c9
report output filenames when creating blueprints
also refactor so we can get this data from gui/blueprint
2021-05-31 15:34:19 -07:00
myk002 1aaed3a6ed
error on invalid phase names 2021-05-21 06:34:28 -07:00
myk002 256ca13668
make short help text more generic 2021-05-14 23:07:44 -07:00
myk002 5a149f44e0
use setHotkeyCmd instead of dfhack.run_script 2021-05-14 23:02:04 -07:00
myk002 816cd5cf27
add unit tests 2021-05-10 21:11:13 -07:00
myk002 cc489db084
add comment to parse_gui_commandline function 2021-05-10 21:11:13 -07:00
myk002 7c7d96b5c1
output args being passed to gui/blueprint 2021-05-10 21:11:13 -07:00
myk002 a7a5a48c7a
first stage of blueprint overhaul
- make depth and name parameters optional
- allow depth to be negative to indicate top-down instead of the
  previous hard-coded bottom-up
- add --cursor for specifying start position (game cursor is not needed
  if this param is specified)
2021-05-10 21:11:10 -07:00
lethosor 257f8dbe00
buildingplan: fix size calculation for constructions
Planning a 4x2 construction with DF's `umkh` keys (i.e. not automaterial's box-select) would previously produce a 5x3 construction instead, for example.
2021-04-01 00:16:54 -04:00
myk002 aac958aa50
add open() wrapper fn and document class methods 2021-03-22 09:38:20 -07:00
myk002 69a2f44020
Lua class wrappers for the xlsxreader plugin API 2021-03-08 15:04:50 -08:00
lethosor 1b2eed7c5e
confirm convict: use visible name to avoid exposing alternate identities
Ref #1593
See also:
https://www.reddit.com/r/dwarffortress/comments/ltzu82/if_i_wasnt_sure_i_found_the_vampire_before/
http://www.bay12forums.com/smf/index.php?topic=164123.msg8253738#msg8253738
2021-02-28 01:01:47 -05:00
Myk Taylor d0fc448a39
add 'enable all' option for buildingplan
This kind of functionality is much more important now than it used to
be since there are so many supported building types.

Also modified the 'Planning Mode' status on the building placement
screen to reflect whether we're in quickfort mode, enable all mode, or
whether just the building type is enabled.

this setting is not persisted (just like quickfort_mode is not
persisted), but it can be set from onMapLoad.init
2021-01-24 09:08:36 -08:00
lethosor d437cfe649
Add test for invalid job types in workflow's job_outputs 2020-12-15 21:36:57 -05:00
lethosor 5d3924a8c0
Remove old jobs from plant_products
Identified by Quietust in #1722
2020-12-14 00:04:53 -05:00
lethosor 123c207d9c
Fix error in material_defs lookups
Changed in dfhack/df-structures@7dfea1f1d4
Fixes #1722
2020-12-14 00:03:29 -05:00
myk002 efdba8b596
add buildingplan.isPlannedBuilding 2020-11-13 10:18:54 -08:00
lethosor 9c13b497bf
Merge remote-tracking branch 'myk002/myk_automaterial_buildingplan_fix' into develop 2020-11-11 23:36:42 -05: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 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
Myk Taylor c1af3e2817 document what happens if no types are allowed 2020-10-26 21:13:11 -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 19a4d1df5a
Merge remote-tracking branch 'myk002/quickfort_buildingplan' into develop 2020-08-17 23:43:05 -04:00
Myk Taylor e4a35514ab document buildingplan Lua API 2020-08-15 23:03:49 -07:00