Commit Graph

262 Commits (4300c185d733d8085e161923976810147d2df93f)

Author SHA1 Message Date
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
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 fb44b26b47
Make utils.addressof() work for raw userdata 2020-11-19 21:32:42 -05:00
Myk Taylor 186f28a94b filters for altars, display cases, and bookcases 2020-10-23 09:11:07 -07:00
Myk Taylor 3c51bb51ab remove references to non-existent vector ids 2020-09-28 23:14:13 -07:00
Myk Taylor 6cc1428199 Merge remote-tracking branch 'upstream/develop' into buildings_vectors 2020-09-28 23:13:13 -07:00
lethosor dfac5bc143
Update gui.Painter docs, add sections to dfhack.screen, add more links, etc 2020-09-23 22:00:39 -04:00
Myk Taylor f837532b42 use more precise item vectors for bld item filters 2020-09-13 17:12:29 -07:00
lethosor 3b5a82cc05
Change color of ListBox.select2_hint to grey to indicate enabled
Ref dfhack/scripts#185
2020-08-27 00:08:28 -04:00
lethosor c034276af5
Merge remote-tracking branch 'myk002/quickfort_filter' into develop 2020-08-21 00:34:34 -04:00
Myk Taylor 9a3e9d5b12 listbox filter can match strings after punctuation 2020-08-17 21:15:33 -07:00
Myk Taylor 8a438c2a55 allow row_height to be set from the ListBox class 2020-08-17 21:14:05 -07:00
nicolasayala 141928ead0 Fix gui.FilteredList widget search on plain string choices 2020-02-27 07:56:30 +01:00
Timur Kelman 1d8998de22
allow custom filter in `dfhack.printall_recurse`
Objects with links like `job` output way too much. With this change, it's possible to provide an optional filter and exclude the `list_link`.
```
[lua]# j = dfhack.gui.getSelectedJob()
[lua]# printall_recurse(j, {[tostring(j.list_link)]=true, [tostring(j.pos)]=true})
```
2020-02-23 16:57:57 +01:00
Ben Lubar 96d8dffd32
Make dfhack.run_command return the command_result value.
Rename local variables to match dfhack.run_command_silent for clarity.
2020-01-14 17:53:52 -06:00
lethosor 49563b4618 Merge remote-tracking branch 'warmist/FilteredListFix' into develop 2019-11-02 16:28:06 -04:00
Warmist a2b5c1ddd9
lua/widgets filtered list input fix
FilteredList was not consuming input events.
2019-09-30 22:00:06 +03:00
lethosor e5eade1ad7 Make gui.dwarfmode.{get_movement_delta,get_hotkey_target} public 2019-04-30 16:53:09 -04:00
lethosor 163c9b4059 Add utils.OrderedTable, make test order consistent
Also added OrderedTable tests and comment support to expect.*()
2018-07-19 12:40:25 -04:00
lethosor c006df561e Merge remote-tracking branch 'suokko/lua_printall_recurse' into develop 2018-07-06 14:25:35 -04:00
lethosor c449041c11 Merge remote-tracking branch 'suokko/lua_List_setChoices_internal_table_1171' into develop 2018-07-03 00:27:22 -04:00
Pauli ba1d3fcb6a Add dfhack.printall_recurse to quickly print df containers
I often want to see multiple items quickly when trying to figure out
what states actually matter to an issue that I debug. I decided to make
it easier to quickly dump df structures with substructures and
containers. It will generate large amount of data which can be sometimes
slow to process manually. But processing can be automated using
dfhack-run lua ^<df data to inspect> and pipe to other tools (eg grep,
sed, perl, sort, uniq etc)
2018-06-30 22:31:49 +03:00
Pauli 1fc37f8ddc Checke Console::lineedit error return values
Console::lineedit can return -1 to indicate input error and -2 to
indicate the program is closing. But most users don't check possible
unusual return values which can lead to exit hang.
2018-06-22 17:57:37 +03:00
Pauli 98b25e3462 Allow calling List:setChoices() to clear choices 2018-06-20 17:46:24 +03:00
Pauli ed23d2c4e2 Change gui.widgets.List:setChoices to keep state in internal table
Fixes #1171
2018-06-20 17:23:57 +03:00
lethosor fe458d3ac1 Merge remote-tracking branch 'grubsteak/patch-2' into develop 2018-06-08 22:05:20 -04:00
Pauli e3df5cd765 Port profiler to lua 5.3 and dfhack
Changes include
* table.getn(obj) -> #obj
* Making sure string.rep gets an integer parameter
* Optimized profiling hooks (call profiler cost from factor 40 to 10)
* Specialized parameter name lookup code for c++ __index metamod calls
* Collect source lines in time sampling variant
* Simplified prevent to always filter all children
2018-06-06 19:18:18 +03:00
Daniel Silverstone 96ba5116f7 Add lua Pepperfish Profiler code
Pepperfish Profiler can produce time sampled profiles and call entry
exit profiles. Code is verbatim copy from the lua wiki [1]. This commit
won't work alone but it exists to give author credit correctly to
Daniel.

[1] http://lua-users.org/wiki/PepperfishProfiler

Authors:
Daniel Silverstone <dsilvers@pepperfish.net>
Tom Spilman <tom@sickheadgames.com>
Ben Wilhelm <zorba-pepperfish@pavlovian.net>
2018-06-06 17:27:40 +03:00
lethosor eb199d97b5 Prepend script name to qerror messages, if applicable
Resolves #1282
2018-05-20 09:30:46 -04:00
grubsteak 7e3c8c9965
added fast keys for workshop gui overlay 2018-05-19 20:25:24 -05:00
Lethosor 9ca79d050d
Merge pull request #1259 from AtomicChicken/syndrome-util-updates
syndrome-util: added function to remove syndrome wound data
2018-05-18 14:10:14 -04:00
AtomicChicken c58ffdb922
Added function to remove syndrome wound data
The presence of syndrome data in unit.syndromes.active generates corresponding wound data in unit.body.wounds. This wound data acts to produce all of the syndrome's actual effects, including but not limited to flag changes, interaction abilities, body transformation and display name alterations. Wound data persists when syndrome data is cleared from unit.syndromes.active. Since syndrome-util did not touch wound data at all, the erase function was completely ineffective at actually removing syndromes.

Note that syndromes also generate a bunch of data in the historical figure information of units. I have observed that this historical data is sufficient to restore the syndrome in a unit following map reload (at least in adventure mode), so its clearance (which needs to also include any corresponding interaction effects) will have to be addressed in a future update. As is, syndrome erasure remains incomplete.
2018-04-20 17:14:03 +02:00
lethosor 5081710900 Merge remote-tracking branch 'ThiagoLira/develop' into develop
Also fixed whitespace from #1251

Closes #1186
2018-04-04 17:13:07 -04:00
ThiagoLira b7bd88352e fixed bug causing gui scripts to fail when sidebar is closed 2018-04-04 17:42:46 -03:00
Lethosor 464052fe52
Merge pull request #1237 from warmist/warmist-patch-1
Fix parse_inset in gui.lua
2018-03-11 12:11:24 -04:00
Warmist 25d2938477
Fix parse_inset in gui.lua
It was used in different order than the return happened.
2018-03-11 12:40:30 +02:00
lethosor db95796d4c Many build fixes 2018-03-10 16:53:45 -05:00
lethosor 325e0b0e33 binpatch.lua: check for empty patches 2018-01-31 09:57:11 -05:00
lethosor 2202c781f7 Add a dfhack.script_help() function to assist scripts 2018-01-25 10:55:00 -05:00
lethosor e6651171bf json: Improve IO-related error messages 2017-12-25 14:40:06 -05:00
Quietust 88c7e493b8 Merge ui_area_map_width into ui_menu_width, now a 2-byte array 2017-12-03 20:34:59 -06:00
Ben Lubar 7fed961fcd
Make repeatUtil.cancel work even when called from the callback. Closes #1122. 2017-07-11 15:10:42 -05:00
lethosor cc0220f030 Add a "key" option to EditField and FilteredList 2017-06-27 21:10:14 -04:00
lethosor db375ae83b Add a Pages:getSelectedPage() helper
Equivalent to select(2, pages:getSelected()), but more readable.
2017-06-23 12:46:46 -04:00
lethosor ae809afde7 Add Gui::refreshSidebar()
This handles feeding CURSOR_DOWN_Z and CURSOR_UP_Z properly, avoiding issues
when on the lowest z-level.
2017-06-23 00:02:21 -04:00
lethosor ae1aa49089 Add map parameter to Lua paintTile() and use in Painter
Also updated gui/siege-engine.lua
2017-06-02 12:42:51 -04:00
lethosor 346e8b91a9 Use getDwarfmodeViewDims() in getPanelLayout()
Allows C++ hooks to affect Lua scripts as well
2017-06-01 23:36:02 -04:00
lethosor e51c5fc2cc Allow key_pen option in some widget text 2017-05-28 23:11:37 -04:00