mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
commit
460bc69eb7
@ -1,5 +1,7 @@
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.Utility;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
namespace NewHorizons.Builder.General
|
||||
@ -89,38 +91,28 @@ namespace NewHorizons.Builder.General
|
||||
public static void SuitUp()
|
||||
{
|
||||
suitUpQueued = false;
|
||||
if (Locator.GetPlayerController()._isWearingSuit) return;
|
||||
|
||||
Locator.GetPlayerTransform().GetComponent<PlayerSpacesuit>().SuitUp(false, true, true);
|
||||
if (!Locator.GetPlayerController()._isWearingSuit)
|
||||
{
|
||||
var spv = SearchUtilities.Find("Ship_Body/Module_Supplies/Systems_Supplies/ExpeditionGear")?.GetComponent<SuitPickupVolume>();
|
||||
if (spv != null)
|
||||
{
|
||||
var command = spv._interactVolume.GetInteractionAt(spv._pickupSuitCommandIndex).inputCommand;
|
||||
|
||||
// Make the ship act as if the player took the suit
|
||||
var spv = SearchUtilities.Find("Ship_Body/Module_Supplies/Systems_Supplies/ExpeditionGear")?.GetComponent<SuitPickupVolume>();
|
||||
|
||||
if (spv == null) return;
|
||||
|
||||
spv._containsSuit = false;
|
||||
|
||||
if (spv._allowSuitReturn)
|
||||
var eventDelegate = (MulticastDelegate)typeof(MultipleInteractionVolume).GetField(
|
||||
nameof(MultipleInteractionVolume.OnPressInteract),
|
||||
BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
.GetValue(spv._interactVolume);
|
||||
foreach (var handler in eventDelegate.GetInvocationList())
|
||||
{
|
||||
spv._interactVolume.ChangePrompt(UITextType.ReturnSuitPrompt, spv._pickupSuitCommandIndex);
|
||||
handler.Method.Invoke(handler.Target, new object[] { command });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spv._interactVolume.EnableSingleInteraction(false, spv._pickupSuitCommandIndex);
|
||||
}
|
||||
|
||||
spv._timer = 0f;
|
||||
spv._index = 0;
|
||||
|
||||
spv.OnSuitUp();
|
||||
|
||||
GameObject suitGeometry = spv._suitGeometry;
|
||||
if (suitGeometry != null) suitGeometry.SetActive(false);
|
||||
|
||||
OWCollider suitOWCollider = spv._suitOWCollider;
|
||||
if (suitOWCollider != null) suitOWCollider.SetActivation(false);
|
||||
|
||||
spv.enabled = true;
|
||||
Locator.GetPlayerTransform().GetComponent<PlayerSpacesuit>().SuitUp(false, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user