* 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>
* 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
* implement keyboard focus subsystem
* Fix error in focus group combining
* documentation for the inputToSubviews decision
* modify unit tests to catch that last bug
* 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
* 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>
* 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`
* 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
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.
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.
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.
player-visible changes
- removed text that showed up if you used the wrong hotkeys. no other
dfhack screen does this, and it seems unneeded. can add back if others
think otherwise, though
internal changes
- 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