Skip to content

Commit

Permalink
Fixed BonusVehicles not cleaning up on level swap
Browse files Browse the repository at this point in the history
  • Loading branch information
Hampo committed Jul 3, 2024
1 parent c88f328 commit 045f3ac
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Randomiser/Resources/Modules/Vehicles/BonusVehicles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ local BonusVehicleP3D
local BonusVehicleCON

local function ReplaceCar(Path, P3DFile)
RandomBonusVehicles.Handlers.P3D[3] = nil
for i=3,#RandomBonusVehicles.Handlers.P3D do
RandomBonusVehicles.Handlers.P3D[i] = nil
end

local ReplaceP3D = P3D.P3DFile(BonusVehicleP3D)

Expand Down Expand Up @@ -64,4 +66,13 @@ end
RandomBonusVehicles:AddP3DHandler("art/l?r*.p3d", FindBonusVehicle)
RandomBonusVehicles:AddP3DHandler("art/l?z*.p3d", FindBonusVehicle)

RandomBonusVehicles:AddLevelHandler(function()
for i=3,#RandomBonusVehicles.Handlers.P3D do
RandomBonusVehicles.Handlers.P3D[i] = nil
end
RandomBonusVehicles.Handlers.CON = {}

return false
end)

return RandomBonusVehicles

0 comments on commit 045f3ac

Please sign in to comment.