Commit Graph

3577 Commits (cd7fe8a213b20ac8a05ce631fadd078a16f90a1d)

Author SHA1 Message Date
myk002 048b20ac45
no help entries for non-enableable plugins 2022-07-20 13:34:29 -07:00
myk002 0dd153cc0d
ensure we pick up the plugin help entry
even when it has a command and that command is not equal to the plugin
name
2022-07-20 12:34:40 -07:00
myk002 954e246140
reformat builtins and properly read tags 2022-07-19 23:01:25 -07:00
myk002 ddcb9b4921
add missing 'man' builtin 2022-07-19 22:35:08 -07:00
myk002 e3588cf49c
return entire tag data structure for iterating 2022-07-19 22:13:53 -07:00
DFHack-Urist via GitHub Actions e5961b45b4 Auto-update submodules
library/xml: master
2022-07-19 07:17:31 +00:00
Quietust a20612b0a8 Update structures 2022-07-18 17:50:41 -07:00
myk002 8173f6dd02
Merge remote-tracking branch 'upstream/develop' into docs 2022-07-18 10:59:00 -07:00
myk002 301c8e93a1
move builtin docs to individual files 2022-07-18 10:58:35 -07:00
myk002 e650bd0942
add comment about plugin docs 2022-07-17 17:05:29 -07:00
myk002 7f302888ec
make HotkeyLabels react to clicking
also be better about initializing EditField frame height
2022-07-17 16:04:36 -07:00
myk002 5723b76585
click to correct cursor position on long strings
where the left side of the string has been trimmed
2022-07-17 15:43:58 -07:00
myk002 805456e82b
allow mouse lclick to select a List item 2022-07-16 22:18:38 -07:00
myk002 f65f36ffee
move the cursor in an EditField on mouse lclick 2022-07-16 22:03:39 -07:00
myk002 27425e47f6
support cursor movement in EditFields 2022-07-15 22:22:51 -07:00
myk002 9b340a7630
support submit2 for EditFields 2022-07-15 13:46:01 -07:00
myk002 c9a87511bd
add dfhack history repository and expose to lua 2022-07-15 09:18:27 -07:00
myk002 dd6fbd53b6
add getEntries() to the CommandHistory API
so we can export them to lua
also bump the default history size to 5000 from the paltry 100 we had
2022-07-15 09:07:14 -07:00
myk002 193b9a4004
add missing namespace
which did not cause compiler errors for some reason
2022-07-14 14:08:33 -07:00
myk002 e926e1116e
replace more Core cpp code with calls to helpdb
also document devel/dump-rpc builtin
2022-07-14 13:19:30 -07:00
lethosor f021dd0e0a
Gui::getAnyItem(): add support for viewscreen_treasurelistst 2022-07-12 11:25:16 -04:00
lethosor 4cdb0ff138
Merge branch 'rm-old-modules' into develop 2022-07-12 11:23:10 -04:00
myk002 185f49976c
ensure scripts get their entry type set 2022-07-11 17:24:53 -07:00
myk002 328d839f19
support backtick as a keybinding
and bind it to gui/launcher
2022-07-11 17:23:56 -07:00
myk002 a5da3c18f9
reset scroll position when the text is changed 2022-07-11 17:23:23 -07:00
myk002 4ed15ffcc4
fix parsing of first line as the short_help 2022-07-10 20:48:24 -07:00
myk002 a58b56abc4
don't error out if files cannot be read 2022-07-10 20:19:12 -07:00
Myk e899510b8b
Use helpdb to implement help and ls built-in commands and dfhack.script_help() (#2242)
* use helpdb to implement the help and ls builtins

* use helpdb to implement dfhack.script_help()
2022-07-10 20:17:54 -07:00
Myk 4ad8e7199a
Support builtin commands in helpdb (#2241)
* support builtin commands in helpdb, implement list API, document api
2022-07-10 20:17:52 -07:00
myk002 35a4d19ac9
implement listing functions for helpdb 2022-07-10 20:14:21 -07:00
Myk 64aba7a8a3
Myk rendered help (#2240)
* implement help db

* add initial list of tags

* read tags fr help, read script short desc, filter
2022-07-10 20:14:21 -07:00
Myk 28e15162a5
reorganize init scripts into dfhack-config (#2232)
* reorganize init scripts into dfhack-config

allows player init scripts to build on defaults instead of replace them
this also moves the init scripts out of the main df directory

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

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

* escape asterisks in docs

* remove unneeded dfhack.init file creation for test

* write the test init script to the new init dir

* create the init dir before trying to write a file

* rename default init files for clarity

* Update changelog

* Update docs/changelog.txt

Co-authored-by: Alan <lethosor@users.noreply.github.com>

* Try to get buildmaster to work with old branches

* Update changelog

* get keybindings from all init scripts

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

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

* Fix spacing in changelog

* split default loading into its own file

* update docs with new changes

* update help text wording in default init files

* Apply suggestions from code review

Co-authored-by: Alan <lethosor@users.noreply.github.com>

* Alphabetize changelog

* Update onMapLoad.default.init

* Update onMapLoad.init

* Update Core.rst

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2022-07-10 08:54:55 -07:00
Myk e0d37a31ae
Make the manager orders library available by default (#2233)
* move orders out of examples directory

* install orders into library dir

* read orders from new library dir

* update documentation

* update dreamfort references to orders import

* update changelog

* ignore json files in pre-commit
2022-07-06 07:03:29 -07:00
DFHack-Urist via GitHub Actions aec5684897 Auto-update submodules
library/xml: master
scripts: master
2022-07-05 07:17:21 +00:00
lethosor 739871bc0f
Remove Hooks-egg.cpp and related code and configuration options 2022-06-29 23:35:14 -04:00
lethosor 1147add520
Constructions module: remove some old/unused functions/types 2022-06-29 23:35:14 -04:00
lethosor 4c7caa2658
Remove unneeded dependencies on modules/Graphic.h 2022-06-29 23:35:13 -04:00
lethosor 8bb047fcc6
Remove Notes module
Only used in a devel plugin that prints notes, and can be easily replaced
with `ui.waypoints.points`
2022-06-29 23:35:13 -04:00
DFHack-Urist via GitHub Actions 0aa7ec877e Auto-update submodules
library/xml: master
scripts: master
2022-06-29 15:17:13 +00:00
Quietust 8a605e1903 The great de-anon-ification 2022-06-29 07:54:04 -07:00
Timur Kelman 9788a8a22a
Add default selection handler to `materials.ItemTraitsDialog` (#2211)
* add forward compatibility for future `job_item_flags`

* add default selection handler to `materials.ItemTraitsDialog`

* add a call to `error()` in 'unknown'-branch inside `setTrait`

* add `ItemTraitsDialog` improvement description to changelog.txt
2022-06-28 16:27:18 -07:00
Myk ba629b8e0a
manually handle DestroyBuilding jobs (#2209)
* don't delete general refs from jobs that we cancel

though we still disconnect the refs if we can

* get job remove working in all cases

we apparently need to manually handle DestroyBuilding jobs
everything else we should let cancel_job handle

* update changelog
2022-06-21 16:38:04 -07:00
quarque2 f33c9bc881
Update tile-material.lua (#2218)
* Update tile-material.lua

* Update changelog.txt

* Update changelog.txt

* Update changelog.txt

* Update tile-material.lua
2022-06-20 12:38:37 -07:00
myk002 88ae50b9ae
update version and changelog to 0.47.05-r6 2022-06-17 15:42:23 -07:00
Josh Cooper d38ab1d152
Fix UNIT_NEW_ACTIVE events (#2197)
* Updates eventful.lua to use UNIT_NEW_ACTIVE

* Fixes bug #2189

* Revises activeUnits declaration/initialization

* Fixes build error

* Update changelog.txt

* reword changelog entry

* add changelog entry for event name change

Co-authored-by: Myk <myk002@yahoo.com>
2022-06-17 09:34:41 -07:00
Timur Kelman 1a629a26bf
add `ItemTraitsDialog` to materials.lua (#2199)
* add `ItemTraitDialog` to materials.lua

* rename `ItemTraitDialog` to `ItemTraitsDialog` (plural)

* Update changelog.txt
2022-06-12 07:03:04 -07:00
Myk 85d7489b3c
ensure refs are cleaned up when we remove a job (#2184)
* ensure job items are disassociated from the job

when the job is removed. the new df-provided ``cancel_job()`` doesn't do
this for us whereas the old custom implementation did.
ref: #2028

* remove trailing whitespace

* Clean up general refs before removing job

Because the game method doesn't do it itself

* Fix typo in var name

* clean up code

* update changelog
2022-06-11 07:38:22 -07:00
lethosor 62e7303c68
Upgrade pre-commit-hooks to v4.3.0 (+ submodules)
This contains a fix on Windows that checks for the executable bit according to
Git, instead of according to Windows, which reduces false-positive
"check-executables-have-shebangs" failures.
2022-06-08 17:48:14 -04:00
DFHack-Urist via GitHub Actions ec2f2446d2 Auto-update submodules
library/xml: master
scripts: master
2022-06-08 07:18:16 +00:00
Ryan Williams 46438a2af3
Merge branch 'DFHack:develop' into Bumber64-patch-2 2022-06-07 04:21:56 -07:00
Ryan Williams a7267e3c4e
Optimize report deletion 2022-06-07 04:21:48 -07:00
DFHack-Urist via GitHub Actions 40a6fcdd99 Auto-update submodules
library/xml: master
scripts: master
2022-06-07 07:18:05 +00:00
Ryan Williams 5d08e5ae67
More constants; remove extra "using" statements 2022-06-06 01:56:11 -07:00
Ryan Williams ad1a3408e6 Hopefully fix submodules 2022-06-06 01:41:17 -07:00
DFHack-Urist via GitHub Actions 7b2cb8f9a6 Auto-update submodules
library/xml: master
2022-06-05 07:16:27 +00:00
Ryan Williams ce36abce47
Fixes 2022-06-04 15:46:02 -07:00
Ryan Williams ae4446610b
Update Gui.cpp 2022-06-04 15:36:50 -07:00
Ryan Williams 16b5cade00
Add constants, update old fns
Add MAX_REPORTS_SIZE, RECENT_REPORT_TICKS

Remove redundant "using df::global::world" inside fns

Update `makeAnnouncement`:
Use `word_wrap`, `pauseRecenter`, and utility fn `delete_old_reports`
Handle repeat announcements
Insert sorted into ``world->status.announcements``

Update `addCombatReportAuto`: Use utility fn `recent_report`

Update `showPopupAnnouncement`: Delete old popups at end of fn

Update `getDwarfmodeViewDims_default`: Check for ui_sidebar_mode::Default and ArenaWeather
2022-06-04 15:23:57 -07:00
Ryan Williams 23e85a0d24 Fetch and merge 2022-06-04 12:17:28 -07:00
Ryan Williams b0b601cf0f
Remove recenterViewscreen, update revealInDwarfmodeMap 2022-06-04 11:59:04 -07:00
DFHack-Urist via GitHub Actions f290b1c804 Auto-update submodules
library/xml: master
scripts: master
2022-06-04 07:16:44 +00:00
DFHack-Urist via GitHub Actions f5d3b9f699 Auto-update submodules
library/xml: master
scripts: master
2022-06-02 04:51:00 +00:00
Myk 89d3d45e87
Allow EditField widgets to manage their own activation and keyboard focus (#2147)
* use new focus subsystem in widgets.EditField

* always eat the enter key if we have an on_submit

* add modal attribute

* give EditFields a default height of 1

so they can be autoarranged
2022-06-01 21:48:21 -07:00
Myk ad2d9cad03
[lua] implement keyboard focus subsystem (#2160)
* implement keyboard focus subsystem

* Fix error in focus group combining

* documentation for the inputToSubviews decision

* modify unit tests to catch that last bug
2022-06-01 17:42:13 -07:00
Ryan Williams bc0def4342
MiscUtils word_wrap: Add option to trim only leading whitespace after wrapping (#2169)
* Update changelog.txt
2022-05-30 22:58:46 -04:00
Ryan Williams b1e118384e Update Maps.cpp 2022-05-30 16:26:30 -07:00
Ryan Williams 574728ac5c
Move add_proper_report up with other utility fns 2022-05-30 15:04:43 -07:00
Ryan Williams 0ff0d272b5
use static instead of anon namespace; suggested changes 2022-05-30 13:51:24 -07:00
Ryan Williams 1c3ea000e1
Trim trailing whitespace 2022-05-28 15:56:49 -07:00
Ryan Williams 249ed2888f
Fix scope issue 2022-05-28 13:28:10 -07:00
Ryan Williams e613085b0e
remove whitespace 2022-05-28 12:39:49 -07:00
Ryan Williams 2b29431806
More fixes
* Use word_wrap()

* add_proper_report utility fn; have addCombatReportAuto use this

* Update Lua API.rst

* Update Gui.cpp
2022-05-28 12:35:49 -07:00
myk002 ea7fe2b926
account for scroll bars when sizing message boxes 2022-05-27 15:38:13 -07:00
Timur Kelman 07f54deb0b
fix wrong `Label.frame_body.x2` value (#2134)
* fix wrong `Label.frame_body.x2` value

`update_scroll_inset` might change `frame_inset`, i.e. we need to `computeFrame` with the new values.

* add tests for Label

* add missing `local`, remove code in comments

* move `TestFramedScreen` outside test functions
2022-05-27 15:25:17 -07:00
lethosor ca10cbc9e6
Merge remote-tracking branch 'lethosor/mock-observe-func' into develop 2022-05-27 01:46:24 -04:00
lethosor 888c531774
Add mock.observe_func(), improve mock.lua documentation
observe_func() is similar to func() but passes through all calls to a specified
function.
2022-05-27 00:33:44 -04:00
DFHack-Urist via GitHub Actions 56b301164f Auto-update submodules
library/xml: master
scripts: master
2022-05-25 07:18:15 +00:00
Ryan Williams 4b21e7afb4
Remove parseReportString from API (now utility fn)
Implementations using `word_wrap()` are commented out pending changes to that function.
2022-05-24 03:52:33 -07:00
myk002 18628ff5b8 make key_sep more configurable
and add more configuration to HotkeyLabel and EditField to take
advantage of it
2022-05-18 16:46:33 -07:00
myk002 53609db1f9 let CycleHotkeyLabels take numeric initial_options
even if all of the option values are non-numeric
2022-05-18 15:39:52 -07:00
DFHack-Urist via GitHub Actions 47b87a5ac1 Auto-update submodules
library/xml: master
2022-05-17 07:18:04 +00:00
Ryan Williams ce34ac8f33
Use debugfilter; remove redundant changelog entries 2022-05-16 18:41:47 -07:00
Ryan Williams 785fe9aa3a fix "info" level described as "error" level 2022-05-14 05:56:57 -07:00
Myk 8f6522899b
Upgrade jsoncpp to 1.9.5 (#2144)
* test jsoncpp upgrade

* use new json library target name

* don't remap the output dirs

* undo warnings at the source

* set new defaults for jsoncpp

* fix typo in new options

* fix signed comparison mismatch warning

* address random(?) compile failures

saying our std::atomic is not initialized in Debug.cpp
2022-05-13 13:52:43 -07:00
DFHack-Urist via GitHub Actions bf8eaef6bc Auto-update submodules
library/xml: master
plugins/isoworld: master
depends/libexpat: dfhack
depends/jsoncpp-sub: dfhack
2022-05-12 05:21:01 +00:00
DFHack-Urist via GitHub Actions 15a11d1a39 Auto-update submodules
library/xml: master
scripts: master
2022-05-10 07:22:46 +00:00
Tim Siegel 55e4008925
MiscUtils: teach word_wrap() to optionally preserve whitespace 2022-05-09 13:42:11 -04:00
Ryan Williams 14afcc2b0a
Merge branch 'develop' into Bumber64-patch-2 2022-05-05 22:58:23 -07:00
myk002 585888c2d3
update version, changelog, modules for 0.47.05-r5 2022-05-04 17:21:31 -07:00
DFHack-Urist via GitHub Actions d4ba946d2b Auto-update submodules
library/xml: master
scripts: master
2022-05-03 07:18:10 +00:00
Ryan Williams 74499ad64a
Use to_string on integer 2022-05-03 00:09:34 -07:00
Ryan Williams 5be0fe2a44
Fix issues, update changelog and docs
Initialize variables in LuaApi.cpp, solve changelog conflicts, hyperlink and escape char info in docs
2022-05-02 23:52:47 -07:00
Ryan Williams 621ccef996
Merge branch 'develop' into Bumber64-patch-2 2022-05-01 23:42:21 -07:00
Ryan Williams f565de88e8
Fix stuff (#4)
* Update Lua API.rst

* Update Gui.h

* Update Gui.cpp

* Update LuaApi.cpp
2022-05-01 22:53:53 -07:00
DFHack-Urist via GitHub Actions 5f1d2a08e4 Auto-update submodules
library/xml: master
scripts: master
2022-05-01 13:33:50 +00:00
DFHack-Urist via GitHub Actions 7120988044 Auto-update submodules
library/xml: master
scripts: master
2022-05-01 07:17:58 +00:00
DFHack-Urist via GitHub Actions 9643246b18 Auto-update submodules
library/xml: master
2022-04-30 19:20:07 +00:00
DFHack-Urist via GitHub Actions e9a2de08cd Auto-update submodules
library/xml: master
2022-04-30 07:17:43 +00:00
Myk e2fb15a3a5
add dwarfmode.MenuOverlay:renderMapOverlay() (#2119)
* add dwarfmode.MenuOverlay:renderMapOverlay()

* ensure we move with the viewport when bounds_rect is nil
2022-04-29 20:32:22 -07:00
Myk 24dd4d8ac0
Update init files (#2117)
* update example init files

replace onLoad.init-example with documentation on how to create scripts that run on world/map load
it was confusing to show it being loaded with sc-script since it gets autorun anyway if it is just named properly

* update changelog

* add quickfort keybinding

* move standard tweaks from dreamfort init to main
2022-04-29 20:24:09 -07:00
myk002 e603fee3ce
move sidebar mode management code to init
from onAboutToShow(). this allows the frames to be calculated correctly
during widget instantiation. otherwise widgets can end up with -1 width
2022-04-29 12:10:05 -07:00
myk002 af47434f52
protect against 0 width in string:wrap() 2022-04-29 11:29:19 -07:00
Tachytaenius b9c36c1e63
Added custom-raw-tokens utility (#2038)
* Added (chain) for [CHAIN_METAL_TEXT] armours in gui/materials.lua used by gui/create-item-- again (oops)

* Added customRawData utility

* Oops, whitespace

* Revised rawStringsFieldNames

* Dialed down on lua trickery and fixed wrongly formatted changelog entry

* Fixed changelog in wrong place and made customRawData a proper module

* Fixed not caching not-present tags, revised examples and fixed error

* Fixed whitespace. Changing settings in editor!

* customRawData docs

* Added getCreatureTag for respecting caste tags, "fixed" bizarre caching error (quotes because I don't even know what was causing it) and updated docs

* Added line limiting for docs, I guess

* Added missing string convert argument

* docs indent fix, code block fix, and revision

* Major revision

* gdi, docs error

* Another? But... huh.

* ...

* Made requested changes

* Whoops

* Rearrange docs lines

* Followed example, should fix linter issues

* fix typo. linted offline this time......

* Make it so that last instance of tag is what is read from

* Added requested change

* eventful key change

* i to lenArgs

* change eventful key

* add test for broken caste selection

* Major redesign

* tags --> tokens

* Added plant growth behaviour and did some requested changes

* More error handling

* fix docs

* Added basic error suppression

* Docs clarification.

* Docs registering example and fix error

* Strip errors on frame after onWorldLoad, not on map load

* Revert "Strip errors on frame after onWorldLoad, not on map load"

This reverts commit e20a0ef8d3743f79d961077f46910b77b16f36b9.

* Revert "Docs registering example and fix error"

This reverts commit 9c848c54c3f84e0ecc1dc421137c8a8b4a52280d.

* Revert "Docs clarification."

This reverts commit 6b4b6a1aa40c50398504f37ecf1ff0f93d6459b1.

* Revert "Added basic error suppression"

This reverts commit d11cb1438cf1e56ff700469e944f0b9af64651d7.

* Use more eventful key more consistent with other files

* use onStateChange instead of eventful and remove redundant utils require

* Code review stuff

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

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

* Update docs/Lua API.rst

committing a suggestion

Co-authored-by: Alan <lethosor@users.noreply.github.com>

* Prepend examples with DFHACK_

* Remove unused parameters

* Use new ensure_key global

* Named a couple of unnamed arguments (untested)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2022-04-29 08:39:59 -07:00
Timur Kelman f08a268e8a
add scroll icons to Label widget (#2101)
* WIP: add scroll icons to Label widget

It's an opt-out. The icons are rendered in the right-most column of the 1st and last row. They are only rendered when text can actually be scrolled in the corresponding direction.

WIP: Currently, the icons might overlay text characters, there is no mechanism preventing it

* gui.lua: expose the `parse_inset()` function

* refactor Label's scroll icon code

* since `render_scroll_icons` only works with a label, it's now a class function
* `update_scroll_inset` ensures `frame_inset.r` or `.l` is at least 1, according to `show_scroll_icons`
* `show_scroll_icons` has 4 possible values: `false` for no icons, `left` for icons on the first column on the left (also ensuring `frame_inset.l >= 1`), `right` - last column on the right, `DEFAULT_NIL` - same as `right` if text height greater than `frame_body.height`, else same as `false`.

* make `render_scroll_icons` always draw icons

The check now happens in `onRenderFrame`

* draw frame's background

calling `Label.super.onRenderFrame(self, dc, rect)` makes frame's background invisible for some reason

* remove trailing spaces

* fix scroll icons placed far above/below text

 With `Label.frame_inset = 1` the text could be vertically centered with plenty of space below and above,
but not all rendered. Before this change, the scroll icons would be at the very top and bottom of the frame
instead of near the first and last rendered text line.

* always `update_scroll_inset` to react to resized window

* draw scroll icons next to text

* update `Lua API.rst` with new `Label` parameters

* move comment separator up

This way every scroll related parameter is in one group

* list default values for new parameters in docs

* add missing description of `Label.scroll_keys`
2022-04-29 06:55:08 -07:00
myk002 dcadde38d7 add new global function: ensure_key 2022-04-27 17:35:49 -07:00
myk002 6ad362d698
return a reference to the created dialogs 2022-04-27 11:51:46 -07:00
Ryan Williams b56d9520e9
Fix trailing whitespace 2022-04-25 00:39:05 -07:00
Ryan Williams 861a0ee85e
Update LuaApi.cpp
Wrappers for autoDFAnnouncement, pauseRecenter, and recenterViewscreen.
2022-04-24 22:52:31 -07:00
Ryan Williams c7be54dac0
Update Gui.cpp
Add reverse engineered functions: parseReportString, autoDFAnnouncement, recenterViewscreen, and pauseRecenter.
Add versions of autoDFAnnouncement that don't take a report_init struct and that log unprinted announcements.
Add utility functions: recent_report, recent_report_any, delete_old_reports, and check_repeat_report.
2022-04-24 22:45:26 -07:00
Ryan Williams 89ed9950c7
Update Gui.h
Added parseReportString, which parses a string using '&' as a control character (&r as newline, && as &) and cuts to a certain length w/o splitting words.

Added autoDFAnnouncement, which takes a report_init and a string, and handles them like DF does.
Added variants to log unprinted announcements and to build the report_init from arguments.

Added pauseRecenter, which recenters on an xyz coord (item style, not unit) and optionally pauses, while respecting pause_zoom_no_interface_ms.
Added variant that takes a pos.

Added recenterViewscreen, which recenters on an xyz coord using a report zoom style (item, unit, generic. revealInDwarfmodeMap calls "unit" style "center". Generic style ignores coords and just enforces valid view bounds.)
Added variants that take pos or use current cursor coords.
2022-04-24 22:32:41 -07:00
myk002 ed5523152c
factor text wrapping out of TooltipLabel into WrappedLabel 2022-04-22 09:53:10 -07:00
myk002 809f9316fd
make frame inset configurable for ListBox list 2022-04-22 08:30:53 -07:00
Josh Cooper 9c9a7ef99a Adds consistent interface signatures for Maps module 2022-04-21 19:40:58 -07:00
DFHack-Urist via GitHub Actions 62b02c2367 Auto-update submodules
library/xml: master
2022-04-19 07:17:48 +00:00
Josh Cooper 251f4f92c8 Fixes build errors 2022-04-18 23:53:23 -07:00
Josh Cooper ff2bd8d953 Retypes the EventManager's constructions container 2022-04-18 23:53:23 -07:00
Josh Cooper d6b2629cfc Adds hash functions and operator overloads for event data structures 2022-04-18 23:53:23 -07:00
Josh Cooper 64b7de0339 Revises getVerb signature 2022-04-18 22:46:38 -07:00
Josh Cooper 018d189494 Simplifies report index safety 2022-04-18 22:46:38 -07:00
Josh Cooper 1f972d6c1c Implements clang-tidy suggestions 2022-04-18 22:46:38 -07:00
myk002 07761e1d5d add some more handy widgets to the library
TooltipLabel
HotkeyLabel
CycleHotkeyLabel
ToggleHotkeyLabel
2022-04-18 17:37:11 -07:00
Timur Kelman cb123e5076
default unset `frame_inset` values to 0 (#2100)
* default unset `frame_inset` values to 0

This change allows writing `frame_inset = {r=1}` instead of `frame_inset = {l=0, r=1, t=0, b=0}`
2022-04-16 08:17:35 -07:00
Josh Cooper 9bf9a79a11
EventManager/Eventful - Generate event arrays (#2097)
* Replaces EventManager.cpp's event array with an auto-gen one

* Replaces eventful.cpp's event array with auto-gen one
2022-04-14 21:47:25 -07:00
lethosor 0f464b13b3
Merge remote-tracking branch 'lethosor/pre-commit' into develop 2022-04-12 21:17:15 -04:00
lethosor d1f0edd33b
Apply initial pre-commit config 2022-04-12 14:48:19 -04:00
DFHack-Urist via GitHub Actions f3386d0621 Auto-update submodules
library/xml: master
scripts: master
2022-04-12 07:18:03 +00:00
Myk fd1ee233a2
automatically manage sidebar modes in MenuOverlay (#2083) 2022-04-11 20:58:54 -07:00
Myk 10f22ecc27
add ResizingPanel class and autolayout for Panels (#2086)
* add autolayout for Panels and new ResizingPanel
2022-04-11 18:25:00 -07:00
Myk e6299700bf
Handle punctuation in FilteredList filter matching (#2085)
* allow punctuation to be typed into a filter

and allow the filter to match keys with punctuation
2022-04-11 18:22:31 -07:00
myk002 4a383b1c84 handle number-indexed lua maps in safe_index 2022-04-11 18:02:57 -07:00
Myk 4f9608da13
Document and update argparse module (#2089)
also add unit tests and use new string fns in processArgs and allow it to recognize parameters with two dashes instead of just one
2022-04-11 16:16:55 -07:00
Myk 9a8fd12785
ensure ListBoxes always have enough height (#2084)
so they can always display an error message if the filter doesn't match anything
2022-04-11 16:15:50 -07:00
Myk 96b5b4420b
Add string:escape_pattern() utility function (#2082)
* add string:escape_pattern() to dfhack.lua

stolen from devel/query.lua. will migrate scripts to use the common implementation later
2022-04-10 21:18:01 -07:00
DFHack-Urist via GitHub Actions 39f5084902 Auto-update submodules
library/xml: master
scripts: master
2022-04-07 07:17:48 +00:00
DFHack-Urist via GitHub Actions b313b31879 Auto-update submodules
library/xml: master
2022-04-03 07:16:42 +00:00
DFHack-Urist via GitHub Actions 8b09e9bbf9 Auto-update submodules
library/xml: master
2022-03-31 07:17:20 +00:00
Alan ec0941da2f
git-describe: fail earlier if git fails to run or doesn't exist (#2061)
In cases where the cached `GIT_EXECUTABLE` does not exist, `git-describe.cmake`
would fail silently, resulting in a `git-describe.h` with missing definitions
that caused `DFHackVersion.cpp` to fail to compile.

This change produces a more descriptive error earlier in the build process.
2022-03-30 14:49:18 -07:00
Myk 257e7a3dfd
[core] Debug logging facelift (#2060)
* route 'Loading script...' messages through the debug logging framework
  * they are now controllable via debugfilter. to turn off, add this to your dfhack.init file: debugfilter set Warning core script
* clarify debug logging docs
* prevent DEBUG messages from being compiled out of the binary
* recolor INFO messages so they blend into existing console output
* add configuration interface for log message header elements so they are individually configurable. all default to off
2022-03-30 14:46:09 -07:00
Myk 2df6980237
fix crash in eventful due to misaligned fn map (#2059)
also add warnings in eventful and EventManager to prompt devs to keep them in sync
2022-03-29 12:51:21 -07:00
Josh Cooper 69ca0d8a28
Improves support for dfhack as a sub-project (#2058)
Replaces CMAKE_SOURCE_DIR with dfhack_SOURCE_DIR so it can be included in other cmake projects that have a different top-level CMAKE_SOURCE_DIR
2022-03-29 10:28:52 -07:00
Josh Cooper b18eff9ce2
Revert EventManager to previous behavior, but keep new events
Fixes #2031
2022-03-29 09:42:24 -07:00
myk002 db5e7d55c1 fix guidm.enterSidebarMode(DesignateMine)
it would end up in DesignateChopTrees if you happened to be looking at
the surface z-level.
2022-03-28 16:57:24 -07:00
DFHack-Urist via GitHub Actions bbea31db34 Auto-update submodules
library/xml: master
2022-03-26 07:16:35 +00:00
Tachytaenius 19c0a4fe06
Added (chain) for [CHAIN_METAL_TEXT] armours in library/gui/materials.lua used by the gui/create-item script (#2037) 2022-03-19 15:32:16 -07:00
Ryan Williams 88b403ec7a
Add functions reverse-engineered from ambushing unit code (#1992)
* Add functions reverse-engineered from ambushing unit code

* Fix whitespace

* Fix debug_showambush check

* Remove getOuterContainerRef from Lua API

Don't think this works properly without allocating a new specific_ref. More trouble that it's worth.

* Fixed tile visibility check

* I don't think gamemode or gametype are ever NULL

* Minor tweaks to documentation

* Reimplement getOuterContainerRef for Lua; fix some comments

* Update Units.cpp and changelog

* Update Units.cpp
* Update changelog.txt
2022-03-13 17:19:35 -07:00
DFHack-Urist via GitHub Actions 8a4ddacff3 Auto-update submodules
library/xml: master
scripts: master
2022-03-13 07:15:55 +00:00
Kelly Kinkade 3d4c96de56 update Job.cpp to use the DF-provided job cancel method
use DF's provided job cancel function instead of the hackadoo workaround we used to use
2022-03-12 15:37:33 -08:00
Quietust aa1bc3fe52 Cleanup Kitchen module (and the seedwatch plugin which uses it) 2022-03-12 12:04:34 -08:00
Josh Cooper 3f05859780 Revises manageJobStartedEvent, and adds comments 2022-03-12 11:33:27 -08:00
Josh Cooper c8e7869375 Fixes some build errors 2022-03-12 11:33:27 -08:00
Josh Cooper 524f1670ed Fixes missing namespace 2022-03-12 11:33:27 -08:00
Josh Cooper ba5710f263 Adds new event type NEW_UNIT_ACTIVE 2022-03-12 11:33:27 -08:00
Josh Cooper 6ace4b2cf8 Fixes mistake in EventManager::manageTickEvent 2022-03-12 11:33:27 -08:00
Josh Cooper b8ad0131ea Modifies EventManager::registerTick to retain old behaviour of re-registering tick events 2022-03-12 11:33:27 -08:00
Josh Cooper fb51e2d8b5 Adds comments to members of EventHandler 2022-03-12 11:33:27 -08:00
Josh Cooper 1107c03b86 Modifies EventManager unit loops 2022-03-12 11:33:27 -08:00
Josh Cooper c550a6caf0 Updates EventManager job loops 2022-03-12 11:33:27 -08:00
Josh Cooper 07ffa0b8da Fixes bug in manageJobStartedEvent 2022-03-12 11:33:27 -08:00
Josh Cooper 24255d3195 Adds event type JOB_STARTED 2022-03-12 11:33:27 -08:00
Josh Cooper 48444afbd5 Fixes issue in manageJobCompletedEvent 2022-03-12 11:33:27 -08:00
Josh Cooper 3e72d549d1 Switches iterators to pre-increment instead of post for EventManager
My understanding is that iterators (.begin()/end()) are slightly faster with
pre-increment instead of post. Something about avoiding a copy if I recall correctly.
I replaced all `([:alpha:]+)\+\+` with `++$1` so non-iterators were switched as well - luckily there is no impact to pre/post aside from with iterators.
2022-03-12 11:33:27 -08:00
Josh Cooper f5ced46608 Refactors EventManager
- handler freq now works on an individual handler basis (set to 0 to fire as frequently as possible)
- tick events no longer need to be re-registered after every eventful tick
2022-03-12 11:33:27 -08:00
Josh Cooper 12df6d14e9 Improves documentation for plugin writing 2022-03-12 11:33:27 -08:00
myk002 cf54b84fd6 Bump to 0.47.05-r4 2022-03-09 14:27:20 -08:00
myk002 31397af99b cache civzones so lookup is O(1) instead of O(N) 2022-02-26 15:32:25 -08:00
myk002 a7085ea36b report to the console and stderr when we run inits 2022-02-25 12:59:38 -08:00
myk002 faa2410058 fix typos in argparse 2022-02-18 14:54:45 -08:00
myk002 e531346968 make a (shallow) copy of table params
this improves introspection capabilities since the table is snapshotted
at the time of the mock call
2022-02-18 13:33:08 -08:00
DFHack-Urist via GitHub Actions e1e3c6f7ac Auto-update submodules
library/xml: master
2021-10-29 07:16:44 +00:00
myk002 42ae45dd5f support designate for enterSidebarMode 2021-10-02 09:26:32 -07:00
DFHack-Urist via GitHub Actions b51d7cc80d Auto-update submodules
library/xml: master
2021-09-28 07:15:58 +00:00
myk002 ecdfca89d1 support nil to indicate no short param name 2021-09-25 22:00:49 -07:00
myk002 fc556c9e5d implement non-alias long form params
now long form parameters can exist by themselves without being an alias
for a required equivalent short form param
2021-09-25 22:00:49 -07:00
lethosor 17de88e839
Fix some warnings on macOS 2021-09-07 11:58:44 -04:00
lethosor e7754ea890
Enable -Wunused-variable and fix most errors 2021-09-07 01:16:21 -04:00
lethosor 1295633722
Bump to 0.47.05-r3 2021-09-04 14:00:31 -04:00
DFHack-Urist via GitHub Actions afca336679 Auto-update submodules
library/xml: master
scripts: master
2021-09-03 07:15:42 +00:00
DFHack-Urist via GitHub Actions b509a0b571 Auto-update submodules
library/xml: master
2021-09-02 07:20:39 +00:00
lethosor d5be63823d
Merge remote-tracking branch 'TymurGubayev/patch-1' into develop 2021-08-31 00:55:36 -04:00
lethosor 186eab8ab8
Update xml 2021-08-27 01:03:25 -04:00
DFHack-Urist via GitHub Actions 61cdc24e4a Auto-update submodules
library/xml: master
scripts: master
2021-08-25 07:18:36 +00:00
myk002 691e54dfc6
rename expect.find to expect.str_find 2021-08-24 21:06:12 -07:00
myk002 b2f44f00f1
add pattern matching expect.find() for unit tests
settled on `find()` since the string method of the same name has the
same semantics. other options: `str_find()` since it fails on non-string
or `match()` (but that might imply that the pattern needs to match the
entire string).
2021-08-23 22:59:30 -07:00
lethosor 10db894d99
Merge remote-tracking branch 'myk002/myk_printall_nontable' into develop 2021-08-21 22:51:35 -04:00
lethosor d4e40b260e
Merge remote-tracking branches 'TymurGubayev/patch-2' and 'TymurGubayev/patch-3' into develop 2021-08-21 11:30:36 -04:00
Timur Kelman ca8d89df5a
alt_getopt.lua: allow `?` as an option
This makes it possible to call `script -?`
2021-08-21 13:39:10 +02:00
Timur Kelman bd423ca47c
argparse.lua: `hasArgument` in a comment refers to `hasArg` everywhere else 2021-08-21 13:27:09 +02:00
myk002 86b2329b7f
fix hardcoded call to pairs, add test 2021-08-20 22:55:07 -07:00
myk002 d9c6c2dde3
add safe_pairs, update unit tests 2021-08-19 21:57:16 -07:00
myk002 6d0f7e40a9
be silent if iteration fails for printall 2021-08-19 21:57:16 -07:00
myk002 3f2795e80a
unit tests first draft 2021-08-19 21:56:44 -07:00
myk002 9fc71ef6e1
printall and printall_ipairs handle all iterables 2021-08-19 21:56:43 -07:00
myk002 4606d5742e
ensure printall, ~, and @ behave in lua 5.3.6 2021-08-19 21:56:41 -07:00
myk002 e9eef31344
refactor list item removal into a library fn 2021-08-19 19:51:25 -07:00
Myk 8b824244ac
Update library/modules/Items.cpp
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2021-08-19 19:21:27 -07:00
myk002 06a85d6f0d
handle projectiles in the Items module 2021-08-19 17:44:13 -07:00
DFHack-Urist via GitHub Actions ef0ddb729e Auto-update submodules
library/xml: master
depends/luacov: dfhack
2021-08-12 02:10:05 +00:00
lethosor e8d9a9d184
Fix out-of-bounds access in memscan.field_offset()
Fixes #1907
2021-08-10 11:26:06 -04:00
myk002 192dfd51ee
clear modstate on window focus
this fixes the issue where the alt modstate was getting stuck on systems
that don't send standard keyup events after alt-tab. for example, in KDE
Plasma (on Gentoo, at least), the keyup event when alt is released after
alt-tab contains an incorrect keycode (NUMLOCK instead of L_ALT), which
was preventing us from correctly clearing the alt modstate.
2021-08-06 07:10:42 -07:00
lethosor d572c6c9dd
Update xml (dfhack/df-structures#434) 2021-08-04 23:21:28 -04:00