Add a hotkey to open the contracts menu directly (Shift+R by default) - #122
Add a hotkey to open the contracts menu directly (Shift+R by default)#122helgehelge123 wants to merge 1 commit into
Conversation
Registers a new global input action CONTRACT_BOOST_OPEN_CONTRACTS that opens the in-game menu directly on the contracts page. Bound to Shift+R by default, rebindable via the game's input settings. The keybind hint is hidden from the F1 help menu to avoid clutter. Includes localized action labels for all 10 supported languages. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
KeilerHirsch
left a comment
There was a problem hiding this comment.
Clean, small feature — the input binding registration follows the standard Utils.overwrittenFunction chaining pattern correctly (calls superFunc first), and it's purely local UI state (no network events involved), so no multiplayer/authority concerns.
One thing worth a second look in openContractsMenu() (scripts/ContractBoost.lua):
local index = inGameMenu.pagingElement:getPageMappingIndexByElement(inGameMenu.pageContracts)
inGameMenu.pageSelector:setState(index, true)The guard above only checks inGameMenu.pageContracts == nil, not whether that page is actually registered in pagingElement's mapping. If contracts are disabled for the current mission/save (game setting), the page object can still exist while never having been added to the pager — in which case getPageMappingIndexByElement returns nil and pageSelector:setState(nil, true) gets called. I haven't been able to test this in-game, so I can't confirm whether setState actually errors on a nil index or just no-ops — flagging as a suspicion, not a confirmed bug. Might be worth an if index ~= nil then ... end guard just to be safe, but not blocking on it since I can't verify it reproduces.
Everything else checks out — nil-safety on inGameMenu/pageContracts, eventId checked before setActionEventTextVisibility. Minor cosmetic nit: modDesc.xml and the Lua file are still missing a trailing newline (pre-existing, not introduced by this PR).
What this adds
A new global input action
CONTRACT_BOOST_OPEN_CONTRACTSthat opens the in-game menu directly on the contracts page — no more clicking through ESC → menu tabs to check contracts.Implementation notes
registerGlobalPlayerActionEventsviaUtils.overwrittenFunction, so it works on foot and in vehiclesopenContractsMenu()resolves the contracts page throughg_inGameMenu(with a fallback tog_gui.screenControllers) and logs a warning instead of erroring if the page can't be foundTested in singleplayer on FS25 with the current main (1.1.2.7) code.
🤖 Generated with Claude Code