diff --git a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs index c9e12a46..e49a8640 100644 --- a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs +++ b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs @@ -187,8 +187,7 @@ namespace NewHorizons.Builder.Props var path = config.isSeed ? brambleSeedPrefabPath : brambleNodePrefabPath; var brambleNode = SearchUtilities.Find(path).InstantiateInactive(); - StreamingHandler.SetUpStreaming(brambleNode); - sector.OnOccupantEnterSector += (sd) => StreamingHandler.OnOccupantEnterSector(brambleNode, sd, sector); + StreamingHandler.SetUpStreaming(brambleNode, sector); brambleNode.transform.parent = sector.transform; brambleNode.transform.position = go.transform.TransformPoint(config.position); diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index b9908965..6cc992ac 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -109,8 +109,7 @@ namespace NewHorizons.Builder.Props prop.transform.parent = sector?.transform ?? planetGO.transform; prop.SetActive(false); - if (sector != null) sector.OnOccupantEnterSector += (SectorDetector sd) => StreamingHandler.OnOccupantEnterSector(prop, sd, sector); - StreamingHandler.SetUpStreaming(prop); + StreamingHandler.SetUpStreaming(prop, sector); foreach (var component in prop.GetComponents().Concat(prop.GetComponentsInChildren())) { diff --git a/NewHorizons/Builder/Props/NomaiTextBuilder.cs b/NewHorizons/Builder/Props/NomaiTextBuilder.cs index e7f2f626..037d1512 100644 --- a/NewHorizons/Builder/Props/NomaiTextBuilder.cs +++ b/NewHorizons/Builder/Props/NomaiTextBuilder.cs @@ -201,8 +201,7 @@ namespace NewHorizons.Builder.Props AddTranslation(xmlPath); // Make sure the computer model is loaded - StreamingHandler.SetUpStreaming(computerObject); - sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(computerObject)); + StreamingHandler.SetUpStreaming(computerObject, sector); computerObject.SetActive(true); conversationInfoToCorrespondingSpawnedGameObject[info] = computerObject; @@ -249,8 +248,7 @@ namespace NewHorizons.Builder.Props AddTranslation(xmlPath); // Make sure the computer model is loaded - StreamingHandler.SetUpStreaming(cairnObject); - sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(cairnObject)); + StreamingHandler.SetUpStreaming(cairnObject, sector); conversationInfoToCorrespondingSpawnedGameObject[info] = cairnObject; break; } @@ -281,8 +279,7 @@ namespace NewHorizons.Builder.Props AddTranslation(xmlPath); // Make sure the recorder model is loaded - StreamingHandler.SetUpStreaming(recorderObject); - sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(recorderObject)); + StreamingHandler.SetUpStreaming(recorderObject, sector); recorderObject.SetActive(true); diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index 49da4b27..206d57fb 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -129,8 +129,7 @@ namespace NewHorizons.Builder.Props // Idk why but it wants reveals to be comma delimited not a list if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals); - StreamingHandler.SetUpStreaming(slideReelObj); - sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(slideReelObj)); + StreamingHandler.SetUpStreaming(slideReelObj, sector); slideReelObj.SetActive(true); } @@ -180,8 +179,7 @@ namespace NewHorizons.Builder.Props slideCollectionContainer.slideCollection = slideCollection; - StreamingHandler.SetUpStreaming(projectorObj); - sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(projectorObj)); + StreamingHandler.SetUpStreaming(projectorObj, sector); // Change the picture on the lens var lens = projectorObj.transform.Find("Spotlight/Prop_IP_SingleSlideProjector/Projector_Lens").GetComponent(); diff --git a/NewHorizons/Builder/Props/RaftBuilder.cs b/NewHorizons/Builder/Props/RaftBuilder.cs index 5c3ccc92..6ad6277f 100644 --- a/NewHorizons/Builder/Props/RaftBuilder.cs +++ b/NewHorizons/Builder/Props/RaftBuilder.cs @@ -29,8 +29,7 @@ namespace NewHorizons.Builder.Props raftObject.transform.position = planetGO.transform.TransformPoint(info.position); raftObject.transform.rotation = planetGO.transform.TransformRotation(Quaternion.identity); - sector.OnOccupantEnterSector += (sd) => StreamingHandler.OnOccupantEnterSector(raftObject, sd, sector); - StreamingHandler.SetUpStreaming(raftObject); + StreamingHandler.SetUpStreaming(raftObject, sector); var raftController = raftObject.GetComponent(); // Since awake already ran we have to unhook these events diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index 10cf799a..f7056ed8 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -136,8 +136,7 @@ namespace NewHorizons.Builder.Props controller._midBone.localPosition = controller._midStartPos; controller._topBone.localPosition = controller._topStartPos; - StreamingHandler.SetUpStreaming(tornadoGO); - sector.OnOccupantEnterSector += (sd) => StreamingHandler.SetUpStreaming(tornadoGO); + StreamingHandler.SetUpStreaming(tornadoGO, sector); tornadoGO.GetComponentInChildren().enabled = true; diff --git a/NewHorizons/Handlers/StreamingHandler.cs b/NewHorizons/Handlers/StreamingHandler.cs index db36afd7..00bbf520 100644 --- a/NewHorizons/Handlers/StreamingHandler.cs +++ b/NewHorizons/Handlers/StreamingHandler.cs @@ -17,23 +17,10 @@ namespace NewHorizons.Handlers _objectCache = new Dictionary>(); } - public static void OnOccupantEnterSector(GameObject obj, SectorDetector sd, Sector sector) - { - SetUpStreaming(obj); - - // If its too laggy put this back idk - /* - if (sector.GetOccupants().Count > 0 || sd._occupantType == DynamicOccupant.Player) - { - LoadObject(obj); - } - */ - } - /// /// makes it so that this object's streaming stuff will be connected to the given sector /// - public static void SetUpStreaming(GameObject obj, Sector sector = null) + public static void SetUpStreaming(GameObject obj, Sector sector) { List assetBundles; if (_objectCache.ContainsKey(obj))