remove chat spam after commands (must use /cmd!)

This commit is contained in:
Gurge44 committed 2026-01-28 10:48:14 +01:00
1 parent c5aa57abaa
commit 89f9e4a501
9 files changed
+24 -24

No files matched your search

+2 -1
View File
@@ -786,7 +786,8 @@ public static class TheMindGame
byte id = FindTargetIdFromText();
if (id == byte.MaxValue) break;
if (!pc.AmOwner && spamRequired) ChatManager.SendPreviousMessagesToAll();
if (!pc.AmOwner && spamRequired)
Utils.SendMessage("\n", pc.PlayerId, Translator.GetString("NoSpamAnymoreUseCmd"));
if (id == WinningBriefcaseHolderId)
{
+1 -1
View File
@@ -126,7 +126,7 @@ public static class GuessManager
(pc.Is(CustomRoles.EvilGuesser) && Options.EGTryHideMsg.GetBool()) ||
(pc.Is(CustomRoles.Doomsayer) && Doomsayer.DoomsayerTryHideMsg.GetBool()) ||
(pc.Is(CustomRoles.Guesser) && Guesser.GTryHideMsg.GetBool()) || (Options.GuesserMode.GetBool() && Options.HideGuesserCommands.GetBool())))
ChatManager.SendPreviousMessagesToAll();
Utils.SendMessage("\n", pc.PlayerId, GetString("NoSpamAnymoreUseCmd"));
if (!MsgToPlayerAndRole(msg, out byte targetId, out CustomRoles role, out string error))
{
+1 -1
View File
@@ -3188,7 +3188,7 @@ internal static class ChatCommands
break;
}
if (command.AlwaysHidden && spamRequired) ChatManager.SendPreviousMessagesToAll();
if (command.AlwaysHidden && spamRequired) Utils.SendMessage("\n", player.PlayerId, GetString("NoSpamAnymoreUseCmd"));
command.Action(player, text, args);
if (command.IsCanceled) canceled = command.AlwaysHidden || !Options.HostSeesCommandsEnteredByOthers.GetBool();
break;
+14 -16
View File
@@ -291,18 +291,7 @@ public static class ChatManager
if (!AmongUsClient.Instance.AmHost) return;
PlayerControl player = GameStates.CurrentServerType == GameStates.ServerType.Vanilla ? PlayerControl.LocalPlayer : Main.AllAlivePlayerControls.MinBy(x => x.PlayerId) ?? Main.AllPlayerControls.MinBy(x => x.PlayerId) ?? PlayerControl.LocalPlayer;
if (player == null) return;
if (GameStates.CurrentServerType == GameStates.ServerType.Vanilla)
{
if (targets.Length <= 1 || targets.Length >= Main.AllAlivePlayerControls.Length)
Loop.Times(30, _ => Utils.SendMessage(string.Empty, targets.Length == 1 ? targets[0].PlayerId : byte.MaxValue, "​", force: true, sendOption: SendOption.None));
else
targets.Do(x => Loop.Times(30, _ => Utils.SendMessage(string.Empty, x.PlayerId, "​", force: true, sendOption: SendOption.None)));
return;
}
if (targets.Length == 0 || targets.Length == PlayerControl.AllPlayerControls.Count) SendEmptyMessage(null);
if (targets.Length == 0 || targets.Length >= Main.AllAlivePlayerControls.Length) SendEmptyMessage(null);
else targets.Do(SendEmptyMessage);
return;
@@ -312,10 +301,19 @@ public static class ChatManager
bool toLocalPlayer = !toEveryone && receiver.AmOwner;
if (HudManager.InstanceExists && (toLocalPlayer || toEveryone)) HudManager.Instance.Chat.AddChat(player, "<size=32767>.");
if (toLocalPlayer) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SendChat, SendOption.Reliable, toEveryone ? -1 : receiver.OwnerId);
writer.Write("<size=32767>.");
writer.Write(true);
AmongUsClient.Instance.FinishRpcImmediately(writer);
if (GameStates.CurrentServerType == GameStates.ServerType.Vanilla)
{
byte to = toEveryone ? byte.MaxValue : receiver.PlayerId;
Utils.SendMessage("<size=32767>.", to, "\n", force: true, addToHistory: false);
}
else
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SendChat, SendOption.Reliable, toEveryone ? -1 : receiver.OwnerId);
writer.Write("<size=32767>.");
writer.Write(true);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
}
}
}
+2 -1
View File
@@ -801,7 +801,7 @@
"InspectorInfoLong": "(Crewmates):\\nTo check if two players are on the same team, use the command <b>/cmd cp [player id 1] [player id 2]</b>. Neutral killers are counted as part of the same team. Non-Killing Neutrals are counted as separate teams. The Trickster is counted as crew, and Madmates are counted as Impostor. The Lawyer/Follower and its target count as the same team. You will receive an affirmation message if they are in the same team or a denial message if they are not.",
"TimeMasterInfoLong": "(Crewmates):\\nAs the Time Master, use the vents/pet to rewind time to a few seconds before. Players will be teleported back to their positions from that time. Players who died within that time will be revived.",
"CrusaderInfoLong": "(Crewmates):\\nAs the Crusader, use your kill button to crusade a player. If that player gets attacked, you'll kill the attacker.",
"ArsonistInfoLong": "(Neutrals):\\nArsonist can douse by clicking the kill button on a player and following them for a few seconds. When dousing starts, successful dousing is indicated by a shield animation (only visible to themselves). When the Arsonist douses all surviving players, they can vent/pet their pet to start a fire and win alone. If player name shows 「△」, they're being doused; if it shows 「▲」, they're completely doused. Note that if 'Can Ignite Anytime' is enabled, the Arsonist needs to use their kill button on a fully doused player to ignite.",
"ArsonistInfoLong": "(Neutrals):\\nArsonist can douse by clicking the kill button on a player and following them for a few seconds. Successful dousing is indicated by a shield animation (only visible to themselves). When the Arsonist douses all living players, they can vent/pet to start a fire and win alone. If a player's name shows 「△」, they're being doused; if it shows 「▲」, they're completely doused. Note that if 'Can Ignite Anytime' is enabled, the Arsonist needs to use their kill button on a fully doused player to ignite, and only doused players die.",
"JesterInfoLong": "(Neutrals):\\nJester wins alone if voted out but loses if still alive at the end. Jester, Executioner, and Innocent can win together.",
"TerroristInfoLong": "(Neutrals):\\nIf the Terrorist completes all tasks and dies, they win the game alone.",
"ExecutionerInfoLong": "(Neutrals):\\nThe Executioner has a target with a diamond symbol next to their name. If the target dies, the Executioner may become a Crewmate, Jester, or Opportunist. If the target is voted out, the Executioner wins.",
@@ -4244,6 +4244,7 @@
"NumGuessersOn.Neutral.Max": "Maximum Number of Neutral Guessers",
"NumGuessersOn.Coven.Min": "Minimum Number of Coven Guessers",
"NumGuessersOn.Coven.Max": "Maximum Number of Coven Guessers",
"NoSpamAnymoreUseCmd": "<size=2.5><#ff0000>⚠ <#ffff00>USE THE '/cmd {command name} {arguments}' FORMAT <#ff0000>⚠</size>\\n<#ffa500>Otherwise your messages are exposed!",
"ZombieSpeedReduceInterval": "Speed Reduction Interval",
"ZombieInitialSpeed": "Initial Speed",
"ZombieMinimumSpeed": "Minimum Speed",
@@ -139,7 +139,7 @@ public class Inspector : RoleBase
case 2:
{
if (TryHideMsg.GetBool() && !isUI && spamRequired)
ChatManager.SendPreviousMessagesToAll();
Utils.SendMessage("\n", pc.PlayerId, GetString("NoSpamAnymoreUseCmd"));
if (!MsgToPlayerAndRole(msg, out byte targetId1, out byte targetId2, out string error))
{
+1 -1
View File
@@ -109,7 +109,7 @@ public class Judge : RoleBase
case 2:
{
if (TryHideMsg.GetBool() && !isUI && spamRequired)
ChatManager.SendPreviousMessagesToAll();
Utils.SendMessage("\n", pc.PlayerId, GetString("NoSpamAnymoreUseCmd"));
if (!MsgToPlayerAndRole(msg, out byte targetId, out string error))
{
+1 -1
View File
@@ -105,7 +105,7 @@ public class Swapper : RoleBase
}
if (HideMsg.GetBool() && !isUI && !spamRequired)
ChatManager.SendPreviousMessagesToAll();
Utils.SendMessage("\n", pc.PlayerId, GetString("NoSpamAnymoreUseCmd"));
if (!byte.TryParse(msg.Replace(" ", string.Empty), out byte targetId))
{
@@ -126,7 +126,7 @@ public class Councillor : RoleBase
case 2:
{
if (TryHideMsg.GetBool() && !isUI && spamRequired)
ChatManager.SendPreviousMessagesToAll();
Utils.SendMessage("\n", pc.PlayerId, GetString("NoSpamAnymoreUseCmd"));
if (!MsgToPlayerAndRole(msg, out byte targetId, out string error))
{