diff --git a/NewHorizons/Builder/General/SpawnPointBuilder.cs b/NewHorizons/Builder/General/SpawnPointBuilder.cs index bc8d0aba..d74923f0 100644 --- a/NewHorizons/Builder/General/SpawnPointBuilder.cs +++ b/NewHorizons/Builder/General/SpawnPointBuilder.cs @@ -72,33 +72,35 @@ namespace NewHorizons.Builder.General { suitUpQueued = false; if (Locator.GetPlayerController()._isWearingSuit) return; - try + + Locator.GetPlayerTransform().GetComponent().SuitUp(false, true, true); + + // Make the ship act as if the player took the suit + var spv = GameObject.Find("Ship_Body/Module_Supplies/Systems_Supplies/ExpeditionGear")?.GetComponent(); + + if (spv == null) return; + + spv._containsSuit = false; + + if (spv._allowSuitReturn) { - var spv = GameObject.Find("Ship_Body/Module_Supplies/Systems_Supplies/ExpeditionGear").GetComponent(); - spv.SetValue("_containsSuit", false); - - if (spv.GetValue("_allowSuitReturn")) - spv.GetValue("_interactVolume").ChangePrompt(UITextType.ReturnSuitPrompt, spv.GetValue("_pickupSuitCommandIndex")); - else - spv.GetValue("_interactVolume").EnableSingleInteraction(false, spv.GetValue("_pickupSuitCommandIndex")); - - Locator.GetPlayerTransform().GetComponent().SuitUp(false, true, true); - - spv.SetValue("_timer", 0f); - spv.SetValue("_index", 0); - - GameObject suitGeometry = spv.GetValue("_suitGeometry"); - if (suitGeometry != null) suitGeometry.SetActive(false); - - OWCollider suitOWCollider = spv.GetValue("_suitOWCollider"); - if (suitOWCollider != null) suitOWCollider.SetActivation(false); - - spv.enabled = true; + spv._interactVolume.ChangePrompt(UITextType.ReturnSuitPrompt, spv._pickupSuitCommandIndex); } - catch(Exception e) + else { - Logger.LogWarning($"Was unable to suit up player. {e.Message}, {e.StackTrace}"); + spv._interactVolume.EnableSingleInteraction(false, spv._pickupSuitCommandIndex); } + + spv._timer = 0f; + spv._index = 0; + + GameObject suitGeometry = spv._suitGeometry; + if (suitGeometry != null) suitGeometry.SetActive(false); + + OWCollider suitOWCollider = spv._suitOWCollider; + if (suitOWCollider != null) suitOWCollider.SetActivation(false); + + spv.enabled = true; } } }