Fix another crash.

This commit is contained in:
Signal 2025-12-01 19:07:49 -05:00
parent c54579e426
commit a7ed39131c
3 changed files with 8 additions and 4 deletions

View file

@ -60,7 +60,7 @@ function artifact.play_sound(def)
--def.gain = nil
if def.pos then
for _, m in pairs(artifact.players) do
local dist = m.pos:distance(def.pos)
local dist = vector.distance(m.pos, def.pos)
if dist <= (def.range or 32) and m.name ~= def.exclude_player and not (def.to_player and m.name ~= def.to_player) then
def.to_player = m.name
def.gain = (def.gain or 1) *(1 -math.sqrt(dist /(def.range or 32)))