Tachytaenius
e93d7eefb3
Factor out set and add shared action timer code into own functions
2022-12-01 13:34:54 +00:00
Tachytaenius
357b871b4f
Factor out shared unit action timer multiplication code into its own function
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
4b33097e57
Remove default in action timer API switch case
2022-12-01 13:34:54 +00:00
Tachytaenius
a3b1125c28
Progress on action timer API
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
2cbbed6750
Use df-structures XML enums for action timer API
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
Josh Cooper
807894ac6c
Updates Units::isAnimal
...
Now checks that the unit cannot learn or speak, and has either a wilderness population source, a pet/pet_exotic token, or is trainable for war/hunting
2022-11-29 13:19:19 -08: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
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
Myk
5136bbbc03
Merge pull request #2383 from cppcooper/em-fixes
...
Fixes JOB_STARTED event
2022-11-11 19:58:46 -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
Josh Cooper
f3ae193914
Update EventManager.cpp
2022-11-09 16:49:35 -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
Josh Cooper
c0ffcc2f79
Updates Units::isDemon()
2022-11-09 12:37:41 -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
Josh Cooper
92645ccb5b
Fixes JOB_STARTED event
2022-11-08 12:43:23 -08:00
myk002
b82a604c8d
factor out keys -> lua onInput code to LuaTools
2022-11-08 10:15:28 -08:00
Josh Cooper
2197aded30
Fixes segfault
2022-11-06 17:30:28 -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
Tachytaenius
1cf9688349
Implement/change/expose constructions findAtTile & insert (not building)
2022-10-12 21:10:22 +01:00
myk002
cb80f7dd75
don't cache dup civzones when scanning buildings
2022-09-25 16:04:36 -07:00
lethosor
e6336e769a
Units::teleport(): set idle_area
2022-09-24 13:30:24 -04:00
Myk Taylor
dbc5001bd8
fail if mouse cursor isn't over the map area
2022-09-18 13:27:13 -07:00
Myk Taylor
215a5b0a24
add Gui::getMousePos() that always gets map coords
2022-09-18 08:19:02 -07:00
Myk Taylor
448eced17c
make Screen::getMousePos always return scr coords
2022-09-18 08:07:08 -07:00
myk002
d0a5db2a0d
set sentinel value used by TWBT
2022-09-16 21:56:05 -07:00
lethosor
f021dd0e0a
Gui::getAnyItem(): add support for viewscreen_treasurelistst
2022-07-12 11:25:16 -04:00
lethosor
4cdb0ff138
Merge branch 'rm-old-modules' into develop
2022-07-12 11:23:10 -04:00
Myk
e0d37a31ae
Make the manager orders library available by default ( #2233 )
...
* move orders out of examples directory
* install orders into library dir
* read orders from new library dir
* update documentation
* update dreamfort references to orders import
* update changelog
* ignore json files in pre-commit
2022-07-06 07:03:29 -07: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
Myk
ba629b8e0a
manually handle DestroyBuilding jobs ( #2209 )
...
* don't delete general refs from jobs that we cancel
though we still disconnect the refs if we can
* get job remove working in all cases
we apparently need to manually handle DestroyBuilding jobs
everything else we should let cancel_job handle
* update changelog
2022-06-21 16:38:04 -07:00
Josh Cooper
d38ab1d152
Fix UNIT_NEW_ACTIVE events ( #2197 )
...
* Updates eventful.lua to use UNIT_NEW_ACTIVE
* Fixes bug #2189
* Revises activeUnits declaration/initialization
* Fixes build error
* Update changelog.txt
* reword changelog entry
* add changelog entry for event name change
Co-authored-by: Myk <myk002@yahoo.com>
2022-06-17 09:34:41 -07:00
Myk
85d7489b3c
ensure refs are cleaned up when we remove a job ( #2184 )
...
* ensure job items are disassociated from the job
when the job is removed. the new df-provided ``cancel_job()`` doesn't do
this for us whereas the old custom implementation did.
ref: #2028
* remove trailing whitespace
* Clean up general refs before removing job
Because the game method doesn't do it itself
* Fix typo in var name
* clean up code
* update changelog
2022-06-11 07:38:22 -07:00
Ryan Williams
a7267e3c4e
Optimize report deletion
2022-06-07 04:21:48 -07:00
Ryan Williams
5d08e5ae67
More constants; remove extra "using" statements
2022-06-06 01:56:11 -07:00
Ryan Williams
ce36abce47
Fixes
2022-06-04 15:46:02 -07:00
Ryan Williams
ae4446610b
Update Gui.cpp
2022-06-04 15:36:50 -07:00
Ryan Williams
16b5cade00
Add constants, update old fns
...
Add MAX_REPORTS_SIZE, RECENT_REPORT_TICKS
Remove redundant "using df::global::world" inside fns
Update `makeAnnouncement`:
Use `word_wrap`, `pauseRecenter`, and utility fn `delete_old_reports`
Handle repeat announcements
Insert sorted into ``world->status.announcements``
Update `addCombatReportAuto`: Use utility fn `recent_report`
Update `showPopupAnnouncement`: Delete old popups at end of fn
Update `getDwarfmodeViewDims_default`: Check for ui_sidebar_mode::Default and ArenaWeather
2022-06-04 15:23:57 -07: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
b1e118384e
Update Maps.cpp
2022-05-30 16:26:30 -07:00
Ryan Williams
574728ac5c
Move add_proper_report up with other utility fns
2022-05-30 15:04:43 -07: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
249ed2888f
Fix scope issue
2022-05-28 13:28:10 -07:00
Ryan Williams
e613085b0e
remove whitespace
2022-05-28 12:39:49 -07:00
Ryan Williams
2b29431806
More fixes
...
* Use word_wrap()
* add_proper_report utility fn; have addCombatReportAuto use this
* Update Lua API.rst
* Update Gui.cpp
2022-05-28 12:35: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
74499ad64a
Use to_string on integer
2022-05-03 00:09:34 -07: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
b56d9520e9
Fix trailing whitespace
2022-04-25 00:39:05 -07:00
Ryan Williams
c7be54dac0
Update Gui.cpp
...
Add reverse engineered functions: parseReportString, autoDFAnnouncement, recenterViewscreen, and pauseRecenter.
Add versions of autoDFAnnouncement that don't take a report_init struct and that log unprinted announcements.
Add utility functions: recent_report, recent_report_any, delete_old_reports, and check_repeat_report.
2022-04-24 22:45:26 -07:00
Josh Cooper
9c9a7ef99a
Adds consistent interface signatures for Maps module
2022-04-21 19:40:58 -07:00
Josh Cooper
ff2bd8d953
Retypes the EventManager's constructions container
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
Josh Cooper
64b7de0339
Revises getVerb signature
2022-04-18 22:46:38 -07:00
Josh Cooper
018d189494
Simplifies report index safety
2022-04-18 22:46:38 -07:00
Josh Cooper
1f972d6c1c
Implements clang-tidy suggestions
2022-04-18 22:46:38 -07:00
Josh Cooper
9bf9a79a11
EventManager/Eventful - Generate event arrays ( #2097 )
...
* Replaces EventManager.cpp's event array with an auto-gen one
* Replaces eventful.cpp's event array with auto-gen one
2022-04-14 21:47:25 -07:00
lethosor
d1f0edd33b
Apply initial pre-commit config
2022-04-12 14:48:19 -04: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
Kelly Kinkade
3d4c96de56
update Job.cpp to use the DF-provided job cancel method
...
use DF's provided job cancel function instead of the hackadoo workaround we used to use
2022-03-12 15:37:33 -08:00
Quietust
aa1bc3fe52
Cleanup Kitchen module (and the seedwatch plugin which uses it)
2022-03-12 12:04:34 -08:00
Josh Cooper
3f05859780
Revises manageJobStartedEvent, and adds comments
2022-03-12 11:33:27 -08:00
Josh Cooper
c8e7869375
Fixes some build errors
2022-03-12 11:33:27 -08:00
Josh Cooper
524f1670ed
Fixes missing namespace
2022-03-12 11:33:27 -08:00
Josh Cooper
ba5710f263
Adds new event type NEW_UNIT_ACTIVE
2022-03-12 11:33:27 -08:00
Josh Cooper
6ace4b2cf8
Fixes mistake in EventManager::manageTickEvent
2022-03-12 11:33:27 -08:00
Josh Cooper
b8ad0131ea
Modifies EventManager::registerTick to retain old behaviour of re-registering tick events
2022-03-12 11:33:27 -08:00
Josh Cooper
1107c03b86
Modifies EventManager unit loops
2022-03-12 11:33:27 -08:00
Josh Cooper
c550a6caf0
Updates EventManager job loops
2022-03-12 11:33:27 -08:00
Josh Cooper
07ffa0b8da
Fixes bug in manageJobStartedEvent
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
48444afbd5
Fixes issue in manageJobCompletedEvent
2022-03-12 11:33:27 -08:00
Josh Cooper
3e72d549d1
Switches iterators to pre-increment instead of post for EventManager
...
My understanding is that iterators (.begin()/end()) are slightly faster with
pre-increment instead of post. Something about avoiding a copy if I recall correctly.
I replaced all `([:alpha:]+)\+\+` with `++$1` so non-iterators were switched as well - luckily there is no impact to pre/post aside from with iterators.
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
myk002
31397af99b
cache civzones so lookup is O(1) instead of O(N)
2022-02-26 15:32:25 -08:00
lethosor
e7754ea890
Enable -Wunused-variable and fix most errors
2021-09-07 01:16:21 -04: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
myk002
5b960b97bc
fix comment for Maps::getSize(); add getTileSize()
2021-07-30 13:09:12 -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
96dd249be0
getAnyPlant: use Maps::getPlantAtTile
...
Followup to #1882
2021-06-25 01:08:58 -04:00
Ryan Williams
c5e7a54d97
Rename to getPlantAtTile; remove extra variables
2021-06-23 23:03:22 -07:00
Ryan Williams
b64e28253f
Update Maps.cpp
2021-06-22 20:03:18 -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
aff5c9bf35
add getCursorCoords overload for df::coord
...
and factor out active cursor detection
2021-05-15 12:05:00 -07:00