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
myk002
5b960b97bc
fix comment for Maps::getSize(); add getTileSize()
2021-07-30 13:09:12 -07:00
Timur Kelman
15d8a0bea2
rename `dismiss_on_submit|2` to `dismiss_on_select|2`
...
to avoid confusion
2021-07-30 17:25:01 +02:00
Timur Kelman
ffecdf3b53
ListBox attributes controlling self:dismiss()
...
`dismiss_on_submit = false` makes it easier to implement toggleable options, where we don't want the list to disappear on selection. Like work order conditions' trait selection.
2021-07-29 19:00:19 +02:00
DFHack-Urist via GitHub Actions
b2054801fa
Auto-update submodules
...
library/xml: master
scripts: master
2021-07-15 07:14:59 +00:00
lethosor
dde589967a
Bump to 0.47.05-r2, update changelog
2021-07-09 21:21:36 -04:00
lethosor
898d4621da
Merge remote-tracking branch 'myk002/myk_view_unit' into develop
2021-07-05 20:42:49 -04:00
myk002
87c7d02e09
support view unit mode for guidm.enterSidebarMode
2021-07-05 16:02:19 -07:00
myk002
17d4be14f3
fix formatting of coords error message
2021-07-05 16:01:07 -07:00
myk002
f62ff3ecc0
migrate existing lua code to use new library fns
2021-07-05 15:48:51 -07:00
lethosor
f33db33c8f
Merge remote-tracking branch 'myk002/myk_force_extents' into develop + add extra changelog note
...
Conflicts:
docs/changelog.txt
2021-07-05 15:52:03 -04:00
lethosor
2f36404da7
Merge remote-tracking branch 'origin/lua_label_input_fix' into develop
2021-07-05 15:42:06 -04:00
lethosor
3e6cecbbc6
Merge remote-tracking branch 'myk002/myk_argparse' into develop
2021-07-05 15:21:59 -04:00
lethosor
fb7560d8bf
Merge remote-tracking branch 'wolfboyft/patch-2' into develop
2021-07-05 11:41:37 -04:00
myk002
0ef5134a33
add optional coordinate validation to coords
2021-07-04 07:32:29 -07:00
myk002
56a1c8b4d5
coordinates can be 0
2021-07-03 16:26:39 -07:00
myk002
3a8f564cd2
forward old processArgs fns to new locations
2021-07-02 23:21:40 -07:00
myk002
9535ff82bb
add argparse library functions
2021-07-02 23:11:17 -07:00
myk002
36b2d05ff6
add dfhack string functions and tests
...
added string:split
added string:trim
added a default value for wrap width
added function comments
added tests for all string functions (the tests for string:split will be commented out until we remove the competing implementation in gui/load-screen
2021-07-02 13:21:54 -07:00
myk002
eafa6e86f7
add utils.normalizePath()
2021-06-29 12:22:05 -07:00
lethosor
e070f4d9d8
Merge remote-tracking branch 'myk002/myk_sidebar' into develop
2021-06-28 01:03:13 -04:00
lethosor
4945018e92
Merge remote-tracking branch 'myk002/myk_multi_mock' into develop
2021-06-25 01:27:46 -04:00
lethosor
96dd249be0
getAnyPlant: use Maps::getPlantAtTile
...
Followup to #1882
2021-06-25 01:08:58 -04:00
Ryan Williams
5807d6fbfa
Merge branch 'DFHack:develop' into patch-1
2021-06-23 23:08:01 -07:00
Ryan Williams
c5e7a54d97
Rename to getPlantAtTile; remove extra variables
2021-06-23 23:03:22 -07:00
Ryan Williams
c5fb28a13c
Rename getPlantAtCoords to getPlantAtTile
2021-06-23 23:00:30 -07:00
Ryan Williams
818ff7a946
Rename getPlantAtCoords to getPlantAtTile
2021-06-23 22:59:39 -07:00
lethosor
1b167e7898
Also add quotes in expect.ne()
...
Extension of #1886
2021-06-24 01:15:15 -04:00
lethosor
72998cddd5
Merge remote-tracking branch 'myk002/myk_expect_quotes' into develop
2021-06-24 01:11:21 -04:00
myk002
67840c033c
add quotes around printed unequal values
...
so you can see confusing hidden trailing spaces
2021-06-23 14:04:16 -07:00
myk002
5b12c64cba
add new string function: wrap()
...
refactored and improved from the implementation in quickfort's dialog.lua
2021-06-23 13:59:39 -07:00
myk002
000b589e3a
add dwarfmode library function: enterSidebarMode()
...
refactored from quickfort. this common implementation will replace the
now redundant functions in quickfort, gui/mass-remove, and gui/blueprint
2021-06-23 12:29:37 -07:00
Ryan Williams
bc841f595e
Update LuaApi.cpp
2021-06-22 20:05:45 -07:00
Ryan Williams
b64e28253f
Update Maps.cpp
2021-06-22 20:03:18 -07:00
Ryan Williams
d81de5e4c7
Add getPlantAtCoords function to Maps namespace
...
Derived from disassembly of DF code. Returns a pointer to plant struct that owns the tile at position. Useful for finding a tree from one of its branches. Lua API support.
2021-06-22 20:01:10 -07:00
Warmist
b7069a5ebd
Fix label early key detection in scrolling logic
...
Current logic is because @myk002 fixed it so label would allow other widgets control when label(s) are present. However that breaks label key detection for default scroll keys. This can be worked around by setting scrollkeys to empty.
TBH: label is quite complicated and used everwhere so i'm reluctant to touch it and would love for someone to look over if i'm correct.
2021-06-22 11:31:00 +03:00
Tachytaenius
990c153a9a
Show adjective in item prompt
...
Useful for high boot/low boot etc.
2021-06-19 13:59:38 +01:00
lethosor
2fc5fbacb5
Merge remote-tracking branch 'myk002/myk_reveal_unhideFlood' into develop
2021-06-19 01:08:05 -04:00
myk002
b7a970a309
allow mock.func() to return multiple values
2021-06-15 13:16:05 -07:00
myk002
1a016a0ff3
force creation of extents for abstract buildings
2021-06-07 07:02:46 -07:00
myk002
fc860478e4
move fastdwarf's teleport code to Units module
...
and expose in Lua API
2021-06-06 08:48:32 -07: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
lethosor
4f976a5909
Merge remote-tracking branch 'myk002/myk_blueprint' into develop
2021-05-24 23:48:21 -04:00
DFHack-Urist via GitHub Actions
ed290e104a
Auto-update submodules
...
library/xml: master
2021-05-21 07:24:42 +00:00
myk002
aff5c9bf35
add getCursorCoords overload for df::coord
...
and factor out active cursor detection
2021-05-15 12:05:00 -07:00
myk002
59b08e99f6
fix -- handling and required arg detection
2021-05-07 15:21:45 -07:00
myk002
fd735d4b42
treat negative numbers as non-options in getopt
2021-05-07 15:21:45 -07:00
DFHack-Urist via GitHub Actions
27433b7388
Auto-update submodules
...
library/xml: master
2021-05-07 07:20:06 +00:00
DFHack-Urist via GitHub Actions
06612182ec
Auto-update submodules
...
library/xml: master
scripts: master
2021-04-24 07:08:43 +00:00
DFHack-Urist via GitHub Actions
22752f0630
Auto-update submodules
...
library/xml: master
2021-04-23 07:08:50 +00:00
lethosor
ee8e10429d
Add initial implementation of mock.restore()
...
Like mock.patch() but only restores original values instead of also setting
new values initially.
2021-04-16 00:34:46 -04:00
DFHack-Urist via GitHub Actions
792bf14921
Auto-update submodules
...
library/xml: master
2021-04-13 07:08:38 +00:00
lethosor
757736728d
Add a mock.func() helper for mocking functions
2021-04-10 01:22:03 -04:00
lethosor
5424392273
mock.patch(): propagate return values
2021-04-09 00:41:39 -04:00
lethosor
f25b8a0d14
Fix patching value with nil
2021-04-09 00:35:54 -04:00
lethosor
7b2f01d45b
Add initial mock.patch() implementation for tests
2021-04-09 00:32:10 -04:00
DFHack-Urist via GitHub Actions
172821af17
Auto-update submodules
...
library/xml: master
scripts: master
2021-04-07 07:07:27 +00:00
myk002
642d8cbe4b
handle nil values sent to printerr
2021-04-05 01:37:43 -07:00
myk002
13ca7f8c9e
move expect.lua from internal/ to test_util/
2021-04-04 17:37:37 -07:00
myk002
5af1b627cb
add tests, move expect.lua
...
I moved expect.lua from library/lua/test/ to library/lua/internal since
luacov is configured to ignore any file with /test/ in its path
2021-04-04 17:37:36 -07:00
myk002
a6561911c1
error on unmatched printerr output during a test
...
- provides expect,printerr_match for matching printerr output
- fails tests if printerr is called outside the printerr_match wrapper
- changes api of expect.error_match to mirror the new printerr_match api
2021-04-04 17:37:33 -07:00
lethosor
dfb52a2aba
Merge remote-tracking branch 'lethosor/command-prompt-fix-gui-scripts' into develop
...
Conflicts:
docs/changelog.txt
2021-04-02 21:53:14 -04:00
lethosor
8129fdab4e
Merge remote-tracking branch 'myk002/myk_invalidate_scripts' into develop
2021-03-31 00:50:31 -04:00
Ben Lubar
c06d1f8e52
tagged union support for lua ( #1818 )
2021-03-30 15:55:06 -05:00
myk002
4e844f39ae
undo formatting change in script_environment
2021-03-29 12:29:15 -07:00
myk002
54a1e8d98a
move script_environment changes to test.lua
2021-03-29 12:23:53 -07:00
myk002
e4cab1b1c6
load scripts into different namespace for testing
2021-03-29 11:26:28 -07:00
DFHack-Urist via GitHub Actions
badf471434
Auto-update submodules
...
library/xml: master
2021-03-29 07:07:32 +00:00
lethosor
2332009825
Merge remote-tracking branch 'myk002/myk_enable_luacov' into develop
2021-03-28 00:38:36 -04:00
lethosor
5e09fd882d
Fix Painter:viewport()
...
This works because Painter inherits from ViewRect. Unsure how this went unnoticed.
2021-03-27 16:55:48 -04:00
DFHack-Urist via GitHub Actions
d5ba1a3d23
Auto-update submodules
...
library/xml: master
2021-03-27 07:11:38 +00:00
lethosor
dbd35359be
Update xml
2021-03-24 22:07:37 -04:00
lethosor
62776f5568
Move `expect` functions to a separate file
...
This allows tests to test these functions without needing to include the test
wrapper directly (now ci/test.lua, formerly test/main.lua). Hopefully this
location is also more stable, similar to other libraries that are already tested.
2021-03-24 00:48:52 -04:00
lethosor
e9efa6c961
Update xml, fix + improve robustness of unions.lua unit tests
...
- unit_action_fields(): handled primitive union members correctly
- unit_action_type(): added messages to make failures easier to diagnose
- Also removed redundant checks that effectively checked that
`enum.attrs[k] == enum.attrs[v]` - this is out of scope of union tests
2021-03-23 21:24:57 -04:00
DFHack-Urist via GitHub Actions
d5d41cd374
Auto-update submodules
...
library/xml: master
2021-03-22 07:20:39 +00:00
lethosor
59b023c71d
Ensure that command-prompt is dismissed after a command creates a new screen
...
Fixes #1803
Running a command that created a new screen would previously result in a screen
order that looked like this, due to how `Screen::Hide` works:
- DF screen
- `command-prompt` screen (dismissed)
- New screen
The `command-prompt` screen remained on the stack until the new screen was
dismissed, so it would intercept viewscreen vmethod calls intended for the
DF screen.
This change adds a new behavior to `Screen::Hide` that results in this screen
order after running a command:
- DF screen
- New screen
- `command-prompt` screen (dismissed) - DF removes this screen immediately
2021-03-21 20:42:50 -04:00
lethosor
fcb17da223
Update authors ( #1801 ), xml
2021-03-20 19:21:39 -04:00
lethosor
e8f8471af4
Update xml
...
Ref DFHack/df-structures#423
2021-03-12 00:26:02 -05:00
myk002
8fe3dac0b1
only enable luacov for the core context
2021-03-10 23:31:30 -08:00
lethosor
890fd5c746
Merge remote-tracking branch 'myk002/myk_no_test_docstrings' into develop
2021-03-10 00:44:23 -05:00
DFHack-Urist via GitHub Actions
7ea44010e0
Auto-update submodules
...
library/xml: master
2021-03-09 07:15:44 +00:00
myk002
916a10d717
exempt lua test files from docstring requirements
...
and don't display them with 'ls'
2021-03-07 08:52:45 -08:00
myk002
49b34b52f5
update docs
2021-03-07 08:16:25 -08:00
myk002
754baa45b3
remove io overrides
...
they were causing side effects when writing luacov reports
2021-03-07 08:16:24 -08:00
myk002
ba6a02eb59
call luacov.runner.init directly and clean up dbg
2021-03-07 08:16:24 -08:00
myk002
418a8c5d21
propagate luacov debug hook through coroutines
2021-03-07 08:16:24 -08:00
lethosor
032cd64c10
Bump to r1, update submodules and changelog
2021-03-06 13:30:16 -05:00
lethosor
2f629f3b22
Update xml
2021-03-06 12:29:35 -05:00
DFHack-Urist via GitHub Actions
fe175876aa
Auto-update submodules
...
library/xml: master
scripts: master
2021-03-06 07:15:27 +00:00
DFHack-Urist via GitHub Actions
e72125dbff
Auto-update submodules
...
library/xml: master
scripts: master
2021-03-05 07:15:28 +00:00
DFHack-Urist via GitHub Actions
1698a80c49
Auto-update submodules
...
library/xml: master
scripts: master
2021-03-04 07:15:38 +00:00
DFHack-Urist via GitHub Actions
12ad300d64
Auto-update submodules
...
library/xml: master
2021-03-03 07:16:20 +00:00
DFHack-Urist via GitHub Actions
c9545268fa
Auto-update submodules
...
library/xml: master
2021-03-02 07:15:54 +00:00
DFHack-Urist via GitHub Actions
ed3f11a31d
Auto-update submodules
...
library/xml: master
2021-03-01 07:15:58 +00:00
DFHack-Urist via GitHub Actions
3185d4d6cc
Auto-update submodules
...
library/xml: master
2021-02-28 07:15:33 +00:00
DFHack-Urist via GitHub Actions
5affbce13b
Auto-update submodules
...
library/xml: master
2021-02-27 07:15:42 +00:00
lethosor
cb9ed4ff0c
Merge remote-tracking branch 'myk002/myk_manipulator' into develop
...
Conflicts:
docs/changelog.txt
2021-02-25 00:39:01 -05:00
DFHack-Urist via GitHub Actions
29db977bc7
Auto-update submodules
...
library/xml: master
scripts: master
2021-02-23 07:15:29 +00:00
Ben Lubar
f3dd38a038
update structures
2021-02-18 18:18:34 -06:00
myk002
9e17bc938c
only set labor validity for the player civ
2021-02-17 09:16:49 -08:00
Ben Lubar
416fc32cb2
update scripts and structures
2021-02-15 11:49:34 -06:00
Ben Lubar
ef1ac6ff40
update structures
2021-02-13 16:23:01 -06:00
myk002
55743fc43f
Merge remote-tracking branch 'upstream/develop' into myk_manipulator
2021-02-13 07:16:58 -08:00
lethosor
49b6e814db
Bump to beta1, update submodules
2021-02-10 21:08:45 -05:00
Ben Lubar
a051077820
update structures
2021-02-10 18:54:12 -06:00
lethosor
625380a30b
Update submodules
2021-02-09 00:11:59 -05:00
myk002
6819ee9928
make alchemist flag valid for controllable civs
2021-02-05 16:45:39 -08:00
lethosor
06cd0c8437
Make libz.dylib optional on macOS
...
Thurin reports that the path specified does not exist on macOS 11.2, and DFHack links successfully without it.
CMake output from the find_package(ZLib) call in /CMakeLists.txt:
Found ZLIB: /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/lib/libz.tbd (found suitable version "1.2.11", minimum required is "1.1.2")
2021-02-01 23:23:19 -05:00
lethosor
353b8b71f5
Update xml
2021-01-31 13:24:21 -05:00
lethosor
233925ec75
Bump to 0.47.05-alpha0, update xml
2021-01-31 12:10:00 -05:00
lethosor
7e12f3fd3d
Fix off-by-one, adjust changelog, move scroll keys to consistent place
...
Ref #1748
2021-01-30 19:40:15 -05:00
lethosor
8967e98a33
Merge remote-tracking branch 'myk002/myk_scrollable_labels' into develop
2021-01-30 19:33:04 -05:00
lethosor
813a353ec2
Update xml
2021-01-30 18:08:32 -05:00
lethosor
4126585573
Merge remote-tracking branch 'lethosor/lua-runcommand' into develop
2021-01-29 20:27:38 -05:00
lethosor
de6f9183fd
Fix changelog, replace a couple qerror calls with error
...
Ref #1746
2021-01-29 00:04:10 -05:00
lethosor
d4aef78b26
Merge remote-tracking branch 'myk002/myk_getopt' into develop
2021-01-28 23:58:45 -05:00
myk002
32a0363f31
move identity check up a bit to avoid useless work
2021-01-24 08:57:56 -08:00
myk002
03719f58df
avoid infinite parentage when linking rooms
2021-01-24 08:52:34 -08:00
myk002
5a2181d55e
don't render overflow text
2021-01-13 22:02:22 -08:00
myk002
39d274b00e
address review comments
2021-01-12 23:42:53 -08:00
myk002
d4fbf4261f
address review comments
2021-01-12 23:27:14 -08:00
myk002
dac9538fd9
let navigation keys propagate
...
so other components can use them for simultaneous control
2021-01-11 15:02:12 -08:00
Myk Taylor
2797061b04
scroll Label text when height exceeds viewrect
2021-01-11 14:47:05 -08:00
Myk Taylor
175776812e
implement a nice API wrapper for getopt
2021-01-10 16:51:46 -08:00
Myk Taylor
3b45878d41
allow non-options in commandlines and return them
...
also call qerror() on error, not os.exit
2021-01-10 16:51:45 -08:00
Myk Taylor
20276be50f
check in unaltered version of alt_getopt
2021-01-10 16:51:45 -08:00
lethosor
69ce5d9e3f
Send runCommand output to correct output stream
...
e.g. when run with dfhack-run
2021-01-08 21:06:42 -05:00
lethosor
614ea739d0
Merge branch 'develop' into lua-runcommand
2021-01-08 20:45:23 -05:00
lethosor
462208cad3
Merge remote-tracking branch 'cvuchener/fix-loadlibrary-errormessage' into develop
2021-01-06 21:00:03 -05:00
Clément Vuchener
e7748e3f73
Add an error message when LoadLibrary fails
2021-01-01 15:35:59 +01:00
lethosor
b89fe222c7
Update xml
2020-12-29 23:47:44 -05:00
lethosor
eb6957a167
Bump to 0.47.04-r4 and update submodules
2020-12-24 13:32:44 -05:00
myk002
3ba984c22c
only reset extents if they are unusable
...
this allows callers of Buildings::setSize() to "pre-initialize" the
extents to declare non-rectangular structures. this allows quickfort to
create non-rectangular stockpiles, farm plots, zones, etc. the extents
are still reset as before if the size of the building doesn't match the
caller's expectations.
this commit also fixes a memory leak when setSize() allocates memory for
extents, but the memory is not deallocated if the building is ultimately
invalid for some reason.
2020-12-16 11:10:47 -08:00
lethosor
159695775e
Merge branch 'develop' into lua-runcommand
2020-12-05 19:49:55 -05:00
lethosor
855ce84eca
Update submodules
2020-12-04 23:55:43 -05:00
lethosor
af2255956a
Update submodules
2020-12-03 23:00:21 -05:00
lethosor
fe0cd9a939
Make lineedit() fail sooner when another lineedit() call is active
...
Before, calling `dfhack.run_command('tiletypes')` from a `dfhack.timeout` callback would leave the console in a broken state, since raw mode was enabled but never disabled.
Only tested on Linux with a supported terminal.
2020-12-03 22:04:00 -05:00
lethosor
a9bb11c145
Optimize Lua's internal.runCommand() when printing directly to the console
...
This also makes commands run with `run_command()` detect the console properly (notably used by `df2console()`)
2020-11-20 17:57:54 -05:00
lethosor
fb44b26b47
Make utils.addressof() work for raw userdata
2020-11-19 21:32:42 -05:00
lethosor
8cb38ecf5b
Merge remote-tracking branch 'myk002/myk_metalhead_mario' into develop
2020-11-13 14:04:30 -05:00
myk002
76e8c495fe
revert skip_vector=true for now
2020-11-13 10:45:53 -08:00