-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHintSwimToSurface.cs
41 lines (36 loc) · 989 Bytes
/
HintSwimToSurface.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using HarmonyLib;
using UnityEngine;
namespace HardcoreWarnings
{
[HarmonyPatch(typeof(HintSwimToSurface))]
[HarmonyPatch("ShouldShowWarning")]
internal class HintSwimToSurface_ShouldShowWarning_Patch
{
[HarmonyPrefix]
public static bool Prefix(HintSwimToSurface __instance, ref bool __result, int ___numShown)
{
Player main = Player.main;
if (main == null)
{
__result = false;
return false;
}
if (___numShown >= __instance.maxNumToShow)
{
__result = false;
return false;
}
Ocean main2 = Ocean.main;
if (main2 == null)
{
__result = false;
return false;
}
float oxygenAvailable = main.GetOxygenAvailable();
float depthOf = main2.GetDepthOf(main.gameObject);
Vehicle vehicle = main.GetVehicle();
__result = (oxygenAvailable < __instance.oxygenThreshold && depthOf > 0f && main.IsSwimming()) || (vehicle != null && !vehicle.IsPowered());
return false;
}
}
}