Skip to content

Fix World::getAdventurer for adventure arena - #5991

Open
Bumber64 wants to merge 5 commits into
DFHack:developfrom
Bumber64:get-adventurer
Open

Bumber64 wants to merge 5 commits into
DFHack:developfrom
Bumber64:get-adventurer

Conversation

@Bumber64

@Bumber64 Bumber64 commented Oct 4, 2026

Copy link
Copy Markdown
Member

Make getAdventurer apply to adventure arena by checking for adventure gamemode instead of isAdventureMode. Also make dwarfmode.lua respect the adventure look cursor for arena.

Tidied up an unnecessary check in createitem.ccp. Units::getProfessionName misbehavior is fixed as a result of the getAdventure change. No visible change to World::GetCurrentSiteId because arena mode always contains 0 sites.

Update docs to clarify that isAdventureMode doesn't cover arena mode.

reveal.cpp remains unavailable in arena mode, as swapping back to dwarf arena doesn't trigger SC_WORLD_UNLOADED to reset state.

* Update World.cpp - Fix getAdventurer in arena
* Update createitem.cpp - Simplify adventurer check
* Update dwarfmode.lua - Fix adventure arena look cursor
* Update Lua API.rst - Improve isAdventureMode doc
* Update changelog.txt
* Update Lua API.rst
* Update dwarfmode.lua
@Bumber64
Bumber64 marked this pull request as ready for review October 5, 2026 18:32

@SilasD SilasD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally OK with this.

there is one thing I'd like added, but I don't consider it mandatory.

Comment thread library/lua/gui/dwarfmode.lua
Comment thread library/lua/gui/dwarfmode.lua
Comment thread library/lua/gui/dwarfmode.lua Outdated
local u = dfhack.world.getAdventurer()
if u and u.pos:isValid() then
if u and u.pos:isValid() then -- recenter on adventurer
a_look.cursor = copyall(u.pos)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"recenter on adventurer". does that move the main map or just the cursor? does this work if the Z level is different?

presumably dfhack.gui.revealInDwarfmodeMap() doesn't work; both because "Dwarfmode" is in the name and because it's in the "Fortress mode" section.

this module has some functions with names suggesting they might zoom, but the whole thing looks bitrotted to me. it needs fumigated.

a problem for another day though.

@Bumber64 Bumber64 Oct 6, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just moves the cursor. If you nudge the cursor without closing the menu, the view should snap to it.

IIRC, the reveal function actually works in adv mode? But we aren't moving the view for dwarf mode, either. These are strictly cursor functions, and DF uses the global cursor for internal stuff sometimes.

I've switched to using units.getPosition instead of using the raw pos, just in case the adventurer is mounted, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants