Skip to content

Commit

Permalink
Allow force title suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
sgkoishi committed Dec 16, 2023
1 parent e97c79e commit 1d6aec6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
11 changes: 10 additions & 1 deletion Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public record class MitigationSettings
/// This will prevent the title from being set if TERM has no xterm.
/// </para>
/// </summary>
public Optional<bool> SuppressTitle = Optional.Default(true, true);
public Optional<TitleSuppression> SuppressTitle = Optional.Default(TitleSuppression.Smart, true);

/// <summary>
/// <para>
Expand Down Expand Up @@ -673,6 +673,15 @@ public enum NetworkLimit
Public,
None
}

public enum TitleSuppression
{
Disabled,
Smart,
Enabled,
False = Disabled,
True = Smart
}
}

public record class LimiterConfig
Expand Down
10 changes: 7 additions & 3 deletions Core/Mitigations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,15 @@ private void TAHook_Mitigation_GameUpdate(EventArgs _)
private void Detour_Mitigation_SetTitle(Action<TShockAPI.Utils, bool> orig, TShockAPI.Utils self, bool empty)
{
var mitigation = this.config.Mitigation.Value;
if (!mitigation.DisableAllMitigation && mitigation.SuppressTitle)
if (!mitigation.DisableAllMitigation)
{
if (ShouldSuppressTitle)
switch (mitigation.SuppressTitle.Value)
{
return;
case Config.MitigationSettings.TitleSuppression.Enabled:
case Config.MitigationSettings.TitleSuppression.Smart when ShouldSuppressTitle:
{
return;
}
}
}

Expand Down

0 comments on commit 1d6aec6

Please sign in to comment.