Commit Graph

1196 Commits (6202b29c56474e92e4538caa3f98a09dbec05c8b)

Author SHA1 Message Date
Tachytaenius 0836962007 Rename [xyz]CategoryActionTimers to [xyz]GroupActionTimers in action timer API 2022-12-01 23:24:04 +00:00
Tachytaenius ae532e1452 Rename affectedActionTypeCategory to affectedActionTypeGroup in action timer API 2022-12-01 23:22:02 +00:00
Tachytaenius 76cdbfbc5c Rename affectedActionCategory to affectedActionTypeCategory in action timer API 2022-12-01 23:19:10 +00:00
Tachytaenius f06f17b59c Rename affectedActionTypes to affectedActionCategory in action timer API 2022-12-01 23:17:57 +00:00
Tachytaenius a925c34413 Rename [xyz]ActionTimer functions to [xyz]ActionTimers 2022-12-01 13:34:54 +00:00
Tachytaenius f863b9807a Add action timer API input validation 2022-12-01 13:34:54 +00:00
Tachytaenius 8f0b7663d9 Change ints in action timer API function signatures to int32_ts 2022-12-01 13:34:54 +00:00
Tachytaenius 7f54a77ed9 Continue work on unit action timer API 2022-12-01 13:34:54 +00:00
Tachytaenius 16ef4f8313 Rename action_type_group to unit_timer_action_type_group 2022-12-01 13:34:54 +00:00
Tachytaenius fa589b5764 Make progress with action timer API 2022-12-01 13:34:54 +00:00
Tachytaenius 0f8ce360ac Make first pass of action timer API 2022-12-01 13:34:54 +00:00
Myk 11c27d40dd
Merge branch 'develop' into Bumber64-patch-2 2022-11-18 17:34:00 -08:00
Myk 966623a919
Merge pull request #2387 from cppcooper/units-checking
Extends Units module
2022-11-14 16:55:42 -08:00
myk002 94c6bc8063
refactor generic lua function caller to Lua ns 2022-11-14 16:40:35 -08:00
Josh Cooper aa5c6515e0 Removes rogue indent 2022-11-13 11:39:20 -08:00
Josh Cooper 78021ec672 Adds indentation 2022-11-13 11:35:01 -08:00
Josh Cooper d112649886 Organizes and documents Units::is*(unit) functions 2022-11-12 16:40:20 -08:00
Josh Cooper ebd450af0e Adds isUnitInBox to Units module 2022-11-12 14:42:41 -08:00
Josh Cooper 34de030ba9 Units module
- Updates `Lua API.rst`
  - Only adds the most important additions (complicated enough to need explaining)
- Adds new functions to LuaApi.cpp
- Revises isUndead to accommodate `dfhack.units.isUndead(u)` => `Units::isUndead(u, false)` instead of taking the default value
2022-11-09 22:03:39 -08:00
Myk eac7fac8e9
Merge pull request #2389 from myk002/myk_gui_anywhere
[Gui] add "anywhere" keybinding guard
2022-11-09 15:48:04 -08:00
Josh Cooper 80824f5b75 Extends Units module 2022-11-09 14:41:45 -08:00
myk002 0344595e4e
add "anywhere" keybinding guard 2022-11-09 14:32:51 -08:00
myk002 d95a5ac238
add string_to_int to MiscUtils.h 2022-11-09 11:55:29 -08:00
Josh Cooper beee445f6f Extends Units module
Adds unit check functions for
- animals
- demons
- titans
- megabeasts
- semimegabeasts
- night creatures
2022-11-09 11:44:28 -08:00
Myk f2a386f0e1
Merge pull request #2375 from myk002/myk_uicommon
Move generally useful string functions from uicommon to MiscUtils
2022-11-09 10:31:50 -08:00
myk002 4668d8c4a3 Add Lua::Push method for maps 2022-11-08 10:15:28 -08:00
myk002 b82a604c8d factor out keys -> lua onInput code to LuaTools 2022-11-08 10:15:28 -08:00
Myk 193d29ba67
include cctype to fix build error 2022-11-08 09:53:08 -08:00
myk002 5b9c18fc3c
migrate string fns from uicommon to MiscUtils
and clean up some leaky usings
2022-11-07 15:36:16 -08:00
myk002 666edd6d60
don't overwrite dig priority by accident
many callers of setDesignationAt simply didn't bother with the priority
parameter. change the default value of the priority param so that by
default we will keep the previous value instead of overwriting it
2022-10-19 16:47:54 -07:00
Myk 4f10cd4a9b
Merge pull request #2331 from wolfboyft/constructions-find-at-tile-patch
Implement/change/expose to Lua constructions findAtTile & insert
2022-10-13 17:40:21 -07:00
Tachytaenius ded5f483d6 Fix issues in construction module 2022-10-12 21:32:27 +01:00
myk002 b78af72403
record built constructions in blueprint 2022-10-12 13:31:46 -07:00
Myk Taylor 215a5b0a24
add Gui::getMousePos() that always gets map coords 2022-09-18 08:19:02 -07:00
myk002 d0a5db2a0d
set sentinel value used by TWBT 2022-09-16 21:56:05 -07:00
myk002 8173f6dd02
Merge remote-tracking branch 'upstream/develop' into docs 2022-07-18 10:59:00 -07:00
myk002 e650bd0942
add comment about plugin docs 2022-07-17 17:05:29 -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 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 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
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
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 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 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
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
Tim Siegel 55e4008925
MiscUtils: teach word_wrap() to optionally preserve whitespace 2022-05-09 13:42:11 -04: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
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
Josh Cooper 9c9a7ef99a Adds consistent interface signatures for Maps module 2022-04-21 19:40:58 -07:00
Josh Cooper 251f4f92c8 Fixes build errors 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
lethosor d1f0edd33b
Apply initial pre-commit config 2022-04-12 14:48:19 -04: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 b18eff9ce2
Revert EventManager to previous behavior, but keep new events
Fixes #2031
2022-03-29 09:42:24 -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
Quietust aa1bc3fe52 Cleanup Kitchen module (and the seedwatch plugin which uses it) 2022-03-12 12:04:34 -08:00
Josh Cooper ba5710f263 Adds new event type NEW_UNIT_ACTIVE 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 24255d3195 Adds event type JOB_STARTED 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 e9eef31344
refactor list item removal into a library fn 2021-08-19 19:51:25 -07:00
myk002 5b960b97bc
fix comment for Maps::getSize(); add getTileSize() 2021-07-30 13:09:12 -07:00
Ryan Williams c5fb28a13c
Rename getPlantAtCoords to getPlantAtTile 2021-06-23 23:00:30 -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
lethosor 2fc5fbacb5
Merge remote-tracking branch 'myk002/myk_reveal_unhideFlood' into develop 2021-06-19 01:08:05 -04: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
myk002 aff5c9bf35
add getCursorCoords overload for df::coord
and factor out active cursor detection
2021-05-15 12:05:00 -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
Ben Lubar c06d1f8e52
tagged union support for lua (#1818) 2021-03-30 15:55:06 -05: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
myk002 6819ee9928
make alchemist flag valid for controllable civs 2021-02-05 16:45:39 -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 8cb38ecf5b
Merge remote-tracking branch 'myk002/myk_metalhead_mario' into develop 2020-11-13 14:04:30 -05:00
myk002 10616a387f
cleaner mask-based implementation 2020-11-12 22:44:38 -08:00
myk002 02a86d761a
identify bars as non_economic items
allows Job::isSuitableMaterial() to match metal bars as a building
material
2020-11-12 19:10:06 -08:00
lethosor 913d860ae4
Use initial working directory as process path on Linux, and expose to Lua 2020-11-12 19:07:51 -05:00
lethosor 23b230495e
Merge branch 'develop' into cwd-handling 2020-11-12 18:44:05 -05:00
lethosor ce7772a1c2
Add Filesystem::restorecwd()
This allows restoring the working directory to its original value, which may not actually be the DF root. See #1671, dfhack/scripts#152
2020-10-14 21:22:53 -04:00
Myk Taylor 9d2abafefc Merge branch 'buildingplan_refactor' into buildingplan_refactor2_squashed 2020-10-11 12:11:51 -07:00
Myk Taylor 4d7f4d80ad prep buildingplan for core algorithm changes
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
2020-10-04 20:05:08 -07:00
George Murray a3c565b243 Add to_search_normalized to search for characters with accents 2020-09-24 07:31:10 -07:00
lethosor 65b8071941
Use typedefs from xlsxio in PluginStatics.h
The typedefs in the header foward-declared new structs of the same names in the DFHack namespace, e.g. DFHack::xlsxio_read_struct. Apparently the constructors that used these typedefs are not inlined on Windows, so libdfhack was compiled with a constructor taking a "DFHack::xlsxio_read_sheet_struct", and xlsxreader was looking for a constructor taking just a "xlsxio_read_sheet_struct", which didn't exist.
2020-09-18 15:05:17 -04:00
lethosor 8779ca0659
Merge remote-tracking branch 'myk002/quickfort_civzones' into develop 2020-08-21 00:34:26 -04:00
Myk Taylor e546d3eec3 rename is_civzone to the more general allow_wall 2020-08-15 20:13:48 -07:00
Myk Taylor ae872e812f properly detect valid tiles for civzones 2020-08-15 17:24:12 -07:00
Myk Taylor bda678bcd4 add some explanatory text to the top of the header 2020-08-11 19:47:04 -07:00
Myk Taylor 39ae2d95fc 2nd attempt to solve compilation errors on windows 2020-08-11 17:06:28 -07:00
Myk Taylor 4f88bb4c3d attempt to solve compilation error on windows 2020-08-11 16:54:53 -07:00
Myk Taylor 0bda289b17 move xlsxreader identity statics to dfhack lib 2020-08-11 14:51:17 -07:00
Myk Taylor a41f7c0998 convert XlsxReader module to xlsxreader plugin 2020-08-09 08:54:42 -07:00
Myk Taylor 18f4786458 Merge remote-tracking branch 'upstream/develop' into quickfort_xlsxio 2020-08-08 17:17:45 -07:00