Problem
FarmTabletUI.lua patches g_currentMission.mouseEvent directly instead of using addModEventListener. This approach bypasses the eventUsed contract entirely and can interfere with other mods.
Current code (src/FarmTabletUI.lua ~line 117):
self._oldMouseEvent = g_currentMission.mouseEvent
g_currentMission.mouseEvent = function(mission, px, py, isDown, isUp, btn)
-- custom handler, then:
self._oldMouseEvent(mission, px, py, isDown, isUp, btn)
end
Issues:
- Bypasses
eventUsed — the injected function never receives or returns the eventUsed flag, so other listeners can't signal consumed events
- Fragile chaining — if another mod also monkey-patches
g_currentMission.mouseEvent, the chain breaks depending on load order
- Cleanup risk — if the mod unloads while another mod's patch is in the chain, the restore can leave a dangling closure
Recommended fix
Replace the monkey-patch with addModEventListener, which is the FS25-supported pattern for raw mouse input in mods:
local farmTabletMouseHandler = {}
function farmTabletMouseHandler:mouseEvent(posX, posY, isDown, isUp, button, eventUsed)
if not eventUsed and self.ui then
eventUsed = self.ui:onMouseEvent(posX, posY, isDown, isUp, button, eventUsed) or eventUsed
end
return eventUsed
end
addModEventListener(farmTabletMouseHandler)
On cleanup, use removeModEventListener(farmTabletMouseHandler) — no manual restore needed.
Reference
addModEventListener + eventUsed pattern fixed across multiple mods in FS25_SoilFertilizer commit d5b8f31 (issue TheCodingDad-TisonK/FS25_SoilFertilizer#130). The same pattern is used in FS25_IncomeMod, FS25_TaxMod, and others.
Problem
FarmTabletUI.luapatchesg_currentMission.mouseEventdirectly instead of usingaddModEventListener. This approach bypasses theeventUsedcontract entirely and can interfere with other mods.Current code (src/FarmTabletUI.lua ~line 117):
Issues:
eventUsed— the injected function never receives or returns theeventUsedflag, so other listeners can't signal consumed eventsg_currentMission.mouseEvent, the chain breaks depending on load orderRecommended fix
Replace the monkey-patch with
addModEventListener, which is the FS25-supported pattern for raw mouse input in mods:On cleanup, use
removeModEventListener(farmTabletMouseHandler)— no manual restore needed.Reference
addModEventListener+eventUsedpattern fixed across multiple mods in FS25_SoilFertilizer commitd5b8f31(issue TheCodingDad-TisonK/FS25_SoilFertilizer#130). The same pattern is used in FS25_IncomeMod, FS25_TaxMod, and others.