qbcore-framework/qb-truckerjob

[BUG] Check for open doors when doors are broke off.. Returns closed.

Opened this issue · 0 comments

Describe the bug
A player was working this job in the pounder truck and broke off the two swinging back doors. since they are gone they are not going to read how far open they are nor register as opened when you do F1 and open them. Obviously the solution is to fix them, but some players can run into them while open and they just fall of.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the job and select pounder, do first delivery.
  2. after first delivery is done Doors still open run into them or break them off <back into something if they are not just falling off opening them too far and forcing them to break off.
  3. Get back into truck go to next delivery spot, now that the doors are broke off, it will not detect the doors open when opened from F1 vehicles open back doors.
  4. when trying to pull the delivery off the truck it errors to backdoors_not_open = "The backdoors of the vehicle aren't open",

Screenshots
https://gyazo.com/09749ffb4497640edec3125db1c1fb30

Additional context
I did modify the following code to first check if the doors were damaged and return the correct value for OPENED if so. Looks like this..
/qb-truckerjob/client/main.lua Line 314 or so..

local function BackDoorsOpen(vehicle)
    local tv = getTruckerVehicle(vehicle)
    local cnt = TableCount(Config.TruckerJobVehicles[tv].cargodoors)
    if isTruckerVehicle(vehicle) then
        if cnt == 2 then
            if IsVehicleDoorDamaged(vehicle, Config.TruckerJobVehicles[tv].cargodoors[0]) and IsVehicleDoorDamaged(vehicle, Config.TruckerJobVehicles[tv].cargodoors[1]) then
                return 1.0, 1.0
            else
                return GetVehicleDoorAngleRatio(vehicle, Config.TruckerJobVehicles[tv].cargodoors[0]) > 0.0 and GetVehicleDoorAngleRatio(vehicle, Config.TruckerJobVehicles[tv].cargodoors[1]) > 0.0
            end
        elseif cnt == 1 then
            if IsVehicleDoorDamaged(vehicle, Config.TruckerJobVehicles[tv].cargodoors[0]) then
                return 1.0
            else
                return GetVehicleDoorAngleRatio(vehicle, Config.TruckerJobVehicles[tv].cargodoors[0]) > 0.0
            end
        end
    end
end

Tried to replicate error with new code and no problems. If the intent was to make the player repair the truck before continuing job then this is not an issue, however game mechanics be damned as it is possible for a player to knock them off accidentally.. so if this is not a bug and more of a feature.. added code changes for those who can't deal with it.