Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/interact/points.lua
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ function points.update(id, data)
p.lineOfSight = data.lineOfSight == true
end

if p.interactDistance > p.distance then
p.distance = p.interactDistance
end

if data.coords and p.kind == 'coords' then
p.coords = vec(data.coords) or p.coords
end
Expand Down
3 changes: 3 additions & 0 deletions tests/run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ check('model hashes', points.get(mid).models[joaat('prop_a')] == true)
local updated = points.update(id, { options = { { label = 'Only' } }, interactDistance = 2.5 })
check('update', updated and #points.get(id).options == 1)

points.update(id, { interactDistance = 8.0 })
check('update keeps the point in range', points.get(id).distance == 8.0)

local v0 = points.version
points.removeResource('res_b')
check('resource cleanup', points.get(id2) == nil and points.get(mid) == nil and points.get(id) ~= nil)
Expand Down