Embed command stands into actual pass/fire messages, announce freeday in 10s

This commit is contained in:
blankdvth
2025-02-18 00:47:32 -05:00
parent 45976f0232
commit 0b091692cb
4 changed files with 23 additions and 15 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 {
@@ -43,12 +52,6 @@ public class WardenLocale : IWardenLocale,
}
};
public IView PassCommandStays
=> new SimpleView {
PREFIX,
"Previous orders remain until new orders are given. It will become a freeday in 10 seconds."
};
public IView BecomeNextWarden
=> new SimpleView {
PREFIX,
@@ -77,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
@@ -91,7 +94,8 @@ public class WardenLocale : IWardenLocale,
admin,
"fired",
player,
"from warden."
"from warden.",
COMMAND_STANDS
};
}

View File

@@ -42,7 +42,6 @@ public class WardenCommandsBehavior(IWardenLocale locale,
clients.ExecuteClientCommand(
$"play sounds/{WardenBehavior.CV_WARDEN_SOUND_PASSED.Value}");
locale.PassCommandStays.ToAllChat();
locale.BecomeNextWarden.ToAllChat();
if (!warden.TryRemoveWarden(true))
@@ -76,7 +75,6 @@ public class WardenCommandsBehavior(IWardenLocale locale,
$"play sounds/{WardenBehavior.CV_WARDEN_SOUND_PASSED.Value}");
}
locale.PassCommandStays.ToAllChat();
locale.BecomeNextWarden.ToAllChat();
lastPassCommand[warden.Warden] = DateTime.Now;

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;
@@ -188,6 +188,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);
@@ -239,6 +240,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 = "";
@@ -653,7 +660,6 @@ public class WardenBehavior(ILogger<WardenBehavior> logger,
player.ExecuteClientCommand(
$"play sounds/{CV_WARDEN_SOUND_PASSED.Value}");
locale.PassCommandStays.ToAllChat();
locale.BecomeNextWarden.ToAllChat();
return HookResult.Continue;
}

View File

@@ -8,9 +8,9 @@ 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 PassCommandStays { get; }
public IView BecomeNextWarden { get; }
public IView JoinRaffle { get; }
public IView LeaveRaffle { get; }