Skip to content

Commit

Permalink
Name changed
Browse files Browse the repository at this point in the history
  • Loading branch information
4c65736975 committed Feb 9, 2023
1 parent 5679a24 commit 62e3807
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ Po więcej informacji, pomoc lub zgłoszenie błędu, odwiedź stronę <a href='
</description>

<extraSourceFiles>
<sourceFile filename='src/AttachFix.lua'/>
<sourceFile filename='src/NoMoreAutoLift.lua'/>
</extraSourceFiles>
</modDesc>
36 changes: 19 additions & 17 deletions src/AttachFix.lua → src/NoMoreAutoLift.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- @author: 4c65736975, All Rights Reserved
-- @version: 1.0.0.3, 08/02/2023
-- @filename: AttachFix.lua
-- @filename: NoMoreAutoLift.lua

-- Changelog (1.0.0.1) :
--
Expand All @@ -15,17 +15,19 @@
--
-- cleaned code

AttachFix = {}
NoMoreAutoLift = {}

function AttachFix:loadMap(filename)
local manualAttach = nil

function NoMoreAutoLift:loadMap(filename)
self.isNotLowered = false
self.allowedJointTypes = nil

g_messageCenter:subscribe(BuyVehicleEvent, self.onVehicleBought, self)
g_messageCenter:subscribe(MessageType.VEHICLE_RESET, self.onVehicleReset, self)
end

function AttachFix:update(dt)
function NoMoreAutoLift:update(dt)
local controlledVehicle = g_currentMission.controlledVehicle

self.isNotLowered = false
Expand All @@ -43,7 +45,7 @@ function AttachFix:update(dt)
end
end

function AttachFix:setImplementsLoweredOnAttach(isManualAttach)
function NoMoreAutoLift:setImplementsLoweredOnAttach(isManualAttach)
for _, vehicle in pairs(g_currentMission.vehicles) do
if vehicle ~= nil then
if SpecializationUtil.hasSpecialization(Attachable, vehicle.specializations) then
Expand Down Expand Up @@ -73,27 +75,27 @@ function AttachFix:setImplementsLoweredOnAttach(isManualAttach)
end
end

function AttachFix:onVehicleBought()
function NoMoreAutoLift:onVehicleBought()
if manualAttach ~= nil then
self:setImplementsLoweredOnAttach(manualAttach.isEnabled)
else
self:setImplementsLoweredOnAttach(false)
end
end

function AttachFix:onVehicleReset()
function NoMoreAutoLift:onVehicleReset()
if manualAttach ~= nil then
self:setImplementsLoweredOnAttach(manualAttach.isEnabled)
else
self:setImplementsLoweredOnAttach(false)
end
end

function AttachFix:onManualAttachModeChanged()
AttachFix:setImplementsLoweredOnAttach(manualAttach.isEnabled)
function NoMoreAutoLift:onManualAttachModeChanged()
NoMoreAutoLift:setImplementsLoweredOnAttach(manualAttach.isEnabled)
end

function AttachFix:getIsAttachableObjectDynamicMounted(object)
function NoMoreAutoLift:getIsAttachableObjectDynamicMounted(object)
for _, vehicle in pairs(g_currentMission.vehicles) do
if vehicle ~= nil then
if SpecializationUtil.hasSpecialization(DynamicMountAttacher, vehicle.specializations) then
Expand All @@ -109,7 +111,7 @@ function AttachFix:getIsAttachableObjectDynamicMounted(object)
return false
end

function AttachFix:getIsAttachableObjectPendingDynamicMount(object)
function NoMoreAutoLift:getIsAttachableObjectPendingDynamicMount(object)
for _, vehicle in pairs(g_currentMission.vehicles) do
if vehicle ~= nil then
if SpecializationUtil.hasSpecialization(DynamicMountAttacher, vehicle.specializations) then
Expand All @@ -125,25 +127,25 @@ function AttachFix:getIsAttachableObjectPendingDynamicMount(object)
return false
end

function AttachFix:deleteMap()
function NoMoreAutoLift:deleteMap()
g_messageCenter:unsubscribeAll(self)
end

addModEventListener(AttachFix)
addModEventListener(NoMoreAutoLift)

local function onFinishedLoading()
local isManualAttach = false

if g_modIsLoaded['FS22_manualAttach'] then
manualAttach = _G['FS22_manualAttach'].g_manualAttach
manualAttach.onManualAttachModeChanged = Utils.appendedFunction(manualAttach.onManualAttachModeChanged, AttachFix.onManualAttachModeChanged)
manualAttach.onManualAttachModeChanged = Utils.appendedFunction(manualAttach.onManualAttachModeChanged, NoMoreAutoLift.onManualAttachModeChanged)

AttachFix.allowedJointTypes = manualAttach.AUTO_ATTACH_JOINTYPES
NoMoreAutoLift.allowedJointTypes = manualAttach.AUTO_ATTACH_JOINTYPES

isManualAttach = manualAttach.isEnabled
end

AttachFix:setImplementsLoweredOnAttach(isManualAttach)
NoMoreAutoLift:setImplementsLoweredOnAttach(isManualAttach)
end

FSBaseMission.onFinishedLoading = Utils.prependedFunction(FSBaseMission.onFinishedLoading, onFinishedLoading)
Expand Down Expand Up @@ -181,7 +183,7 @@ local function attachImplementFromInfo(info)
local attacherVehicleJointDescIndex = info.spec_attacherJoints.attachableInfo.attacherVehicleJointDescIndex

if attacherVehicleJointDescIndex ~= nil then
if AttachFix.isNotLowered then
if NoMoreAutoLift.isNotLowered then
info:setJointMoveDown(attacherVehicleJointDescIndex, false, true)
end
end
Expand Down

0 comments on commit 62e3807

Please sign in to comment.