Commit Graph

332 Commits (0cbcabee59720f11307cd7afdbd63ebe53ceeb2e)

Author SHA1 Message Date
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
lethosor 8bda738466 df_expr_to_ref: support integer array indices 2017-05-07 16:31:30 -04:00
lethosor d3c496cc2b Add getSelectedPlant() and related functions
Currently only works with the center tile of multi-tile trees
2017-05-05 14:45:46 -04:00
Lethosor 318cf92f0b Merge pull request #1079 from Amostubal/patch-1
fix of relations errors.
2017-04-25 21:21:03 -04:00
Amostubal bc47803948 fix of relations errors.
There is a lot more errors in this file, mostly called unk variables... I bet they have names, I've tried to figure out what they were renamed too, but I'm not fully understanding the xml.
2017-04-24 07:07:08 -05:00
lethosor c21b7bf941 Add a Painter:key_string() method 2017-03-01 15:56:50 -05:00
Milo Christiansen 8bd92b6a08 Add a Lua module for getting a tile's material (#1031) 2016-12-27 16:49:46 -05:00
lethosor b1e3c1088c Give loadfile() result a better name for tracebacks 2016-10-19 09:53:12 -04:00
lethosor 85ebbf0e9c Fix df_expr_to_ref for raw userdata 2016-08-24 17:18:55 -04:00
lethosor 6ce470ad57 Add basic lua expression support to memview
Currently just supports basic field accesses (world.x, screen.y.z).
No support for world.x - 4, etc.

Closes #976
2016-08-24 16:26:34 -04:00
lethosor 7487f44fc8 Implement a helper to create lua environments with shortcuts (e.g. scr, unit)
Used in gui/gm-editor and lua

Closes #977
2016-08-23 21:47:41 -04:00
lethosor 2dccd1d0ff Add CheckedArray:__tostring() method 2016-08-22 23:18:30 -04:00
lethosor 0b6597ddb2 Stop field_offset from crashing due to missing vtables
Now, a pointer to NULL is cast to the type in question, avoiding the need to
call new() or delete() with potentially-misaligned types. Also,
virtual_identity::find has been tweaked to prevent it from crashing on NULL
vtable pointers.

This was suggested by Angavrilov.
2016-08-18 15:59:46 -04:00
lethosor c2997b9c79 Fix save_dir 2016-08-18 15:47:40 -04:00
lethosor ee7357b60e x86: fix vector validity check 2016-08-05 17:51:08 -04:00
lethosor e8fe72826f Add new integer types to memscan and update find-offsets 2016-07-29 00:05:12 -04:00
Vitaly Pronkin fe18f176f7 More 64-bit fixes
Cherry-picked from 7eb3ba6
- Lua update already done in e2c6350, 4dd411e
- Excluded library/modules/Buildings.cpp
2016-07-26 23:47:53 -04:00
Warmist 6c64b3441d Fixes to gui/advfort.lua 2016-05-20 13:55:59 +03:00
lethosor c1e44c178f Add on_click/on_rclick handlers to widgets.Label
Closes #919
2016-05-09 21:30:34 -04:00
lethosor b36193857c Add string:startswith(), endswith() 2016-04-16 17:13:41 -04:00
Warmist 7c91b8f755 Add more informative focus_path
This with conjunction of changes in eventful will make the sidebar overlay more bug-free :)
2016-04-10 16:53:18 +03:00
Warmist 8b8ce4eff9 Spelling mistake 2016-04-10 15:45:43 +03:00
Warmist d1c45d00d2 Fix some bugs in workshopOverlay
Fix bugs relating to "remove building"/"suspend remove" part of overlay.
2016-04-10 14:44:09 +03:00
Warmist 80521d1bb1 add onGetSelectedBuilding to workshop overlay
This will make other stuff that depends on dfhack.gui.getSelectedBuilding work with workshop overlay
2016-04-10 12:28:15 +03:00
lethosor 49863a9f32 Add a file-like lua JSON wrapper 2016-04-08 17:40:14 -04:00
lethosor b8bbf5f545 field_offset: Use actual type instances instead of reinterpret_cast(type, 1)
ui_build_selector is a virtual class as of 0.42.06, so reinterpret_cast-ing it
with bad addresses will crash. 'df.new(df.ui_build_selector)' works just fine.
2016-03-22 17:27:53 -04:00
lethosor 7da3c65079 Fix display of arrows in lua filtered list widgets
Fixes #718
2015-10-30 19:16:29 -04:00
lethosor d3dbc6225a Implement getViewscreenByType() in lua 2015-10-17 15:11:04 -04:00
lethosor 9eb86c7e38 Support additional script search paths
These can currently be added/removed from C++ or through the Lua API.
2015-09-06 16:23:02 -04:00
lethosor 6fb6645ed5 Merge branch 'dwarfmonitor-widgets' into develop 2015-06-15 12:55:26 -04:00
lethosor 862389d217 Allow lua scripts to redirect to other lua scripts
Addresses #634, #638
2015-06-14 11:56:14 -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
lethosor bb93f2e40f Fix circular lua script dependencies 2015-06-05 19:08:11 -04:00
lethosor a47a5f8b0a Add an alternative to script_environment() that requires scripts to
recognize use as a module

Also document the use of enable/disable with lua scripts
2015-05-09 09:21:00 -04:00
lethosor 42a6cfaee6 Improve Lua enable/disable error handling 2015-05-08 18:03:19 -04:00
lethosor eaf282c18e Allow lua scripts to be enabled and disabled with built-in commands 2015-05-08 18:03:19 -04:00
lethosor db423c1aa6 Allow Lua scripts to specify whether they can be used as a module or
enabled/disabled
2015-05-08 18:03:18 -04:00
lethosor e73a2f8778 Move script internals to a single table 2015-05-08 18:03:18 -04:00
lethosor 3ca00f85d0 Merge remote-tracking branch 'lethosor/json' into develop 2015-04-08 20:18:13 -04:00
lethosor 99f4ea4d2b Implement a PenArray class for caching parts of rendered screens 2015-03-27 22:56:30 -04:00
lethosor 38fa416ad1 Lua: Indent array values 2015-03-22 14:04:03 -04:00
lethosor 96e5c5d2fd Fix whitespace 2015-03-20 19:55:32 -04:00
lethosor b976053be0 Add Lua JSON library 2015-03-20 19:51:24 -04:00
lethosor 10cfef0553 Fix whitespace issues 2015-02-14 22:53:06 -05:00
lethosor 37f391ea6d Don't store runScript() in script environments 2015-02-10 17:22:16 -05:00
lethosor 337598e0d6 Restore lua environment persistence and update modified timestamp correctly
See #544
2015-02-10 16:36:21 -05:00
expwnent 712892fb71 Only reload and recompile Lua scripts if they have moved or been updated. 2015-02-02 02:24:43 -05:00
expwnent bf5e491647 Allow Lua scripts to be used as modules. 2015-01-31 22:43:54 -05:00
expwnent aa5d7c11bc Merge remote-tracking branches 'lethosor/patch-12' and 'lethosor/fs-expansion' into develop
Conflicts:
	NEWS
2015-01-31 20:25:01 -05:00
lethosor 3ab558c72d Check for init.lua existence properly
Fixes #501
2015-01-30 16:37:23 -05:00
expwnent 1445b0a919 Allowed Lua scripts to share variables with run_script and corrected dfhack.findScript so that it can find save-specific scripts. 2015-01-26 21:45:31 -05:00
expwnent 8e6fcac92e persist-table bug. 2014-12-07 07:56:33 -05:00
expwnent 97b44d5898 persist-table tweaks, delete debug print messages 2014-11-16 20:41:11 -05:00
expwnent 7560fbdb6b library/lua/persist-table.lua: now it uses metatables to make persistent memory storage even easier. 2014-11-16 17:06:59 -05:00
expwnent 59ef4e0cc2 It is now possible to remove syndromes by SYN_CLASS. 2014-11-14 23:33:49 -05:00
expwnent e2f4d3e4cb Fix persist-table so that all data is persistently stored properly. 2014-11-14 18:49:40 -05:00
expwnent 828852c36f Made persist-table correctly clear its stuff after exiting a game. 2014-11-10 01:09:50 -05:00
expwnent 593424cd6d new Lua library for persistent maps of arbitrary degree. 2014-11-10 01:03:20 -05:00
expwnent 0471294b1e Fix syndrome-util. 2014-10-04 21:54:07 -04:00
expwnent 0fbc7e22ee Merge remote-tracking branch 'lethosor/patch-4' 2014-09-16 17:21:39 -04:00
Lethosor d21cd54648 Add '@' documentation to dfhack.lua 2014-09-14 11:50:03 -04:00
Lethosor 9d3af4dcb6 Close file opened in load_patch() on success
Fixes #327
2014-09-10 15:09:57 -04:00
lethosor fadca0aef2 Add a variant of printall() that uses ipairs 2014-09-08 20:30:22 -04: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
Alexander Gavrilov 4902c577b3 Fix some crashes when running without globals and update structures. 2014-07-24 23:10:37 +04:00
expwnent a8f810cc3b Lots of tweaks. 2014-07-09 06:21:52 -04:00
expwnent 0a16bc2e12 Merge remote-tracking branch 'origin/perSaveScripts' into scriptOrganization
Conflicts:
	plugins/CMakeLists.txt
2014-07-07 09:01:07 -04:00
expwnent 3c06f3bada Allowed per-save script folders. 2014-07-07 08:50:40 -04:00
expwnent 5404b69476 Tweak repeat.lua. 2014-07-03 20:32:15 -04:00
expwnent e28a42b848 Fixed a problem with syndromeUtil, renamed to syndrome-util, and made add-syndrome use proper conventions. 2014-07-03 15:18:00 -04:00
expwnent 9d2c7a1abc Tweak to repeatUtil. 2014-07-03 08:09:47 -04:00
expwnent d048335a80 Tweaked item-trigger. 2014-07-03 06:01:58 -04:00
expwnent d765de4546 Merge remote-tracking branch 'lethosor/lua-runcommand2' into scriptOrganization 2014-07-01 02:05:14 -04:00
expwnent 1c0ae94539 processArgs now detects duplicate args. 2014-07-01 00:57:24 -04:00
expwnent 2ed7960f96 Tweaked utils.lua::processArgs to allow specification of a table of acceptable argument names. 2014-07-01 00:55:52 -04:00
expwnent c3c025c034 Added Lua subroutine for standardized argument processing. 2014-06-30 02:19:50 -04:00
expwnent f12aa3665b Removed the temporary lua events because EventManager does them better. 2014-06-28 02:46:08 -04:00
lethosor 830b39e13b Non-silent version of Lua's run_command 2014-06-27 21:58:36 -04:00
expwnent 0db0244d08 Added add-syndrome script to modtools and fixed syndromeUtil so it actually works. This should make it so that event hooks only have to be able to run scripts instead of run scripts and add syndromes. 2014-06-27 05:47:52 -04:00
expwnent 187ce3c58b Fixed the organization of my new lua modules. They now go in library/lua instead of where plugin lua modules go. Updated scripts accordingly. 2014-06-27 02:43:05 -04:00
Alexander Gavrilov 6f162a4e72 Verify that mkmodule is called with the correct module name. 2014-06-26 18:11:05 +04:00
lethosor d538e13450 Allow runCommand arguments to be passed as a table internally 2014-06-16 11:16:35 -04:00
lethosor 2a01259192 Fix runCommand crash, return output and result 2014-06-10 21:38:21 -04:00
lethosor 143b1e3469 Lua runCommand improvements
* Return error codes (e.g. CR_FAILURE) when a command fails instead of output
* Make dfhack.runCommand() take a list of arguments as well
2014-06-10 13:41:01 -04:00
lethosor 91a93a00d2 Add dfhack.run_command (Lua)
Simplified version of runCommand
2014-06-07 20:31:20 -04:00
Alexander Gavrilov 6bef167f83 Add a couple of useful scripts and fix two missing NULL checks.
- A script to unstick jobs trying to build walls from the same tile.
- A devel script for viewing the path a unit is currently following.
2014-04-21 09:24:05 +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
Alexander Gavrilov a09e132107 Support using multiple lua init scripts per save.
This should make it easier to add and remove init script code by
automated means, or install multiple mods that need such code.
2014-03-31 16:00:55 +04:00
expwnent ce1bb1e95b Merge remote-tracking branch 'putnam/master' into 0.34.11-r4 2013-10-20 23:27:12 -04:00
Putnam3145 4a32aff6a3 Update script.lua 2013-10-20 13:58:15 -07:00
expwnent 57fc0f3e89 Merge remote-tracking branch 'angavrilov/master' into 0.34.11-r4
Conflicts:
	NEWS
	library/xml
	plugins/CMakeLists.txt
	plugins/autoSyndrome.cpp
2013-10-19 20:19:29 -04:00
Alexander Gavrilov 9e81d27cd1 Implement the same random generator as DF uses for DFHack. 2013-09-30 19:46:39 +04:00
expwnent 11635caeb8 Add makeown.lua. 2013-08-31 16:15:54 -04:00
Alexander Gavrilov 03b91ca26c Fix a problem in binpatch.lua and comment out debug messages in tweak. 2013-02-26 12:29:02 +04:00
Warmist e4f4943b10 Merge branch 'master' of https://github.com/angavrilov/dfhack 2012-12-23 12:34:05 +02:00
Alexander Gavrilov bb3a491d68 Implement a per-save lua init script. 2012-12-21 14:00:50 +04:00
Warmist ff4278d04e Removed debug spam, added support for "HAS_MATERIAL_REACTION_PRODUCT" type reactions. 2012-12-09 23:07:13 +02:00
Warmist 6c4f163a5e Merge branch 'master' of https://github.com/angavrilov/dfhack
Conflicts:
	NEWS
2012-12-09 14:25:31 +02:00
Warmist 4f5fdebbe9 furnaces added and custom reactions. 2012-12-09 00:53:03 +02:00
Warmist 3bce3838af Advfort now supports workshops and siege weapons >:) 2012-12-03 21:49:17 +02:00
Alexander Gavrilov 9703d3fd8f Detect mouse press events for lua. 2012-12-02 14:43:23 +04:00
Alexander Gavrilov 58239e97ed Implement the history graph in the workflow status screen. 2012-12-01 16:50:03 +04:00
Alexander Gavrilov 0bfe006016 Try to reimplement the inventory monitor by falconne in lua.
For no other reason than to provide a complete example of lua
interface for a native plugin :)

TODO: paint the graph in the right pane.
2012-11-30 19:10:17 +04:00
Warmist 471d15ba4c New building selection dialog. 2012-11-29 20:49:16 +02:00
Alexander Gavrilov 5ea26d9cae Only show the advanced new constraint dialog on Shift-Enter.
Upon reflection it is a bit too scary to be always shown.
2012-11-29 16:27:51 +04:00
Alexander Gavrilov 94e6690586 Don't complain about fake input tokens in simulateInput. 2012-11-29 13:37:16 +04:00
Alexander Gavrilov 2953e4c386 Implement a dialog to specify a workflow constraint with all features. 2012-11-17 20:32:39 +04:00
Alexander Gavrilov 6cf85b4318 Abstract the back-end from the binpatch script, and use in gui/assign-rack. 2012-11-12 12:26:31 +04:00
Warmist 0e4df55364 Merge branch 'master' of https://github.com/angavrilov/dfhack 2012-11-11 12:46:55 +02:00
Alexander Gavrilov bd8c59462c Add documentation for the core lua gui library stuff. 2012-11-04 17:06:32 +04:00
Alexander Gavrilov 9598316855 Add a native pen object for lua with a more checked behavior. 2012-11-03 20:06:33 +04:00
Warmist 6be65690f7 Merge branch 'master' of https://github.com/angavrilov/dfhack into experimental-dontmerge 2012-11-02 20:29:27 +02:00
Alexander Gavrilov e353f5f03e Add a script to complement the weapon rack binary patch. 2012-10-27 20:16:27 +04:00
Alexander Gavrilov 1f994295b8 Consider assigned vehicles in use, and tweak text color rendering. 2012-10-25 13:20:41 +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 a1dd31aab3 Tweak the mechanics for showing and rendering lua screens.
- Place new screens below any dismissed ones on top.
- When asked to render a dismissed lua screen, call render() on its
  parent to avoid producing a black screen frame when unlucky.
2012-10-25 12:09:39 +04:00
Alexander Gavrilov 59ec9b304e Implement adding workflow constraints from gui/workflow. 2012-10-24 21:49:30 +04:00
Alexander Gavrilov 616c57257d Support changing the constraint ranges from the workflow gui script.
TODO: implement creating completely new constraints.
2012-10-24 19:25:06 +04:00
Alexander Gavrilov 46938625fd Pass the hotkey keys to dwarfmode from overlays, and fix gui/workshop-job. 2012-10-21 21:45:51 +04:00
Alexander Gavrilov dee0c97584 Add a gui script for viewing and changing job_item properties. 2012-10-20 21:57:36 +04: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 1e2570f4cb Add an extremely simple item selection dialog by wrapping ListBox. 2012-10-17 21:42:06 +04:00
Alexander Gavrilov 4f7895f571 Support restricting the set of materials presented in the dialog. 2012-10-17 18:29:15 +04:00
Alexander Gavrilov 0046b093f7 Link visibility and event handling order.
- Hidden widgets don't receive events.
- Children handle events in top to bottom order.
2012-10-17 11:49:11 +04:00
Alexander Gavrilov ad4f9908fb Extract a generic filtered list widget from the materials dialog. 2012-10-17 10:41:50 +04:00
Alexander Gavrilov b14e4e97f5 Natively support entry icons in the List widget. 2012-10-17 09:41:48 +04:00
Alexander Gavrilov 023dc82564 Implement a material selection dialog. 2012-10-16 18:33:00 +04:00
Alexander Gavrilov d336abfd97 Add label and list widgets, and switch stock dialogs to them. 2012-10-16 14:18:35 +04:00
Alexander Gavrilov abfe2754fb Start implementing common widgets for lua screens. 2012-10-15 20:03:18 +04:00
Alexander Gavrilov 33bd8103de Extract an abstract View superclass from Screen to handle widget trees. 2012-10-15 15:30:00 +04:00