marker fix
wasnt drawing at the correct location just the first location. cleaned up prints in particles
This commit is contained in:
1 parent
b39e9afb2f
commit
340b57d301
3 files changed
+13
-73
No files matched your search
@@ -37,7 +37,6 @@ function Marker.Create(data)
|
||||
local data = {
|
||||
id = _id,
|
||||
position = vector3(basePosition.x + baseOffset.x, basePosition.y + baseOffset.y, basePosition.z + baseOffset.z),
|
||||
offset = baseOffset,
|
||||
marker = data.marker or 1,
|
||||
rotation = data.rotation or vector3(0, 0, 0),
|
||||
size = data.size or vector3(1.0, 1.0, 1.0),
|
||||
@@ -57,7 +56,7 @@ function Marker.Create(data)
|
||||
function(_)
|
||||
if not Created[_id] then return point.Remove(_id) end
|
||||
Drawing[_id] = Created[_id]
|
||||
Marker.Run(Drawing[_id])
|
||||
Marker.Run()
|
||||
end,
|
||||
function(markerData)
|
||||
Drawing[_id] = nil
|
||||
@@ -89,25 +88,29 @@ end
|
||||
-- This will loop through all marker(points) in range and draw them.
|
||||
-- @param data table{marker: number, position: vector3, rotation: vector3, size: vector3, color: vector3, alpha: number, bobUpAndDown: boolean, faceCamera: boolean, rotate: boolean, textureDict: string, textureName: string, drawOnEnts: boolean}
|
||||
-- @return nil
|
||||
function Marker.Run(data)
|
||||
function Marker.Run()
|
||||
if loopRunning then return end
|
||||
loopRunning = true
|
||||
CreateThread(function()
|
||||
while loopRunning do
|
||||
if not next(Created) then
|
||||
loopRunning = false
|
||||
return
|
||||
end
|
||||
for drawingId, drawingData in pairs(Drawing) do
|
||||
if not Created[drawingId] then
|
||||
Drawing[drawingId] = nil
|
||||
goto continue
|
||||
end
|
||||
DrawMarker(
|
||||
data.marker,
|
||||
data.position.x, data.position.y, data.position.z,
|
||||
drawingData.marker,
|
||||
drawingData.position.x, drawingData.position.y, drawingData.position.z,
|
||||
0.0, 0.0, 0.0,
|
||||
data.rotation.x, data.rotation.y, data.rotation.z,
|
||||
data.size.x, data.size.y, data.size.z,
|
||||
data.color.x, data.color.y, data.color.z, data.alpha,
|
||||
data.bobUpAndDown, data.faceCamera, false,
|
||||
data.rotate, data.textureDict, data.textureName, data.drawOnEnts
|
||||
drawingData.rotation.x, drawingData.rotation.y, drawingData.rotation.z,
|
||||
drawingData.size.x, drawingData.size.y, drawingData.size.z,
|
||||
drawingData.color.x, drawingData.color.y, drawingData.color.z, drawingData.alpha,
|
||||
drawingData.bobUpAndDown, drawingData.faceCamera, false,
|
||||
drawingData.rotate, drawingData.textureDict, drawingData.textureName, drawingData.drawOnEnts
|
||||
)
|
||||
::continue::
|
||||
end
|
||||
@@ -138,50 +141,6 @@ RegisterNetEvent("community_bridge:Client:MarkerRemoveBulk", function(ids)
|
||||
end
|
||||
end)
|
||||
|
||||
-- local loopRunning = false
|
||||
-- function Marker.Draw()
|
||||
-- if loopRunning then return end
|
||||
-- loopRunning = true
|
||||
-- while loopRunning do
|
||||
-- Wait(0)
|
||||
-- if not next(Created) then
|
||||
-- Wait(1000) -- Reduce CPU usage when no markers are present
|
||||
-- goto continue
|
||||
-- end
|
||||
|
||||
-- for id, _ in pairs(Created) do
|
||||
-- if Created[id] then
|
||||
-- local data = Created[id]
|
||||
-- if #(data.position - GetEntityCoords(PlayerPedId())) > 100.0 then
|
||||
-- goto continue
|
||||
-- else
|
||||
-- DrawMarker(
|
||||
-- data.marker,
|
||||
-- data.position.x, data.position.y, data.position.z,
|
||||
-- 0.0, 0.0, 0.0,
|
||||
-- data.rotation.x, data.rotation.y, data.rotation.z,
|
||||
-- data.size.x, data.size.y, data.size.z,
|
||||
-- data.color.x, data.color.y, data.color.z, data.alpha,
|
||||
-- data.bobUpAndDown, data.faceCamera, false,
|
||||
-- data.rotate, data.textureDict, data.textureName, data.drawOnEnts
|
||||
-- )
|
||||
-- -- if data.interaction then
|
||||
-- -- local playerCoords = GetEntityCoords(PlayerPedId())
|
||||
-- -- local distance = #(data.position - playerCoords)
|
||||
-- -- if distance < 2.0 then
|
||||
-- -- if IsControlJustReleased(0, 38) then -- E key
|
||||
-- -- data.interaction(data.id)
|
||||
-- -- end
|
||||
-- -- end
|
||||
-- -- end
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- ::continue::
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- Marker.Draw() -- Start the marker drawing loop
|
||||
exports("Marker", Marker)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user