Conversation
* 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
SilasD
left a comment
There was a problem hiding this comment.
I'm generally OK with this.
there is one thing I'd like added, but I don't consider it mandatory.
| a_look.cursor = copyall(cursor) | ||
| else | ||
| df.global.cursor = copyall(cursor) |
There was a problem hiding this comment.
clearly this works, but I'm not sure why. I wouldn;t have expected this to succeed, I would have used :assign instead:
a_look.cursor:assign(copyall(cursor))but it's fine as-is.
| function setCursorPos(cursor) | ||
| if dfhack.world.isAdventureMode() then | ||
| if df.global.gamemode == df.game_mode.ADVENTURE then |
There was a problem hiding this comment.
in general I don't like reading or writing to anything under game.main_interface without checking that {viewsheet}.open is true every time.
I think it's okay here, it's just writing three integers. still not best practice.
Edit: getCursorPos() and clearCursorPos() both have that test.
yeah, I'd prefer you to add that test here. it really is best practice for dealing with such a fragile part of DF.
Edit2: softened wording. the change is preferable but not necessary.
| 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) |
There was a problem hiding this comment.
"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.
Make
getAdventurerapply to adventure arena by checking for adventuregamemodeinstead ofisAdventureMode. Also makedwarfmode.luarespect the adventure look cursor for arena.Tidied up an unnecessary check in
createitem.ccp.Units::getProfessionNamemisbehavior is fixed as a result of thegetAdventurechange. No visible change toWorld::GetCurrentSiteIdbecause arena mode always contains 0 sites.Update docs to clarify that
isAdventureModedoesn't cover arena mode.reveal.cppremains unavailable in arena mode, as swapping back to dwarf arena doesn't triggerSC_WORLD_UNLOADEDto reset state.