Skip to content

Commit 7971a49

Browse files
committed
Fixed some leftover hud zoom code
1 parent f6417fe commit 7971a49

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

scripts/gui/hud/CpBaseHud.lua

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,18 +296,6 @@ function CpBaseHud:init(vehicle)
296296
self:openCourseGeneratorGui(vehicle)
297297
end)
298298

299-
300-
---- Disables zoom, while mouse is over the cp hud.
301-
local function disableCameraZoomOverHud(vehicle, superFunc, ...)
302-
if vehicle.getIsMouseOverCpHud and vehicle:getIsMouseOverCpHud() then
303-
return
304-
end
305-
return superFunc(vehicle, ...)
306-
end
307-
308-
Enterable.actionEventCameraZoomIn = Utils.overwrittenFunction(Enterable.actionEventCameraZoomIn, disableCameraZoomOverHud)
309-
Enterable.actionEventCameraZoomOut = Utils.overwrittenFunction(Enterable.actionEventCameraZoomOut, disableCameraZoomOverHud)
310-
311299
self.baseHud:setVisible(false)
312300

313301
self.baseHud:setScale(self.uiScale, self.uiScale)

scripts/specializations/CpHud.lua

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ function CpHud.registerFunctions(vehicleType)
7878
end
7979

8080
function CpHud.registerOverwrittenFunctions(vehicleType)
81-
if vehicleType.functions["enterVehicleRaycastClickToSwitch"] ~= nil then
81+
if vehicleType.functions["enterVehicleRaycastClickToSwitch"] ~= nil then
8282
SpecializationUtil.registerOverwrittenFunction(vehicleType, "enterVehicleRaycastClickToSwitch", CpHud.enterVehicleRaycastClickToSwitch)
83-
end
84-
SpecializationUtil.registerOverwrittenFunction(vehicleType, 'getCpStartText', CpHud.getCpStartText)
83+
end
84+
SpecializationUtil.registerOverwrittenFunction(vehicleType, 'getCpStartText', CpHud.getCpStartText)
85+
SpecializationUtil.registerOverwrittenFunction(vehicleType, 'actionEventCameraZoomInOut', CpHud.actionEventCameraZoomInOut)
8586
end
8687

8788
--- Disables the click to switch action, while the mouse is over the cp hud.
@@ -104,7 +105,7 @@ function CpHud:onRegisterActionEvents(isActiveForInput, isActiveForInputIgnoreSe
104105
if self.isClient then
105106
local spec = self.spec_cpHud
106107
self:clearActionEventsTable(spec.actionEvents)
107-
if self.isActiveForInputIgnoreSelectionIgnoreAI then
108+
if self.isActiveForInputIgnoreSelectionIgnoreAI and self.propertyState ~= VehiclePropertyState.SHOP_CONFIG then
108109
--- Toggle mouse cursor action event
109110
--- Parameters:
110111
--- (actionEventsTable, inputAction, target,
@@ -312,6 +313,14 @@ function CpHud:onLeaveVehicle(wasEntered)
312313
end
313314
end
314315

316+
---- Disables zoom, while mouse is over the cp hud.
317+
function CpHud:actionEventCameraZoomInOut(self, superFunc, ...)
318+
if self:getIsMouseOverCpHud() then
319+
return
320+
end
321+
return superFunc(self, ...)
322+
end
323+
315324
function CpHud:onStateChange(state, data)
316325
local spec = self.spec_cpHud
317326
if state == VehicleStateChange.ATTACH or state == VehicleStateChange.DETACH then

0 commit comments

Comments
 (0)