Commit Graph

529 Commits (1cf3f6223785c79f6acdb8982eaf94a868fe9d9a)

Author SHA1 Message Date
Warmist fc384fd1a2
Update eventful.lua (#2203)
* Update eventful.lua

Had wrong function. Fixes https://github.com/DFHack/dfhack/issues/2202

* Update Lua API.rst

Update docs to add onReactionCompleting and remove outdated info

* Update Lua API.rst

Some more minor doc fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add changelog entry

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-12 07:12:49 -07:00
Myk 77d045488b
Confirmation dialog for removing manager orders (#2163) 2022-05-23 21:17:52 -07:00
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
Myk Taylor 42108a64b9 expose basic buildingplan functionality to Lua 2020-08-12 15:24:32 -07:00
Myk Taylor 17c509a596 update sample code for xlsxreader to use finalize 2020-08-10 09:18:49 -07:00
Myk Taylor 4a04273fae document xlsxreader functions 2020-08-09 09:28:19 -07:00
Myk Taylor a41f7c0998 convert XlsxReader module to xlsxreader plugin 2020-08-09 08:54:42 -07:00
lethosor aee4fcd1a6 Add confirmation for convicting dwarves of crimes
Closes #1593
2020-06-20 12:06:50 -04:00
Alan 2344e60101
Merge pull request #1181 from warmist/twbt_experiments
map-render plugin
2019-08-21 09:33:45 -04:00
Alan a40adf1f86
Merge pull request #1435 from cppcooper/cxxrandom-rel
[Release] cxxrandom v2.0.1
2019-04-16 12:04:40 -04:00
Josh Cooper 9c403f509d [Release] cxxrandom v2.0.1 2019-04-15 16:21:54 -07:00
Warmist 5c1b7030e7 Also rename the plugin lua file 2018-10-12 10:44:56 +03:00
Warmist 41856aef37 Merge remote-tracking branch 'origin_DFHACK/develop' into twbt_experiments 2018-10-12 10:31:37 +03:00
lethosor 1c137f9a35 Fix a few Lua 5.3-related errors
Reported on bay12:
http://www.bay12forums.com/smf/index.php?topic=164123.msg7821831#msg7821831
2018-08-02 14:36:15 -04:00
lethosor 61df5e5286 Merge remote-tracking branch 'KlonZK/patch-1' into develop 2018-07-20 23:16:28 -04:00
KlonZK 29f6131e26
fix custom animation tables
move "local frames" from inside the block to outside.
2018-07-16 10:39:05 +02:00
Pauli 57dd9e944e Fix crafts advanced constraints in workflow
Fixes #1247
2018-07-04 19:10:51 +03:00
lethosor 862fa08ba6 Merge remote-tracking branch 'cppcooper/cxxrandom-rel' into develop 2018-06-20 11:00:43 -04:00
lethosor 5f81cac3b7 dwarfmonitor.lua: use dmerror() consistently 2018-05-21 21:23:52 -04:00
Daniel Brooks d15f87715e update comments 2018-05-08 13:04:14 -07:00
Daniel Brooks 554814920b this allows the blueprint plugin to be called from lua 2018-05-08 11:42:41 -07:00
Josh Cooper bc32d15bea [Release] cxxrandom v2.0
Major Revision
update v2.0
=-=-=-=-=
Native functions(exported to lua):
-GenerateEngine:  returns engine id              (args: seed)
-DestroyEngine:   destroys corresponding engine  (args: rngID)
-NewSeed          re-seeds engine                (args: rngID, seed)
-rollInt          generates random integer       (args: rngID, min, max)
-rollDouble       generates random double        (args: rngID, min, max)
-rollNormal       generates random normal[gaus.] (args: rngID, avg, stddev)
-rollBool         generates random boolean       (args: rngID, chance)
-MakeNumSequence  returns sequence id            (args: start, end)
-AddToSequence    adds a number to the sequence  (args: seqID, num)
-ShuffleSequence  shuffles the number sequence   (args: rngID, seqID)
-NextInSequence   returns the next number in seq.(args: seqID)

Lua plugin functions:
-MakeNewEngine    returns engine id              (args: seed)

Lua plugin classes:
-crng
    methods:
        -init(id, df, dist)     :: constructor
            id                           - Reference ID of engine to use in RNGenerations
            df (optional)                - bool indicating whether to destroy the Engine when the crng object is garbage collected
            dist (optional)              - lua number distribution to use
        -__gc()                 :: destructor
        -changeSeed(seed)       :: alters engine's seed value
        -setNumDistrib(distrib) :: set's the number distribution crng object should use
            distrib                      - number distribution object to use in RNGenerations
        -next()                 :: returns the next number in the distribution
        -shuffle()              :: effectively shuffles the number distribution
-normal_distribution
    methods:
        -init(avg, stddev)      :: constructor
        -next(id)               :: returns next number in the distribution
            id                           - engine ID to pass to native function
-real_distribution
    methods:
        -init(min, max)         :: constructor
        -next(id)               :: returns next number in the distribution
            id                           - engine ID to pass to native function
-int_distribution
    methods:
        -init(min, max)         :: constructor
        -next(id)               :: returns next number in the distribution
            id                           - engine ID to pass to native function
-bool_distribution
    methods:
        -init(min, max)         :: constructor
        -next(id)               :: returns next boolean in the distribution
            id                           - engine ID to pass to native function
-num_sequence
    methods:
        -init(a, b)             :: constructor
        -add(num)               :: adds num to the end of the number sequence
        -shuffle()              :: shuffles the sequence of numbers
        -next()                 :: returns next number in the sequence

Adds missing function exports.

Fixes numerous problems I won't go into
2018-04-29 21:08:44 -07:00
Josh Cooper 23b2d5eba5 Merge branch cxxrandom
Implements helper functions for random number generation.
Implemented using C++11 <random> library.

Exported Lua Functions:
- seedRNG(seed)
- rollInt(min, max)
- rollDouble(min, max)
- rollNormal(mean, std_deviation)
- rollBool(chance_for_true)
- resetIndexRolls(string, array_length)  --String identifies the instance of SimpleNumDistribution to reset
- rollIndex(string, array_length)        --String identifies the instance of SimpleNumDistribution to use
                                         --(Shuffles a vector of indices, Next() increments through then reshuffles when end() is reached)

 On branch cxxrandom-rel
 Changes to be committed:
   modified:   plugins/CMakeLists.txt
   new file:   plugins/cxxrandom.cpp
   new file:   plugins/lua/cxxrandom.lua

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Squashed commit of the following:

commit 3a7ef70d45f3e0c2fe367141dd0349dddaaff60d
Merge: fd9f1982 7aa0608c
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Fri Dec 22 22:17:27 2017 -0800

    Merge remote-tracking branch 'origin/temp' into cxxrandom

commit 7aa0608cb85dcf82686193db7a6e9d1318f5f2a5
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Thu Dec 21 21:43:35 2017 -0800

    Revises cxxrandom plugin

    New functions:
    - seedRNG(ushort seed)
        --lua exported
    - GetDistribContainer()
        --internal singleton
    - RNG()
        --internal singleton

    Summary:
    - Removed class CXXRNG
        --Refactored functions that used CXXRNG

     Changes to be committed:
            modified:   plugins/cxxrandom.cpp

commit b42979818a01c1121eace7b1ac14676f5ad5d8b2
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Wed Dec 20 13:21:49 2017 -0800

    Fixes plugin_init()

    Misread the lines indicated by lethosor to be excluded, had broken the plugin in the process.
     Changes to be committed:
    	modified:   plugins/cxxrandom.cpp

commit 753a00a14d9e6519d299638e014abf30509940af
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Wed Dec 20 12:36:17 2017 -0800

    Cleans up cxxrandom.cpp

    DFHack contributions specifies:
    -spaces instead of tabs, so tabs were converted.
    -C++ headers before dfhack stuff, so it was done

    *Also added author name, creation date, and last updated date.

     Changes to be committed:
    	modified:   plugins/cxxrandom.cpp

commit 498ebe4b8fdccc01ac1f169269f3093c830a8a10
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Tue Dec 19 22:51:58 2017 -0800

    Updates cxxrandom, fixes instance leak

    deleted header
    moved definition to cpp file #lethosor

    fixed singleton instance, no longer a pointer
    commented out dfhack commands, now only init/shutdown and exported lua functions

    	modified:   cxxrandom.cpp
    	deleted:    cxxrandom.h

commit 821044bef2a0201d0d74192e445c7b29766b42a1
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Sun Dec 17 04:01:11 2017 -0800

    Fixes RollIndex and Renames RollNormal

    Renamed the Normal Distribution RNG function to fit the standard.
    Now named RollNormal(m,s)

    Fixed some wonky white space in the lua macro export block.

    Fixed a stupid mistake with the RollIndex output. (it was outputting 0's)

    Updated usage details.

     Changes to be committed:
    	modified:   plugins/cxxrandom.cpp

commit 1536f43d137b6bc55d55759b43bdccf6ff429b33
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Fri Dec 15 08:50:08 2017 -0800

    Fixes/Improves cxxrandom

    Modified return types
    Corrected index distribution code

commit 8629c7e1509522cb0cc4b649914b90d033cb4763
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Thu Dec 14 19:02:29 2017 -0800

    Implements SimpleNumDistribution

    Exported additional functions to lua.
    Functions allow the generation of random 0-N index values.
    Generation promises all unique values [0,N] will be returned once each when generation is run N times.

     On branch cxxrandom
     Changes to be committed:
    	modified:   plugins/cxxrandom.cpp
    	modified:   plugins/cxxrandom.h

commit f035f3d20415790542cf83e5e696261661d911f3
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date:   Wed Dec 13 23:55:39 2017 -0800

    Implements cxxrandom

    cxxrandom was implemented using a singleton.
    This singleton provides an interface for generating uniform numbers, or numbers in a normal distribution, and also booleans(given the probability for the true outcome)
    The singleton interface is wrapped in functions which are exposed for lua usage.

    Integrated into plugins/CMakeLists.txt

     On branch dev
     Changes to be committed:
    	modified:   CMakeLists.txt
    	new file:   cxxrandom.cpp
    	new file:   cxxrandom.h
    	new file:   lua/cxxrandom.lua
2018-04-29 21:08:44 -07:00
lethosor db95796d4c Many build fixes 2018-03-10 16:53:45 -05:00
Warmist e48e2e6534 A twbt utils plugin for misc stuff used in twbt by mifki.
Currently only render map function.
2017-12-31 13:57:37 +02:00
Warmist 620cfcc8bd Fix luasocket receive with byte count
Did not correctly detect when you typed in a number instead of pattern.
2017-08-12 15:42:56 +03:00
lethosor 2d07e5edea Add new "pathable" plugin 2017-07-05 23:54:55 -04:00
lethosor aea76b7ef3 stockflow: make sure that manager order amounts are integers
Fixes #1044
2017-03-18 17:56:06 -04:00
Lethosor ba48afe908 stockflow: Simplify calculation
See #1046

Use math.floor() for now until we can get Lua 5.3 working on Travis
2016-12-16 14:22:00 -05:00
Kelly Kinkade 1419d58b9a stockflow: Use "floor division"
Per suggestion by @dscorbett
2016-12-16 13:04:51 -06:00
Kelly Kinkade 5be77fa63d stockflow: Fix "integer expected" problem in stockflow 2016-12-16 08:09:53 -06:00
Eric Wald 060331de37 Stockflow reaction updates
SpinThread jobs now get the proper material category flag, and metal mechanisms can be ordered.
2016-06-26 19:22:53 -06:00
Eric Wald 3f0857bff3 Incrementing the manager order id properly.
There's a chance that not doing so could lead to a crash, somehow.
2016-05-16 19:48:52 -06:00
Eric Wald 2df41e6bad Clearing the active flag for new stockflow orders.
It's not entirely clear what this flag does when there aren't any conditions on the order, but new manual orders start as Ready instead of Active.
2016-05-15 22:06:20 -06:00
Eric Wald 0b1004f2b8 Notice resizing immediately, instead of on next key press 2016-05-15 09:14:30 -06:00
Eric Wald 6add87b358 Simplifying key strings 2016-05-15 08:58:45 -06:00
Eric Wald 6575f5f412 Removing the quantity limit on stockflow orders. 2016-05-14 23:40:01 -06:00
Eric Wald 3e8d4f9257 New command for clearing the stockpile order.
Shift-Space by default, using the SETUPGAME_SAVE_PROFILE_ABORT key.
2016-05-14 23:35:07 -06:00
Eric Wald 8c7d5366c9 Switching to the new manager order flags 2016-05-14 23:33:38 -06:00
Eric Wald 02e0b9e721 Manager interface now uses the full height.
Its navigation behavior has also changed, and it now has key hints for navigation.
2016-05-14 22:42:49 -06:00
lethosor 2399539990 Merge remote-tracking branches 'warmist/patch-7', 'warmist/patch-8' and 'warmist/patch-9' into develop 2016-04-10 11:58:48 -04:00
Warmist 812f6df272 Fix building-hacks color for auto_gears option
Now it should select the gear color correctly
2016-04-10 16:55:08 +03:00
Warmist c4c452c288 Show sidebar when moving from screen to screen
When both are from lua the old logic failed.
2016-04-10 16:51:58 +03:00
Warmist 29f08cd20d Fix eventful trying to show sidebar
It should not try to do that if e.g. showing buildingitems. Maybe later we will have more valid focus strings (e.g. custom item view for some buildings) but for now just use vanilla (or callback function not a class)
2016-04-10 14:58:03 +03:00
Warmist 9c9f710d5b Fix eventful not showing sidebar sometimes
E.g. when destroying buildings
2016-04-10 14:47:33 +03:00
expwnent b71c1b9e7c Merge pull request #751 from PeridexisErrant/remove-dfusion
Remove dfusion, df2mc, mapexport, dwarfexport
2016-03-13 08:22:07 -04:00
Warmist bc02e2a844 Add auto-gears mode for building hacks for automatic animation and gear positions. 2016-03-13 13:37:36 +02:00
Eric Wald 8ce115646a Updating Stockflow for version 42.06
The manager can now specify each type of craft individually, as well as in general.
There may be a better justification for not allowing pearl and shell scepters, though.
2016-02-23 22:09:26 -07:00
lethosor f4ce45deae Disable confirm note-delete in name entry
Fixes #820
2016-02-11 22:56:33 -05:00
lethosor a9ad2f40f1 Add a location retirement confirmation 2015-12-25 11:18:55 -05:00
Eric Wald 4dc94a565f Adjusting stockflow order numbers where possible.
Loading 0.40 saves in 0.42 results in a different list of reactions.  Fortunately, all but the instruments should still work.
2015-12-18 07:02:29 -07:00
Eric Wald 45625318bb Stockflow reaction list repairs.
Mostly, instruments and their pieces are made through generated custom reactions, instead of as tools.
Depends on df-structures commit e551233 for full potency.
2015-12-17 22:02:30 -07:00
lethosor af92b3ae1f Fix some confirm plugin issues and add a simple configuration UI
- Detect null pointers in trade-related functions
- Fix typo/issues pointed out by @dscorbett
- Reorder includes
2015-11-21 20:58:49 -05:00
lethosor b7dd93b6e8 Implement most of the confirm plugin in Lua
This should make resolving future issues easier, although implementing
new confirmations in lua isn't possible yet (each one requires a line
in confirm.cpp).

This also resolves an issue with note-delete and route-delete, with
dfhack/df-structures@1bc4f61
2015-11-21 19:01:35 -05:00
PeridexisErrant 80e4b8d3df Remove DFusion plugin and script system
It's been four years since meaningful updates, and in that time
alternatives have emerged to almost everything.  Any remaining
functionality to replace is on the issue tracker.

Simpler is better, for users and developers, and removing a legacy
system makes it easier to understand how DFHack works.
2015-11-17 11:13:19 +09:30
expwnent fabcfcd921 Fixed trailing whitespace. 2015-09-21 17:42:30 -04:00
Warmist 80fd4b1365 Some additions and fixes.
Added new functions: select, set(non)blocking, isBlocking.
Set default to non-blocking. Added "would block" to ignored errors.
2015-09-16 09:57:22 +03:00
warmist 7639420455 Update luasocket.lua 2015-08-17 10:07:20 +03:00
Warmist d9c50d677f A lua interface for csockets in a spirit of luasocket 2015-08-15 15:09:12 +03:00
lethosor a90f3c3d67 stockpiles: Restrict characters in filenames when saving
Previously, it was possible to save outside of the stocksettings
directory or fail to save in a nonexistent subdirectory (e.g. when
a stockpile name had slashes in it).

Resolves #621
2015-07-29 14:17:14 -04:00
lethosor 8145a04944 dwarfmonitor: Add mouse cursor widget
Suggested by @ragundo
2015-06-15 13:42:29 -04:00
lethosor 7581bda7d5 Update dwarfmonitor documentation and NEWS 2015-06-13 21:50:15 -04:00
lethosor 93c9a41a3a Reimplement dwarfmonitor widgets in Lua (and improve customizability)
Widget positions and a few other options (e.g. date formats) can be
specified in dfhack-config/dwarfmonitor.json on a per-instance basis.

Related changes:
* Fixed an issue loading JSON files from Lua
* JSON files in dfhack-config (only dwarfmonitor.json currently) are
  no longer copied into the DF directory when building DFHack. This
  keeps developers' personal settings intact, but will require
  copying over changes made to DFHack's copies manually.
* Fixed incorrect config path in dwarfmonitor help
2015-06-13 21:15:43 -04:00
Ross Morgan-Linial 3001053cef Change tabs to spaces. 2015-05-07 21:51:03 -07:00
Ross Morgan-Linial 7aac9a8fb8 Improve workflow handling of plant reactions
Makes workflow understand "seeds of any plant", "thread of any plant",
"drink of any plant", "powder of any plant", and "liquid of any plant"
when counting items.

Changes workflow's handling of the built-in plant reactions to
understand that they always produce plant products, and that they also
produce seeds.

This means that you can set a target for, for example, "powder of any
plant", and workflow will use a milling job to produce that.
2015-05-07 20:49:29 -07:00
Ben Lubar d182b6c1c3 only create the stocksettings directory when it is requested 2015-03-24 17:46:49 -05:00
Eric Wald 23707db1d3 Fixed ballistic arrow head orders 2015-03-15 16:38:59 -06:00
Eric Wald 6bfaa8d35d Better way to handle obsolete job types. 2015-03-15 16:37:35 -06:00
Eric Wald 81c2a6e79f Refactoring a table insert into reaction_entry. 2015-03-15 16:02:29 -06:00
Eric Wald 11d65b4f2d Always clear reactions when loading.
This removes a minor potential for memory leaks.
2015-03-15 15:43:46 -06:00
Eric Wald d18bd3e2a5 Preventing a stockflow error message in Arena mode 2015-03-15 14:08:47 -06:00
lethosor 0b912f54be Fix field name in lua/stockflow.lua
From DFHack/df-structures#39
2015-03-01 17:32:25 -05:00
Warmist e9ab892369 Building hacks changes.
Fixed buildings not consuming correct value of power. Added way to ignore unpowered state. Added setPower/getPower to change how much power building uses on the fly.
2015-02-24 15:37:38 +02:00
lethosor 10cfef0553 Fix whitespace issues 2015-02-14 22:53:06 -05:00
expwnent e5e0d93ef1 Added modtools/reaction-product-trigger. 2015-02-02 02:39:05 -05:00
Casey Link b0e0bbda9b stockpiles: show proper cased names in filter list 2014-12-05 16:53:19 +01:00
Casey Link 52f4cb3fc1 stockpiles: load prompt uses typing + filtering 2014-12-05 14:49:40 +01:00
Casey Link 332566f6a1 stockpiles: disable gui/script when plugin is disabled 2014-12-05 13:27:58 +01:00
Casey Link 7e6066daf2 stockpiles: user friendly error handling
* display errors in the GUI when necessary
* handle older versions of DFHack without the persist module
2014-12-05 12:35:24 +01:00
Casey Link b6118d272c stockpiles: integrate gui plugin into dfhack.init-example 2014-12-05 12:35:24 +01:00
Casey Link 1cde8cffa4 stockpiles: implement GUI controls 2014-12-05 12:35:19 +01:00
expwnent c927f0fa3c Merge remote-tracking branch 'lethosor/patch-5' 2014-09-16 17:25:28 -04:00
Lethosor 1ea1b50790 job_material_category -> dfhack_material_category
Fixes #330 - submitted by @finndibaenn
2014-09-14 11:13:26 -04:00
Eric Wald 83b1317173 Switching stockflow to the internal getStockpileContents.
This should speed it up over checking each space individually, but no longer counts spaces with empty assigned bins and barrels as empty.
2014-09-07 15:07:57 -06:00
Eric Wald 1ce07c063d Canonical way to find the stockpile by id. 2014-09-07 14:55:34 -06:00
Quietust 5c0588dd34 Merge pull request #299 from eswald/stockflow-40
Stockflow Repairs
2014-08-28 14:56:04 -05:00
Eric Wald 632b0b85bd Speeding up the stockpile item count.
kr0pper reports two orders of magnitude speed improvement for check_pile() by using the map tile item cache.
2014-08-23 17:49:03 -06:00
Eric Wald 8495bddc2d Removing an obsolete workaround 2014-08-23 17:46:35 -06:00
Warmist f04b93210a Bug fixing.
Fixes for "tab" in hacked buildings.
2014-08-16 16:58:09 +03:00
Warmist 6868cab1fe Exposed dfhack.jobs.linkIntoWorld. Simplified eventful and gui.dwarfmode for sidebar use/creation. 2014-08-16 16:58:01 +03:00
Eric Wald f5d50adf0d Removing the leaves check for stockpile acceptability.
That item type no longer exists in DF 0.40; such items will now always be considered properly stored by any stockpile they're on.
2014-08-15 21:41:23 -06:00
Eric Wald 2ebebaf62f Deleting old stockflow records.
Once a stockpile has been removed or abandoned, its persistent configuration is obsolete.
2014-08-03 15:07:04 -06:00
Eric Wald 1b1475fb94 Warning about mismatched stockflow entries.
For the most part, mismatches should only happen if the reaction list has changed between world loads, which means either the raw files or the plugin files have been changed.  For now, such entries are ignored, though in some cases it might be possible to recover a new order number by searching through the reaction list.
2014-08-03 15:04:28 -06:00
Eric Wald 2db1c9d722 Moving the global job_types cache into the two functions that use it.
It's mostly an artifact of a misunderstanding, anyway.
2014-08-03 14:57:20 -06:00
Eric Wald 1aafa206bc Localizing a few Lua variables.
It seems like the globals could be localized, too, but I'm not quite sure what that would accomplish.
2014-08-02 18:08:13 -06:00
Eric Wald ad4d545036 Ignoring the removed job types for DF 0.40+
The version check allows the plugin to work with DF 0.34, just in case.
2014-08-02 17:58:36 -06:00
expwnent 81c87d0921 EventManager: INTERACTION event for unit interactions. 2014-07-03 04:55:12 -04:00
expwnent fe875f7c02 Cleaned up eventful.lua.eventType. 2014-06-30 03:16:45 -04:00
expwnent 961d033ade EventManager: unload event for convenience. 2014-06-29 10:03:55 -04:00
expwnent 8e7e87ac73 Added UNIT_ATTACK event to EventManager and exposed it to Lua. 2014-06-28 02:31:34 -04:00
expwnent 7313c18a2a EventManager/eventful: added ON_REPORT event and exposed it to Lua. 2014-06-23 09:15:46 -04:00
Alexander Gavrilov 63254df6dd Fix obvious issues in stockflow.
- Duplicate definition of a function now in uicommon.h
- Assertion failure due to missing core suspend claim.
- Incorrect way of accessing the civ entity.
- Accessing nil objects in the lua module if filter matches nothing.
- Lua module breaking on reload('plugins.stockflow').
2014-06-03 12:57:45 +04:00
Alexander Gavrilov e7292379f7 Merge branch 'stockflow' of git://github.com/eswald/dfhack into develop 2014-06-03 12:13:56 +04:00
Alexander Gavrilov ae8d630cfa Merge remote-tracking branch 'warmist/dev-rendermax' into develop 2014-05-11 15:44:29 +04:00
Eric Wald 144eff4cf2 Clearing the center column.
The official order selection screen has an extra space to the left of the orders on the right-hand side.
2014-05-04 15:36:42 -06:00
Eric Wald 4fc850445d Magic Number Reduction: Display placement constants 2014-05-04 15:28:53 -06:00
Eric Wald 767badbfb9 Magic number reduction: Clothing flags
Bone and shell are used to construct BARRED and SCALED armor/clothing items, for some reason.
2014-05-04 15:13:25 -06:00
Eric Wald bdb22235af Magic number reduction: Job types 2014-05-04 15:02:12 -06:00
Eric Wald 2d5f7e4022 Magic number reduction: Persistent storage
Replaces explicit indices into the ints field of Stockflow persistent storage objects with enumerated values.
2014-05-04 12:55:00 -06:00
Eric Wald 723cfcf28e Attempting to repair an order object leak.
Now frees manager_order objects in the reaction_list when the plugin is disabled or the world unloaded.  However, there may still be orders leaked elsewhere.
2014-05-04 12:35:10 -06:00
Alexander Gavrilov 13584f08c5 Merge remote-tracking branch 'warmist/dev-buildings' into develop 2014-05-04 19:52:01 +04:00
Alexander Gavrilov 63d256c1e9 Adjust siege engine targeting weights.
Stop shooting at leaving caravan guards for one.
2014-04-17 22:10:43 +04:00
Alexander Gavrilov 55cea36c76 Use the new API to produce combat reports for aimed siege engine attacks.
This requires exposing the actual operator unit to lua code.
2014-04-15 19:50:23 +04:00
Eric Wald b9ed7a5cc2 Stockflow plugin v1.0 2014-04-13 15:19:03 -06:00
Warmist eb999cd0ad Another file forgotten 2014-03-07 19:58:27 +02:00
Warmist a52451a97a eventful: added support for custom workshops and a convenience function to interpose side panel generation 2014-03-07 19:41:50 +02:00
Warmist 834350012f building-hacks: added lua convenience function, made impassible tile fix optional. 2014-03-07 19:41:50 +02:00
Warmist 94b5961372 New plugin: building-hacks. Allows workshops to block liquids and consume mechanical power, connect to machines. 2014-03-07 19:41:49 +02:00
expwnent 329741f235 EventManager: added EQUIPMENT_CHANGE event and exposed it to lua. 2013-10-24 19:32:52 -04:00
expwnent e81c060627 Added EVENT_MAX just in case someone wants it. 2013-10-20 15:24:31 -04:00
expwnent 6ef360f4d6 Merge remote-tracking branch 'warmist/dev-EventManager-lua' into 0.34.11-r4 2013-10-20 14:52:40 -04:00
Warmist 0dff26aa23 Added lua interface (in eventful) for EventManager module. 2013-10-20 21:44:07 +03:00
jj 308e7b6820 fix renamed pregnancy_ptr/mystery to pregnancy_genes/caste 2013-08-10 01:57:11 +02:00
Alexander Gavrilov f3e357d161 Fix detection of GET_MATERIAL_FROM_REAGENT results in workflow.
Dereference pointer to strings. Also just return undefined
material instead of skipping the product if it still fails.
2013-04-30 19:42:51 +04:00
Robert Heinrich fd265b37d6 Added lua GUI front-end for autobutcher. 2013-04-24 23:37:05 +12:00
Warmist ab6a993689 friendship.lua: removed debug printing 2013-02-15 20:21:33 +02:00
Warmist bb5d98e895 friendship fixes. 2013-02-15 20:19:55 +02:00
Warmist 1990e2caf7 Small fix to adv site creation, now it's really centered around you 2013-01-07 02:01:59 +02:00
Warmist c22c4d009c Added convenience functions to eventful (see Lua API.rst) 2013-01-03 20:30:51 +02:00
Warmist 08f454cc81 Removed old reactionhooks.lua 2012-12-14 16:41:59 +02:00
Warmist e46d434c25 Missing lua file for eventful. 2012-12-14 16:33:26 +02:00
Warmist ddceabbfb7 Merge branch 'master' of git://github.com/jjyg/dfhack 2012-12-12 18:58:11 +02:00
jj 6bc791d985 follow df-structure rename unit.unknown8 + able_stand_* 2012-12-10 22:50:33 +01:00
Warmist 6c4f163a5e Merge branch 'master' of https://github.com/angavrilov/dfhack
Conflicts:
	NEWS
2012-12-09 14:25:31 +02:00
Kelly Martin 05dce0d2f1 Fix inadvertently prematurely terminated block comment. 2012-11-30 21:24:18 -06:00
Alexander Gavrilov 2cb594ba89 Tweak the workflow lua api: include history in output of listConstraints. 2012-11-30 14:48:05 +04:00
Warmist 57b69da1f0 Merge branch 'master' of https://github.com/angavrilov/dfhack 2012-11-29 12:13:28 +02:00
Warmist 2c9b560872 Made dfusion not stop df on input. 2012-11-28 22:13:28 +02:00
Warmist 2bbcfe912a Site spawner added to adv_tools 2012-11-26 21:04:17 +02:00
Alexander Gavrilov 2953e4c386 Implement a dialog to specify a workflow constraint with all features. 2012-11-17 20:32:39 +04:00
Quietust 55fcb7e3ca One more missed 2012-11-12 08:33:05 -06:00
Alexander Gavrilov c32f85d637 Merge remote-tracking branch 'warmist/master'
Conflicts:
	plugins/Dfusion/include/OutFile.h
2012-11-12 10:50:48 +04:00
Warmist ce8ada4419 More bug fixing 2012-11-11 22:14:00 +02:00
Warmist 3eb852a43b Added cheat commands to companion-order, (including rumrushers) 2012-11-11 21:18:59 +02:00
Alexander Gavrilov d5c31942b5 Add a way to only count locally-made items in workflow. 2012-11-11 15:56:31 +04:00
Warmist 0e4df55364 Merge branch 'master' of https://github.com/angavrilov/dfhack 2012-11-11 12:46:55 +02:00
Warmist 33f674eee2 Removed dfusion lua files. Updated plugins. 2012-11-11 12:33:54 +02:00
Warmist f1d4eac700 Pre-class remove 2012-11-11 11:58:43 +02:00
Alexander Gavrilov eb936c4ce0 Support milking and shearing in workflow. 2012-11-10 17:06:54 +04:00
Warmist 6be65690f7 Merge branch 'master' of https://github.com/angavrilov/dfhack into experimental-dontmerge 2012-11-02 20:29:27 +02:00
Warmist 5295be5fdb More work done. Only bin-plugs left (and docs) 2012-11-02 20:28:08 +02:00
Warmist 296d1cf090 More scripts for dfusion. Only fixes left, and updating bin-plugins (friendship and migrants(??)) 2012-11-02 00:50:20 +02:00
Warmist ba071468dc New way of doing things!
Now using a class for menus, also no (non script) way to use bin-plugins.
2012-11-02 00:28:16 +02:00
Warmist 209d593f21 Another day, another commit. 2012-11-01 16:00:00 +02:00
Alexander Gavrilov 79d2cb1a5c Remove the C++ version of the job output deduction code and switch to lua. 2012-10-25 12:44:23 +04:00
Alexander Gavrilov 8eebfa007c Tweak the workflow gui script to make the UI operate smoother. 2012-10-25 12:15:18 +04:00
Alexander Gavrilov 59ec9b304e Implement adding workflow constraints from gui/workflow. 2012-10-24 21:49:30 +04:00
Alexander Gavrilov 09f8e8e419 Start working on gui for workflow. 2012-10-23 21:42:03 +04:00
Warmist a3f6e9e305 Small error fix 2012-10-21 13:46:12 +03:00
Warmist 86ec66c0fb More work on dfusion. Embark anywhere script separated. 2012-10-21 13:42:55 +03:00
jj 1f7a01d685 follow rename unit.military.squad_index to squad_id in df-structures 2012-10-20 22:35:39 +02:00
Warmist da92fb9a1c Start of dfusion module. Fixed small error in memscan.lua and start of custom embark command. 2012-10-17 21:43:44 +03:00
Alexander Gavrilov ba763b773d New tweaks for the military assign to position screen. 2012-09-28 18:01:17 +04:00
Warmist 0bee8c360e Reaction hooks experimentation. 2012-09-25 10:25:47 +03:00
Alexander Gavrilov f2fde21b10 Implement a slightly more sensible aiming AI in siege engine. 2012-09-17 14:45:22 +04:00
Alexander Gavrilov f06f9af6b8 Throw items from bins around in siege engine, like minecarts do. 2012-09-12 20:57:25 +04:00
Alexander Gavrilov 3a075f4bc7 Trivial siege engine aiming at units, with logic in lua. 2012-09-11 19:17:24 +04:00
Alexander Gavrilov 325e294af2 Start the siege engine plugin with code to highlight obstacles on screen. 2012-09-07 19:54:32 +04:00
Alexander Gavrilov d5ea05ebb8 Implement a pressure plate sensitive to machine power.
When built next to a gearbox, it will monitor its powered state.
2012-09-06 12:37:29 +04:00
Alexander Gavrilov 8d876cc7d9 Support renaming some buildings, and arbitrary units, via gui script. 2012-09-05 21:27:42 +04:00
Alexander Gavrilov 41ad42d0fd Expose the liquids plugin engine to lua, and make a wrapper gui script. 2012-08-25 10:37:03 +04:00
Alexander Gavrilov b992b04f0b Remove stuff that shouldn't be in the core, and expose to lua what's left.
Specifically, any "if (verbose) { Core::printerr("blah") }" kind
of stuff definitely doesn't belong in the common API functions.
Also, ref->getUnit() is very expensive.

On the other hand, checks for crash-inducing conflicts with the
ui should be in the core api, and not in client plugins.
2012-05-20 21:57:45 +04:00
Alexander Gavrilov 4aa6dbdd00 Support sorting items in the trade screens.
Caveat: sorts items in containers independently from the container.
2012-05-18 19:18:49 +04:00
Alexander Gavrilov 16ee049664 Split off the burrows api from Maps and Units. 2012-04-26 12:56:28 +04:00
Alexander Gavrilov 6ab270d129 Retrieve unit noble position info, and use it in getProfessionName. 2012-04-26 12:03:56 +04:00
Alexander Gavrilov 763a301b4f Add a few more lua api functions, documentation, and unit sort orders.
Units::getProfessionName appears to work correctly for
everything except nobles.
2012-04-23 21:30:53 +04:00
Alexander Gavrilov 125cd6622a Support sorting units in many more ui contexts. 2012-04-22 19:22:00 +04:00
Alexander Gavrilov 4af051bab3 Add a few more unit orderings, and a way to reverse direction. 2012-04-21 16:53:17 +04:00
Alexander Gavrilov 3282ac3db2 Add a hotkey command that sorts units in lists using lua comparators. 2012-04-21 15:43:52 +04:00
Alexander Gavrilov cb49c92b99 Allow plugins to export functions to lua with safe reload support.
- To ensure reload safety functions have to be wrapped. Every call
  checks the loaded state and locks a mutex in Plugin. If the plugin
  is unloaded, calling its functions throws a lua error. Therefore,
  plugins may not create closures or export yieldable functions.

- The set of function argument and return types supported by
  LuaWrapper is severely limited when compared to being compiled
  inside the main library.
  Currently supported types: numbers, bool, std::string, df::foo,
  df::foo*, std::vector<bool>, std::vector<df::foo*>.

- To facilitate postponing initialization until after all plugins
  have been loaded, the core sends a SC_CORE_INITIALIZED event.

- As an example, the burrows plugin now exports its functions.
2012-04-14 19:44:07 +04:00