Add message indicating command stays on pass (#365)

To prevent confusion among Ts, this PR returns the message on pass/fire
indicating that the command stays and when it becomes a freeday.

~~This PR does *not* implement a timer of any form to actually declare
it a freeday after those 10s, though that *may* be desirable behaviour?
(I can't remember whether this was the case in GO). If so, let me
know.~~
This commit is contained in:
Isaac
2025-02-18 11:23:17 -08:00
committed by GitHub
3 changed files with 23 additions and 5 deletions

View File

@@ -16,6 +16,9 @@ public class WardenLocale : IWardenLocale,
Plain = false, Panorama = false, Chat = true
};
public static readonly FormatObject COMMAND_STANDS =
new HiddenFormatObject($"The previous command stands for 10 seconds.");
public IView PickingShortly
=> new SimpleView {
PREFIX,
@@ -27,9 +30,15 @@ public class WardenLocale : IWardenLocale,
PREFIX,
$"No one in queue. Next guard to {ChatColors.BlueGrey}!warden{ChatColors.Grey} will become warden."
};
public IView NowFreeday
=> new SimpleView {
PREFIX,
$"It is now a freeday! CTs must pursue {ChatColors.BlueGrey}!warden{ChatColors.Grey}."
};
public IView WardenLeft
=> new SimpleView { PREFIX, "The warden left the game." };
=> new SimpleView { PREFIX, "The warden left the game.", COMMAND_STANDS };
public IView WardenDied
=> new SimpleView {
@@ -71,11 +80,11 @@ public class WardenLocale : IWardenLocale,
};
public IView PassWarden(CCSPlayerController player) {
return new SimpleView { PREFIX, player, "resigned from warden." };
return new SimpleView { PREFIX, player, "resigned from warden.", COMMAND_STANDS };
}
public IView FireWarden(CCSPlayerController player) {
return new SimpleView { PREFIX, player, "was fired from warden." };
return new SimpleView { PREFIX, player, "was fired from warden.", COMMAND_STANDS };
}
public IView
@@ -85,7 +94,8 @@ public class WardenLocale : IWardenLocale,
admin,
"fired",
player,
"from warden."
"from warden.",
COMMAND_STANDS
};
}

View File

@@ -106,7 +106,7 @@ public class WardenBehavior(ILogger<WardenBehavior> logger,
private BasePlugin parent = null!;
private PreWardenStats? preWardenStats;
private Timer? unblueTimer, openCellsTimer;
private Timer? unblueTimer, openCellsTimer, passFreedayTimer;
public void Start(BasePlugin basePlugin) {
parent = basePlugin;
@@ -187,6 +187,7 @@ public class WardenBehavior(ILogger<WardenBehavior> logger,
logs.Append(logs.Player(Warden), "is now the warden.");
unblueTimer = parent.AddTimer(3, unmarkPrisonersBlue);
passFreedayTimer?.Kill(); // If a warden is assigned, cancel the 10s freeday timer on pass
mute.PeaceMute(firstWarden ?
MuteReason.INITIAL_WARDEN :
MuteReason.WARDEN_TAKEN);
@@ -238,6 +239,12 @@ public class WardenBehavior(ILogger<WardenBehavior> logger,
mute.UnPeaceMute();
HasWarden = false;
if (isPass) { // If passing, start the timer to announce freeday
passFreedayTimer = parent.AddTimer(10, () => {
locale.NowFreeday.ToAllChat();
});
}
if (Warden != null && Warden.Pawn.Value != null) {
Warden.Clan = "";

View File

@@ -8,6 +8,7 @@ namespace Jailbreak.Formatting.Views.Warden;
public interface IWardenLocale {
public IView PickingShortly { get; }
public IView NoWardens { get; }
public IView NowFreeday { get; }
public IView WardenLeft { get; }
public IView WardenDied { get; }
public IView BecomeNextWarden { get; }