From dcbc834e933c4dfb178a4771e3c6a34e689e5b38 Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Sun, 16 Feb 2025 23:26:03 -0600 Subject: [PATCH] Fix removeComponents deleting NH item components --- NewHorizons/Builder/Props/DetailBuilder.cs | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index a395e080..022acd74 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -209,24 +209,6 @@ namespace NewHorizons.Builder.Props } } - if (detail.item != null) - { - ItemBuilder.MakeItem(prop, go, sector, detail.item, mod); - isItem = true; - if (detail.hasPhysics) - { - NHLogger.LogWarning($"An item with the path {detail.path} has both '{nameof(DetailInfo.hasPhysics)}' and '{nameof(DetailInfo.item)}' set. This will usually result in undesirable behavior."); - } - } - - if (detail.itemSocket != null) - { - ItemBuilder.MakeSocket(prop, go, sector, detail.itemSocket); - } - - // Items should always be kept loaded else they will vanish in your hand as you leave the sector - if (isItem) detail.keepLoaded = true; - prop.transform.localScale = detail.stretch ?? (detail.scale != 0 ? Vector3.one * detail.scale : prefab.transform.localScale); if (detail.removeChildren != null) @@ -271,11 +253,29 @@ namespace NewHorizons.Builder.Props prop = newDetailGO; } + if (detail.item != null) + { + ItemBuilder.MakeItem(prop, go, sector, detail.item, mod); + isItem = true; + if (detail.hasPhysics) + { + NHLogger.LogWarning($"An item with the path {detail.path} has both '{nameof(DetailInfo.hasPhysics)}' and '{nameof(DetailInfo.item)}' set. This will usually result in undesirable behavior."); + } + } + + if (detail.itemSocket != null) + { + ItemBuilder.MakeSocket(prop, go, sector, detail.itemSocket); + } + 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; + + // Items should always be kept loaded else they will vanish in your hand as you leave the sector + detail.keepLoaded = true; } if (!detail.keepLoaded) GroupsBuilder.Make(prop, sector);