Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specific lines for killing the player, and lines for enabling/disabling cheats when already enabled/disabled. #601

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ public class CheatsConfig : IMergeable<CheatsConfig>
/// </summary>
public SchrodingersString? DisabledCheats { get; init; }

/// <summary>
/// Gets the phrases to respond with when asked to turn on cheats but cheats are already enabled.
/// </summary>
public SchrodingersString? AlreadyEnabledCheats { get; init; }

/// <summary>
/// Gets the phrases to repsond with when asked to turn off cheats but cheats are already disabled.
/// </summary>
public SchrodingersString? AlreadyDisabledCheats { get; set; }

/// <summary>
/// Gets the phrases to respond when a cheat command is given and cheats
/// are turned off
Expand Down Expand Up @@ -42,4 +52,9 @@ public class CheatsConfig : IMergeable<CheatsConfig>
/// themselves an item that does not exist.
/// </summary>
public SchrodingersString? CheatInvalidItem { get; init; }

/// <summary>
/// Gets the phrases to respond with after successfully killing the player.
/// </summary>
public SchrodingersString? KilledPlayer { get; init; }
}
24 changes: 19 additions & 5 deletions src/TrackerCouncil.Smz3.Tracking/VoiceCommands/CheatsModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,28 @@ public override void AddCommands()

AddCommand("Enable cheats", GetEnableCheatsRule(), (result) =>
{
_cheatsEnabled = true;
TrackerBase.Say(x => x.Cheats.EnabledCheats);
if (!_cheatsEnabled)
{
_cheatsEnabled = true;
TrackerBase.Say(x => x.Cheats.EnabledCheats);
}
else
{
TrackerBase.Say(x => x.Cheats.AlreadyEnabledCheats);
}
});

AddCommand("Disable cheats", GetDisableHintsRule(), (result) =>
{
_cheatsEnabled = false;
TrackerBase.Say(x => x.Cheats.DisabledCheats);
if (_cheatsEnabled)
{
_cheatsEnabled = false;
TrackerBase.Say(x => x.Cheats.DisabledCheats);
}
else
{
TrackerBase.Say(x => x.Cheats.AlreadyDisabledCheats);
}
});

AddCommand("Fill rule", FillRule(), (result) =>
Expand All @@ -253,7 +267,7 @@ public override void AddCommands()

if (TrackerBase.GameService?.TryKillPlayer() == true)
{
TrackerBase.Say(x => x.Cheats.CheatPerformed);
TrackerBase.Say(x => x.Cheats.KilledPlayer ?? x.Cheats.CheatPerformed);
}
else
{
Expand Down