Determine sitelocation for changed avatar possessions

This commit is contained in:
Pascal Serrarens 2022-02-21 18:11:54 +01:00
parent 13a48376a3
commit 04c589dec9

View File

@ -154,8 +154,15 @@ namespace Passer.Humanoid {
else else
name = humanoid.gameObject.name; name = humanoid.gameObject.name;
if (humanoid.remoteAvatar == null) // Bug:
// The siteLocation should not be calculated dynamically every time because we could have moved to a new site!
if (humanoid.remoteAvatar == null) {
Possessable avatarPossessable = humanoid.avatarRig.GetComponent<Possessable>();
if (avatarPossessable != null)
possessionLocation = avatarPossessable.siteLocation;
avatarPrefabName = humanoid.avatarRig.name; // .Substring(0, humanoid.avatarRig.name.Length - 7); avatarPrefabName = humanoid.avatarRig.name; // .Substring(0, humanoid.avatarRig.name.Length - 7);
}
else { else {
Possessable avatarPossessable = humanoid.remoteAvatar.GetComponent<Possessable>(); Possessable avatarPossessable = humanoid.remoteAvatar.GetComponent<Possessable>();
if (avatarPossessable != null) if (avatarPossessable != null)