Skip to content

Commit

Permalink
Lua: sync with c# changes
Browse files Browse the repository at this point in the history
  • Loading branch information
manups4e committed Mar 11, 2024
1 parent 23bf589 commit 9419200
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ FakeBlip.__call = function()
end

---@class FakeBlip
---@field private New fun(sprite:number, position:vector3)
---@field private New fun(sprite:number, position:vector3, color:HudColours, scale:number)
---@field public Sprite number
---@field public Position vector3

function FakeBlip.New(sprite, position)
function FakeBlip.New(sprite, position, color, scale)
local _data = {
Sprite = sprite,
Position = position
Position = position,
Scale = scale or 0.0,
Color = color or HudColours.HUD_COLOUR_WHITE
}
return setmetatable(_data, FakeBlip)
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ MinimapRaceCheckpoint.__call = function()
end

---@class MinimapRaceCheckpoint
---@field private New fun(sprite:number, position:vector3)
---@field private New fun(sprite:number, position:vector3, color:HudColours, scale:number)
---@field public Sprite number
---@field public Position vector3

function MinimapRaceCheckpoint.New(sprite, position)
function MinimapRaceCheckpoint.New(sprite, position, color, scale)
local _data = {
Sprite = sprite,
Position = position
Position = position,
Scale = scale or 0.0,
Color = color or HudColours.HUD_COLOUR_WHITE
}
return setmetatable(_data, MinimapRaceCheckpoint)
end
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function MinimapRoute.New()
StartPoint = MinimapRaceCheckpoint.New(0, vector3(0,0,0)),
EndPoint = MinimapRaceCheckpoint.New(0, vector3(0,0,0)),
CheckPoints = {},
RadarThickness = 18,
MapThickness = 30,
RouteColor = HudColours.HUD_COLOUR_FREEMODE
}
Expand All @@ -30,7 +29,9 @@ function MinimapRoute:SetupCustomRoute()
if self.StartPoint == nil or self.StartPoint.Position.x == 0 or self.StartPoint.Position.y == 0 or self.StartPoint.Position.z == 0 then
return
end


ClearGpsFlags()
SetGpsFlags(8, 0.0)
StartGpsCustomRoute(self.RouteColor, true, true)

RaceGalleryNextBlipSprite(self.StartPoint.Sprite)
Expand All @@ -41,13 +42,17 @@ function MinimapRoute:SetupCustomRoute()
for i=1,#self.CheckPoints, 1 do
local checkPoint = self.CheckPoints[i]
RaceGalleryNextBlipSprite(checkPoint.Sprite)
RaceGalleryAddBlip(checkPoint.Position.x, checkPoint.Position.y, checkPoint.Position.z)
local b = RaceGalleryAddBlip(checkPoint.Position.x, checkPoint.Position.y, checkPoint.Position.z)
if checkPoint.Scale > 0 then
SetBlipScale(b, checkPoint.Scale)
end
SetBlipColour(b, checkPoint.Color)
AddPointToGpsCustomRoute(checkPoint.Position.x, checkPoint.Position.y, checkPoint.Position.z)
end

RaceGalleryNextBlipSprite(self.EndPoint.Sprite)
RaceGalleryAddBlip(self.EndPoint.Position.x, self.EndPoint.Position.y, self.EndPoint.Position.z)
AddPointToGpsCustomRoute(self.EndPoint.Position.x, self.EndPoint.Position.y, self.EndPoint.Position.z)

SetGpsCustomRouteRender(true, self.RadarThickness * 10, self.MapThickness * 10)
SetGpsCustomRouteRender(true, 18, self.MapThickness)
end
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ end
function MinimapPanel:SetupBlips()
for _,blip in pairs (self.MinimapBlips) do
RaceGalleryNextBlipSprite(blip.Sprite)
RaceGalleryAddBlip(blip.Position.x, blip.Position.y, blip.Position.z)
local b = RaceGalleryAddBlip(blip.Position.x, blip.Position.y, blip.Position.z)
if blip.Scale > 0 then
SetBlipScale(b, blip.Scale)
end
SetBlipColour(b, blip.Color)
end
end
function MinimapPanel:MaintainMap()
Expand All @@ -174,6 +178,7 @@ function MinimapPanel:ProcessMap()
self:Dispose()
end
end
SetPlayerBlipPositionThisFrame(-5000.0, -5000.0)
self:RefreshZoom()
end
function MinimapPanel:InitializeMapDisplay()
Expand Down

0 comments on commit 9419200

Please sign in to comment.