From c8e20bd09661357c19cb16ce31b1ff661a581089 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 8 Sep 2024 12:08:47 +0100 Subject: [PATCH] Allow displaying clock only when suit equipped Closes #17 --- ClockLib/OWClock.cs | 8 ++++++++ ClockLib/default-config.json | 2 ++ 2 files changed, 10 insertions(+) diff --git a/ClockLib/OWClock.cs b/ClockLib/OWClock.cs index 3dde9c7..3a82c69 100644 --- a/ClockLib/OWClock.cs +++ b/ClockLib/OWClock.cs @@ -19,6 +19,7 @@ namespace Clock private float _width; private int _displayHeight; private int _displayWidth; + private bool _displayOnlyWhenSuitOn; internal static IModHelper Helper; public static bool CountUp { get; private set; } @@ -66,6 +67,12 @@ namespace Clock return; } + // It would be cool to render the UI on the helmet display if this is enabled + if (_displayOnlyWhenSuitOn && !PlayerState.IsWearingSuit()) + { + return; + } + var elapsed = TimeLoop.GetSecondsElapsed(); if (elapsed < 1f) { @@ -138,6 +145,7 @@ namespace Clock // When the HudScale changes, we need to scale the HUD RecalculatePosition(); + _displayOnlyWhenSuitOn = config.GetSettingsValue("Only Display When Suit Equipped"); } #endregion diff --git a/ClockLib/default-config.json b/ClockLib/default-config.json index e2d06e7..f4d33fd 100644 --- a/ClockLib/default-config.json +++ b/ClockLib/default-config.json @@ -1,9 +1,11 @@ { + "$schema": "https://raw.githubusercontent.com/ow-mods/owml/master/schemas/config_schema.json", "enabled": true, "settings": { "Count Up": true, "Count In Milliseconds": false, "Events to Display": 5, + "Only Display When Suit Equipped": false, "HudScale": { "title": "Event List Width", "type": "slider",