fix hatch close noise playing when walking under ship

This commit is contained in:
Mister_Nebula 2021-04-13 17:40:11 +01:00
parent 22da72355d
commit dad8c884a0

View File

@ -45,10 +45,10 @@ namespace QSB.ShipSync.Patches
public static bool ShipTractorBeamSwitch_OnTriggerExit(Collider hitCollider, bool ____isPlayerInShip, bool ____functional)
{
if (!____isPlayerInShip && ____functional && hitCollider.CompareTag("PlayerDetector"))
var shipTransform = Locator.GetShipTransform();
var hatchController = shipTransform.GetComponentInChildren<HatchController>();
if (!____isPlayerInShip && ____functional && hitCollider.CompareTag("PlayerDetector") && !hatchController.GetValue<GameObject>("_hatchObject").activeSelf)
{
var shipTransform = Locator.GetShipTransform();
var hatchController = shipTransform.GetComponentInChildren<HatchController>();
hatchController.Invoke("CloseHatch");
QSBEventManager.FireEvent(EventNames.QSBHatchState, false);
}