Skip to content

Commit

Permalink
#157: Skip blocking of lights, brakes etc when we don't have support …
Browse files Browse the repository at this point in the history
…the hose type in question on the vehicle.
  • Loading branch information
stijnwop committed Mar 10, 2023
1 parent abde44e commit 0b36c89
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/utils/ManualAttachUtil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,29 @@ function ManualAttachUtil.hasAttachedConnectionHoses(object, type)
local inputJointDescIndex = object.spec_attachable.inputAttacherJointDescIndex
local hoses = object:getConnectionHosesByInputAttacherJoint(inputJointDescIndex)

local hasTypeMatch = false
for _, hose in ipairs(hoses) do
if hose ~= nil and object:getIsConnectionHoseUsed(hose) then
if type == nil or ManualAttachConnectionHoses.TYPES_TO_INTERNAL[type][hose.type:upper()] then
if hose ~= nil then
local isConnected = object:getIsConnectionHoseUsed(hose)
if type == nil and isConnected then
return true
end

if type ~= nil then
hasTypeMatch = ManualAttachConnectionHoses.TYPES_TO_INTERNAL[type][(hose.type):upper()]

if hasTypeMatch and isConnected then
return true
end
end
end
end

--We don't have a hose with the type in question
if type ~= nil and not hasTypeMatch then
return true
end

return false
end

Expand Down

0 comments on commit 0b36c89

Please sign in to comment.