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