Skip to content
Closed
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
17 changes: 10 additions & 7 deletions lua/webaudio/receiver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,16 @@ function updateObject(id, modify_enum, handle_bass, inside_net)
self.parented = net.ReadBool()
if self.parented then
local ent = net.ReadEntity()
self.parent = ent
if self.pos ~= nil then
-- We've initialized and received a changed position before
self.parent_pos = ent:WorldToLocal(self.pos)
else
-- self.pos hasn't been touched, play the sound at the entity's position.
self.parent_pos = nil

if IsValid(ent) then
self.parent = ent
if self.pos ~= nil then
-- We've initialized and received a changed position before
self.parent_pos = ent:WorldToLocal(self.pos)
else
-- self.pos hasn't been touched, play the sound at the entity's position.
self.parent_pos = nil
end
end
else
self.parent = nil
Expand Down