From 6a4e670a51bca9f26933747ebfde4781f2e265a0 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 8 Oct 2022 13:29:53 -0400 Subject: [PATCH] Fix spawning OWItem Fixes (#409) --- NewHorizons/Builder/Props/DetailBuilder.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index 4aa2fc42..25d30a0d 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -70,10 +70,13 @@ namespace NewHorizons.Builder.Props StreamingHandler.SetUpStreaming(prop, sector); - var isTorch = prop.GetComponent() != null; + var isTorch = prop.GetComponentInChildren() != null; + var isItem = false; foreach (var component in prop.GetComponentsInChildren(true)) { + if (component.gameObject == prop && component is OWItem) isItem = true; + if (sector == null) { if (FixUnsectoredComponent(component)) continue; @@ -83,6 +86,9 @@ namespace NewHorizons.Builder.Props FixComponent(component, go); } + // Items shouldn't use these else they get weird + if (isItem) detail.keepLoaded = true; + prop.transform.position = detail.position == null ? go.transform.position : go.transform.TransformPoint(detail.position); Quaternion rot = detail.rotation == null ? Quaternion.identity : Quaternion.Euler(detail.rotation); @@ -156,6 +162,13 @@ namespace NewHorizons.Builder.Props } } + if (isItem) + { + // Else when you put them down you can't pick them back up + var col = prop.GetComponent(); + if (col != null) col._physicsRemoved = false; + } + if (!detail.keepLoaded) GroupsBuilder.Make(prop, sector); prop.SetActive(true);