Make Possessable sitelocation static

This commit is contained in:
Pascal Serrarens 2022-02-22 12:38:40 +01:00
parent 04c589dec9
commit 9f7a96187f
2 changed files with 9 additions and 7 deletions

View File

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

View File

@ -42,14 +42,18 @@ namespace Passer {
/// </summary> /// </summary>
public bool isUnique = false; public bool isUnique = false;
private string _siteLocation;
public string siteLocation { public string siteLocation {
get { get {
if (SiteNavigator.currentSite == null) if (_siteLocation == null) {
return "";
string siteLocation = SiteNavigator.currentSite.siteLocation; if (SiteNavigator.currentSite == null)
//siteLocation = siteLocation.Substring(0, siteLocation.LastIndexOf("/")); _siteLocation = "";
return (siteLocation + "_possessions");
string siteLocation = SiteNavigator.currentSite.siteLocation;
_siteLocation = (siteLocation + "_possessions");
}
return _siteLocation;
} }
} }