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

@@ -126,6 +126,23 @@ function TowBarMod.UI.addUnhookOptionToMenu(playerObj, vehicle)
)
end
function TowBarMod.UI.addDriverReattachOptionToMenu(playerObj, towingVehicle)
local menu = getPlayerRadialMenu(playerObj:getPlayerNum())
if menu == nil then return end
if not towingVehicle then return end
if not towingVehicle:isDriver(playerObj) then return end
if not towingVehicle:getVehicleTowing() then return end
if not towingVehicle:getModData()["isTowingByTowBar"] then return end
menu:addSlice(
"Reattach Towbar (Debug)",
getTexture("media/textures/tow_bar_attach.png"),
TowBarMod.Hook.reattachTowBarFromDriverSeat,
playerObj,
towingVehicle
)
end
---------------------------------------------------------------------------
--- Mod compability
---------------------------------------------------------------------------
@@ -146,9 +163,17 @@ end
function ISVehicleMenu.showRadialMenu(playerObj)
TowBarMod.UI.defaultShowRadialMenu(playerObj)
if playerObj:getVehicle() then return end
local vehicle = playerObj:getVehicle()
if vehicle then
if vehicle:isDriver(playerObj) and vehicle:getVehicleTowing() and vehicle:getModData()["isTowingByTowBar"] then
TowBarMod.UI.removeDefaultDetachOption(playerObj)
TowBarMod.UI.addUnhookOptionToMenu(playerObj, vehicle)
TowBarMod.UI.addDriverReattachOptionToMenu(playerObj, vehicle)
end
return
end
local vehicle = ISVehicleMenu.getVehicleToInteractWith(playerObj)
vehicle = ISVehicleMenu.getVehicleToInteractWith(playerObj)
if vehicle == nil then return end
if vehicle:getModData()["isTowingByTowBar"] then