Skip to content

Commit

Permalink
Allow displaying clock only when suit equipped
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
clubby789 committed Sep 8, 2024
1 parent ff2fee8 commit c8e20bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ClockLib/OWClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class OWClock : ModBehaviour
private float _width;
private int _displayHeight;
private int _displayWidth;
private bool _displayOnlyWhenSuitOn;

internal static IModHelper Helper;
public static bool CountUp { get; private set; }
Expand Down Expand Up @@ -66,6 +67,12 @@ internal void OnGUI()
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)
{
Expand Down Expand Up @@ -138,6 +145,7 @@ public override void Configure(IModConfig config)

// When the HudScale changes, we need to scale the HUD
RecalculatePosition();
_displayOnlyWhenSuitOn = config.GetSettingsValue<bool>("Only Display When Suit Equipped");
}

#endregion
Expand Down
2 changes: 2 additions & 0 deletions ClockLib/default-config.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit c8e20bd

Please sign in to comment.