Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Below Zero #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions HintSwimToSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ public static bool Prefix(HintSwimToSurface __instance, ref bool __result, int _
__result = false;
return false;
}
Ocean main2 = Ocean.main;
if (main2 == null)
if (Ocean.main == null)
{
__result = false;
return false;
}
float oxygenAvailable = main.GetOxygenAvailable();
float depthOf = main2.GetDepthOf(main.gameObject);
float depthOf = Ocean.GetDepthOf(main.gameObject);
Vehicle vehicle = main.GetVehicle();
__result = (oxygenAvailable < __instance.oxygenThreshold && depthOf > 0f && main.IsSwimming()) || (vehicle != null && !vehicle.IsPowered());
return false;
Expand Down
4 changes: 2 additions & 2 deletions LowOxygenAlert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public static bool Prefix(LowOxygenAlert __instance, ref Utils.ScalarMonitor ___
for (int i = __instance.alertList.Count - 1; i >= 0; i--)
{
LowOxygenAlert.Alert alert = __instance.alertList[i];
if (oxygenCapacity >= alert.minO2Capacity && ___secondsMonitor.JustDroppedBelow((float)alert.oxygenTriggerSeconds) && Ocean.main.GetDepthOf(Utils.GetLocalPlayer()) > alert.minDepth && (___player.IsSwimming() || (___player.GetMode() == Player.Mode.LockedPiloting && !___player.GetVehicle().IsPowered()) || (___player.IsInSub() && !___player.CanBreathe())))
if (oxygenCapacity >= alert.minO2Capacity && ___secondsMonitor.JustDroppedBelow((float)alert.oxygenTriggerSeconds) && Ocean.GetDepthOf(Utils.GetLocalPlayer()) > alert.minDepth && (___player.IsSwimming() || (___player.GetMode() == Player.Mode.LockedPiloting && !___player.GetVehicle().IsPowered()) || (___player.IsInSub() && !___player.CanBreathe())))
{
Subtitles.main.Add(alert.notification.text);
Subtitles.Add(alert.notification.text);
alert.soundSFX.Play();
break;
}
Expand Down
8 changes: 6 additions & 2 deletions Patchy.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using HarmonyLib;
using System.Reflection;
using QModManager.API;
using QModManager.API.ModLoading;

namespace HardcoreWarnings
{
public class Patchy
{
[QModCore]
public static class Patchy
{
[QModPatch]
public static void Patch()
{
var harmony = new Harmony("com.ri.subnautica.HardcoreWarnings");
Expand Down
18 changes: 9 additions & 9 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"Id": "HardcoreWarnings",
"DisplayName": "O2 Warnings in Hardcore",
"Author": "Ri",
"Version": "0.1.1",
"Requires": [],
"Enable": true,
"AssemblyName": "HardcoreWarnings.dll",
"EntryMethod": "HardcoreWarnings.Patchy.Patch",
"Config": {}
"Id": "HardcoreWarnings",
"DisplayName": "O2 Warnings in Hardcore",
"Author": "Ri",
"Version": "0.1.1",
"Requires": [],
"Enable": true,
"Game": "BelowZero",
"AssemblyName": "HardcoreWarnings.dll",
"Config": {}
}