Skip to content

Commit a9abf10

Browse files
committed
Move vehicle check inside, better naming for vars
1 parent 000cf3a commit a9abf10

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

[gameplay]/glue/logic/ShVehicleAttach.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,17 @@ function canPlayerAttachElementToVehicle(playerElement, attachElement, attachToE
3737

3838
local attachElementPlayer = (allowedElementType == "player")
3939
local attachElementVehicle = (allowedElementType == "vehicle")
40-
local playerVehicle = getPedOccupiedVehicle(playerElement)
4140

4241
if (attachElementPlayer) then
43-
local elementPlayerSelfAttach = (playerElement == attachElement)
42+
local attachPlayerSelf = (playerElement == attachElement)
4443

45-
if (not elementPlayerSelfAttach) then
44+
if (not attachPlayerSelf) then
4645
return false
4746
end
4847

49-
if (playerVehicle) then
48+
local attachPlayerVehicle = getPedOccupiedVehicle(attachElement)
49+
50+
if (attachPlayerVehicle) then
5051
return false
5152
end
5253

@@ -192,9 +193,9 @@ function canPlayerDetachElementFromVehicle(playerElement, detachElement)
192193
local detachElementVehicleType = (allowedElementType == "vehicle")
193194

194195
if (detachElementPlayerType) then
195-
local elementPlayerSelfDetach = (playerElement == detachElement)
196+
local detachPlayerSelf = (playerElement == detachElement)
196197

197-
if (not elementPlayerSelfDetach) then
198+
if (not detachPlayerSelf) then
198199
return false
199200
end
200201
end

0 commit comments

Comments
 (0)