Stop making issues with regular trailers
This commit is contained in:
@@ -304,12 +304,6 @@ function TowBarMod.Hook.hasTowBarTowData(vehicle)
|
|||||||
return modData and modData["isTowingByTowBar"] and modData["towed"]
|
return modData and modData["isTowingByTowBar"] and modData["towed"]
|
||||||
end
|
end
|
||||||
|
|
||||||
function TowBarMod.Hook.isTowBarLinkActive(towingVehicle, towedVehicle)
|
|
||||||
if not towingVehicle or not towedVehicle then return false end
|
|
||||||
return towingVehicle:getVehicleTowing() == towedVehicle
|
|
||||||
and towedVehicle:getVehicleTowedBy() == towingVehicle
|
|
||||||
end
|
|
||||||
|
|
||||||
function TowBarMod.Hook.queueTowBarReapply(vehicle)
|
function TowBarMod.Hook.queueTowBarReapply(vehicle)
|
||||||
if not TowBarMod.Hook.hasTowBarTowData(vehicle) then return end
|
if not TowBarMod.Hook.hasTowBarTowData(vehicle) then return end
|
||||||
local vehicleId = vehicle:getId()
|
local vehicleId = vehicle:getId()
|
||||||
@@ -341,13 +335,6 @@ function TowBarMod.Hook.tryTowBarReapply(vehicle, playerObj)
|
|||||||
vehicle:transmitModData()
|
vehicle:transmitModData()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Save/load already restores a valid tow link. Do not stack another attach on top.
|
|
||||||
if TowBarMod.Hook.isTowBarLinkActive(towingVehicle, vehicle) then
|
|
||||||
TowBarMod.Hook.setVehiclePostAttach(playerObj, vehicle)
|
|
||||||
TowBarMod.Hook.markReapplied(vehicle)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
playerObj = playerObj or getPlayer()
|
playerObj = playerObj or getPlayer()
|
||||||
if not playerObj then return false end
|
if not playerObj then return false end
|
||||||
|
|
||||||
@@ -367,6 +354,9 @@ function TowBarMod.Hook.tryTowBarReapply(vehicle, playerObj)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function TowBarMod.Hook.reapplyTowBarPostLoad(vehicle)
|
function TowBarMod.Hook.reapplyTowBarPostLoad(vehicle)
|
||||||
|
if not TowBarMod.Hook.hasTowBarTowData(vehicle) then
|
||||||
|
return
|
||||||
|
end
|
||||||
TowBarMod.Hook.queueTowBarReapply(vehicle)
|
TowBarMod.Hook.queueTowBarReapply(vehicle)
|
||||||
TowBarMod.Hook.tryTowBarReapply(vehicle, getPlayer())
|
TowBarMod.Hook.tryTowBarReapply(vehicle, getPlayer())
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name=Towbars
|
name=Towbars
|
||||||
id=hrsys_towbars
|
id=hrsys_towbars_testing
|
||||||
poster=../common/media/textures/preview.png
|
poster=../common/media/textures/preview.png
|
||||||
description=Towbar Towing Towed Towing Towbars. The thrid
|
description=Towbar Towing Towed Towing Towbars. The thrid
|
||||||
author=Riggs0
|
author=Riggs0
|
||||||
|
|||||||
Reference in New Issue
Block a user