fix: fix bug where teleported avatars would lose their world reference

This commit is contained in:
Oliver Booth 2024-02-16 16:49:06 +00:00
parent f6991eb697
commit 850b32c389
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
1 changed files with 3 additions and 1 deletions

View File

@ -443,7 +443,9 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
} }
} }
Location = new Location(new VirtualParadiseWorld(_client, world), position, rotation); VirtualParadiseWorld? updatedWorld = isNewWorld ? await _client.GetWorldAsync(world) : Location.World;
updatedWorld ??= new VirtualParadiseWorld(_client, world);
Location = new Location(updatedWorld, position, rotation);
// ReSharper restore InconsistentlySynchronizedField // ReSharper restore InconsistentlySynchronizedField
} }