Skip to content

Commit de2020b

Browse files
Hotfix v1.1.4.1 — HUD edit mode via dedicated key binding
* fix: stop unconditionally consuming RMB in TaxHUD mouse handler TaxHUD returned true for every RMB event regardless of whether the cursor was over the HUD, silently starving IncomeMod, NPCFavor, and other mods of their right-click events. Now returns false when neither in edit mode nor cursor-over-HUD, matching the SoilFertilizer pattern. Fixes #51 (reported via FS25_FarmTablet) * chore: bump version to 1.1.4.1 * chore: add release zip v1.1.4.1 * fix: enter HUD edit mode via TM_HUD_DRAG key binding, not RMB Ports the SoilFertilizer pattern: edit mode is entered exclusively via a dedicated key binding (TM_HUD_DRAG). RMB now only exits edit mode when already active, and never consumes the event otherwise — preserving CoursePlay, AutoDrive, and all other mods that rely on right-click. Added TM_HUD_DRAG input action with PLAYER context registration and cleanup. * chore: rebuild zip with correct HUD edit mode key binding fix
1 parent 110cc99 commit de2020b

4 files changed

Lines changed: 49 additions & 6 deletions

File tree

FS25_TaxMod.zip

95.9 KB
Binary file not shown.

main.lua

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,16 +433,39 @@ local function onLoad(mission)
433433
if ok and id then
434434
FS25TaxMod.toggleHUDEventId = id
435435
g_inputBinding:setActionEventTextPriority(id, GS_PRIO_NORMAL)
436-
437436
log("HUD toggle registered", 2)
438437
else
439438
log("HUD toggle registration failed", 1)
440439
end
440+
441+
-- HUD drag (enter/exit edit mode) — PLAYER context
442+
local dragOk, dragId = g_inputBinding:registerActionEvent(
443+
InputAction.TM_HUD_DRAG,
444+
FS25TaxMod,
445+
FS25TaxMod.onHUDDragInput,
446+
false, true, false, true
447+
)
448+
if dragOk and dragId then
449+
FS25TaxMod.hudDragEventId = dragId
450+
g_inputBinding:setActionEventText(dragId, g_i18n:getText("input_TM_HUD_DRAG") or "Tax HUD Edit Mode")
451+
log("HUD drag registered", 2)
452+
end
453+
441454
g_inputBinding:endActionEventsModification()
442455
end
443456
end
444457
end
445458

459+
function FS25TaxMod:onHUDDragInput()
460+
if not taxHUD then return end
461+
if not taxHUD.visible then return end
462+
if taxHUD.editMode then
463+
taxHUD:exitEditMode()
464+
else
465+
taxHUD:enterEditMode()
466+
end
467+
end
468+
446469
function FS25TaxMod:onToggleHUDInput()
447470
if taxHUD then
448471
taxHUD:toggleVisibility()
@@ -506,6 +529,10 @@ local function onUnload()
506529
g_inputBinding:removeActionEvent(FS25TaxMod.toggleHUDEventId)
507530
FS25TaxMod.toggleHUDEventId = nil
508531
end
532+
if FS25TaxMod.hudDragEventId and g_inputBinding then
533+
g_inputBinding:removeActionEvent(FS25TaxMod.hudDragEventId)
534+
FS25TaxMod.hudDragEventId = nil
535+
end
509536
if FS25TaxMod._inputHookOriginal and PlayerInputComponent then
510537
PlayerInputComponent.registerActionEvents = FS25TaxMod._inputHookOriginal
511538
FS25TaxMod._inputHookOriginal = nil

modDesc.xml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/NMC-TBone/xml-schema/main/modDesc.xsd">
55

66
<author>TisonK</author>
7-
<version>1.1.4.0</version>
7+
<version>1.1.4.1</version>
88

99
<title>
1010
<en>Tax Mod</en>
@@ -386,22 +386,36 @@ Funkcje:
386386
<it><![CDATA[Attiva/disattiva HUD fiscale]]></it>
387387
<pl><![CDATA[Przełącz HUD podatkowy]]></pl>
388388
<uk><![CDATA[Перемкнути HUD податків]]></uk>
389-
390389
<cz>[EN] <![CDATA[Toggle Tax HUD]]></cz>
391390
<br>[EN] <![CDATA[Toggle Tax HUD]]></br>
392391
<ru>[EN] <![CDATA[Toggle Tax HUD]]></ru>
393392
<da>[EN] <![CDATA[Toggle Tax HUD]]></da>
394393
</text>
394+
<text name="input_TM_HUD_DRAG">
395+
<en>Tax HUD Edit Mode</en>
396+
<de>Steuer-HUD-Bearbeitungsmodus</de>
397+
<fr>[EN] Tax HUD Edit Mode</fr>
398+
<es>[EN] Tax HUD Edit Mode</es>
399+
<it>[EN] Tax HUD Edit Mode</it>
400+
<pl>[EN] Tax HUD Edit Mode</pl>
401+
<uk>[EN] Tax HUD Edit Mode</uk>
402+
<cz>[EN] Tax HUD Edit Mode</cz>
403+
<br>[EN] Tax HUD Edit Mode</br>
404+
<ru>[EN] Tax HUD Edit Mode</ru>
405+
<da>Skat HUD-redigeringstilstand</da>
406+
</text>
395407
</l10n>
396408

397409
<actions>
398410
<action name="TM_TOGGLE_HUD" category="ONFOOT" />
411+
<action name="TM_HUD_DRAG" category="ONFOOT" />
399412
</actions>
400413

401414
<inputBinding>
402415
<actionBinding action="TM_TOGGLE_HUD">
403416
<binding device="KB_MOUSE_DEFAULT" input="KEY_T" />
404417
</actionBinding>
418+
<actionBinding action="TM_HUD_DRAG" />
405419
</inputBinding>
406420

407421
</modDesc>

src/ui/TaxHUD.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,15 @@ end
252252
function TaxHUD:onMouseEvent(posX, posY, isDown, isUp, button, eventUsed)
253253
if not self.visible then return false end
254254

255+
-- RMB: exit edit mode only. Edit mode is entered exclusively via the
256+
-- TM_HUD_DRAG key binding — never via right-click — so RMB is never
257+
-- consumed during normal play, preserving CoursePlay, AutoDrive, etc.
255258
if isDown and button == 3 then
256259
if self.editMode then
257260
self:exitEditMode()
258-
elseif self:isPointerOverHUD(posX, posY) then
259-
self:enterEditMode()
261+
return true
260262
end
261-
return true
263+
return false
262264
end
263265

264266
if not self.editMode then return false end

0 commit comments

Comments
 (0)