Skip to content

Commit 932082b

Browse files
committed
fixed: added canInteract to a protected call
- indicators will only try and draw if on screen
1 parent 54e92de commit 932082b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

client/main.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ local function filterValidOptions(options, entity, distance, coords)
124124
end
125125

126126
if not hide and option.canInteract then
127-
hide = not option.canInteract(entity, distance, coords, option.name)
127+
local success, resp = pcall(option.canInteract, entity, distance, coords, option.name)
128+
hide = not success or not resp
128129
end
129130

130131
if not hide then
@@ -317,7 +318,7 @@ local function checkNearbyEntities(coords)
317318
coords = boneCoords,
318319
currentDistance = #(coords - boneCoords),
319320
currentScreenDistance = utils.getScreenDistanceSquared(boneCoords),
320-
options = { options = _options }
321+
options = { boneId = _options }
321322
}
322323
end
323324
end
@@ -403,8 +404,6 @@ local function drawLoop()
403404

404405
CreateThread(function()
405406
while drawLoopRunning do
406-
Wait(150)
407-
408407
if shouldHideInteract() then
409408
table.wipe(store.nearby)
410409
break
@@ -427,8 +426,7 @@ local function drawLoop()
427426
end
428427

429428
local distance = #(playerCoords - coords)
430-
local validOpts, validCount, hideCompletely = filterValidOptions(item.options, item.entity, distance,
431-
coords)
429+
local validOpts, validCount, hideCompletely = filterValidOptions(item.options, item.entity, distance, coords)
432430
local id = item.bone or item.offset or item.entity or item.coordId
433431
local shouldUpdate = false
434432

@@ -450,6 +448,7 @@ local function drawLoop()
450448
}
451449
end
452450
end
451+
Wait(150)
453452
end
454453
end)
455454

@@ -485,8 +484,9 @@ local function drawLoop()
485484
dui.sendMessage('setOptions', { options = data.validOpts, resetIndex = resetIndex })
486485
end
487486
else
487+
-- lib.print.info(item)
488488
local distance = #(playerCoords - coords)
489-
if distance < config.maxInteractDistance then
489+
if distance < config.maxInteractDistance and item.currentScreenDistance < math.huge then
490490
local distanceRatio = math.min(0.5 + (0.25 * (distance / 10.0)), 1.0)
491491
local scale = 0.025 * distanceRatio
492492
DrawSprite('shared', 'emptydot_32', 0.0, 0.0, scale, scale * aspectRatio, 0.0, r, g, b, a)

0 commit comments

Comments
 (0)