Working MP

This commit is contained in:
2026-02-07 16:16:23 -05:00
parent c5b4d31f3d
commit 36b6c697e3
8 changed files with 1756 additions and 466 deletions

View File

@@ -88,13 +88,16 @@ function TowBarMod.Utils.updateAttachmentsForRigidTow(towingVehicle, towedVehicl
towedAttachment:setUpdateConstraint(false)
towedAttachment:setZOffset(0)
local offset = towedAttachment:getOffset()
local zShift = offset:z() > 0 and 1 or -1
towedAttachment:getOffset():set(offset:x(), offset:y(), offset:z() + zShift)
local towedModData = towedVehicle:getModData()
towedModData["isChangedTowedAttachment"] = true
towedModData["towBarChangedAttachmentId"] = attachmentB
towedModData["towBarChangedOffsetZShift"] = zShift
local alreadyShifted = towedModData["isChangedTowedAttachment"] and towedModData["towBarChangedAttachmentId"] == attachmentB
if not alreadyShifted then
local offset = towedAttachment:getOffset()
local zShift = offset:z() > 0 and 1 or -1
towedAttachment:getOffset():set(offset:x(), offset:y(), offset:z() + zShift)
towedModData["isChangedTowedAttachment"] = true
towedModData["towBarChangedAttachmentId"] = attachmentB
towedModData["towBarChangedOffsetZShift"] = zShift
end
towedVehicle:transmitModData()
end