-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix base game issue: Atmosphere volumes don't trigger while pilo…
…ting a vehicle (#516) * Custom atmosphere volumes now work while piloting * Improve template docs
- Loading branch information
1 parent
688d017
commit 09bf155
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using UnityEngine; | ||
|
||
namespace Nautilus.MonoBehaviours; | ||
|
||
// In the base game, atmosphere volumes will not trigger while you're inside a vehicle. This file fixes that issue on custom atmosphere volumes (can be opted out). | ||
internal class AtmosphereVolumeTriggerFix : MonoBehaviour | ||
{ | ||
public AtmosphereVolume atmosphereVolume; | ||
|
||
private void Start() | ||
{ | ||
InvokeRepeating(nameof(CheckTriggerEnter), Random.value, 3f); | ||
} | ||
|
||
private void CheckTriggerEnter() | ||
{ | ||
if (atmosphereVolume.settingsActive || !isActiveAndEnabled) | ||
{ | ||
return; | ||
} | ||
var playerObject = Player.mainObject; | ||
if (playerObject == null) return; | ||
if (atmosphereVolume.Contains(playerObject.transform.position)) | ||
{ | ||
atmosphereVolume.PushSettings(); | ||
} | ||
} | ||
} |