make host invis after death & delay some messages after spam

This commit is contained in:
Gurge44 committed 2026-01-16 11:26:21 +01:00
1 parent a699031050
commit e2afc86283
6 files changed
+49 -35

No files matched your search

+6 -3
View File
@@ -790,11 +790,14 @@ public static class TheMindGame
{
WinningBriefcaseLastHolderId = id;
WinningBriefcaseHolderId = pc.PlayerId;
Utils.SendMessage(string.Format(Translator.GetString("TMG.Message.LassoedWinningBriefcaseSelf"), id.ColoredPlayerName()), pc.PlayerId, "<#00ff00>✓</color>");
Utils.SendMessage(Translator.GetString("TMG.Message.LassoedWinningBriefcase"), id, "<#ffff00>⚠</color>");
LateTask.New(() =>
{
Utils.SendMessage(string.Format(Translator.GetString("TMG.Message.LassoedWinningBriefcaseSelf"), id.ColoredPlayerName()), pc.PlayerId, "<#00ff00>✓</color>");
Utils.SendMessage(Translator.GetString("TMG.Message.LassoedWinningBriefcase"), id, "<#ffff00>⚠</color>");
}, 0.2f);
}
else
Utils.SendMessage(string.Format(Translator.GetString("TMG.Message.LassoedEmptyBriefcase"), id.ColoredPlayerName()), pc.PlayerId, "<#ffa500>-</color>");
LateTask.New(() => Utils.SendMessage(string.Format(Translator.GetString("TMG.Message.LassoedEmptyBriefcase"), id.ColoredPlayerName()), pc.PlayerId, "<#ffa500>-</color>"), 0.2f);
break;
}
+25 -22
View File
@@ -1847,6 +1847,28 @@ public static class Utils
PlayerControl sender = !addToHistory || GameStates.CurrentServerType == GameStates.ServerType.Vanilla ? PlayerControl.LocalPlayer : Main.AllAlivePlayerControls.MinBy(x => x.PlayerId) ?? Main.AllPlayerControls.MinBy(x => x.PlayerId) ?? PlayerControl.LocalPlayer;
if (sendTo != byte.MaxValue && receiver.AmOwner)
{
if (HudManager.InstanceExists)
{
string name = sender.Data.PlayerName;
sender.SetName(title);
HudManager.Instance.Chat.AddChat(sender, text);
sender.SetName(name);
}
try
{
string pureText = text.RemoveHtmlTags();
string pureTitle = title.RemoveHtmlTags();
Logger.Info($" Message: {pureText[..(pureText.Length <= 300 ? pureText.Length : 300)]} - To: {GetPlayerById(sendTo)?.GetRealName()} - Title: {pureTitle[..(pureTitle.Length <= 300 ? pureTitle.Length : 300)]}", "SendMessage");
}
catch { Logger.Info(" Message sent", "SendMessage"); }
if (addToHistory) ChatUpdatePatch.LastMessages.Add((text, sendTo, title, TimeStamp));
return writer;
}
if (sender.AmOwner && sender.Data.IsDead)
{
bool delayMessage = false;
@@ -1907,28 +1929,6 @@ public static class Utils
}
}
if (sendTo != byte.MaxValue && receiver.AmOwner)
{
if (HudManager.InstanceExists)
{
string name = sender.Data.PlayerName;
sender.SetName(title);
HudManager.Instance.Chat.AddChat(sender, text);
sender.SetName(name);
}
try
{
string pureText = text.RemoveHtmlTags();
string pureTitle = title.RemoveHtmlTags();
Logger.Info($" Message: {pureText[..(pureText.Length <= 300 ? pureText.Length : 300)]} - To: {GetPlayerById(sendTo)?.GetRealName()} - Title: {pureTitle[..(pureTitle.Length <= 300 ? pureTitle.Length : 300)]}", "SendMessage");
}
catch { Logger.Info(" Message sent", "SendMessage"); }
if (addToHistory) ChatUpdatePatch.LastMessages.Add((text, sendTo, title, TimeStamp));
return writer;
}
int targetClientId = sendTo == byte.MaxValue ? -1 : receiver.OwnerId;
if (writer == null || writer.CurrentState == CustomRpcSender.State.Finished)
@@ -3685,6 +3685,9 @@ public static class Utils
AmongUsClient.Instance.SendOrDisconnect(writer);
writer.Recycle();
}, 3f, "Repeat Lobby Despawn");
if (GameStates.CurrentServerType == GameStates.ServerType.Vanilla && !PlayerControl.LocalPlayer.IsAlive())
PlayerControl.LocalPlayer.RpcMakeInvisible();
}
public static void AfterPlayerDeathTasks(PlayerControl target, bool onMeeting = false, bool disconnect = false)
+2 -2
View File
@@ -295,9 +295,9 @@ public static class ChatManager
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));
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)));
targets.Do(x => Loop.Times(30, _ => Utils.SendMessage(string.Empty, x.PlayerId, "​", force: true, sendOption: SendOption.None)));
return;
}
+1 -1
View File
@@ -984,7 +984,7 @@ internal static class MeetingHudStartPatch
{
TemplateManager.SendTemplate("OnMeeting", noErr: true, sendOption: SendOption.None);
if (MeetingStates.FirstMeeting) TemplateManager.SendTemplate("OnFirstMeeting", noErr: true, sendOption: SendOption.None);
}, 2f, log: false);
}, 6f, log: false);
NotifyRoleSkillOnMeetingStart();
+1 -1
View File
@@ -1818,7 +1818,7 @@ internal static class FixedUpdatePatch
additionalSuffixes.Add(AFKDetector.GetSuffix(seer, target));
if (!GameStates.IsMeeting && Options.CurrentGameMode == CustomGameMode.Standard && Main.Invisible.Contains(target.PlayerId) && ((self && target.GetCustomRole() is not (CustomRoles.Swooper or CustomRoles.Wraith or CustomRoles.Chameleon)) || (seer.IsImpostor() && target.IsImpostor())))
if (!GameStates.IsMeeting && Options.CurrentGameMode == CustomGameMode.Standard && Main.Invisible.Contains(target.PlayerId) && ((self && seer.IsAlive() && target.GetCustomRole() is not (CustomRoles.Swooper or CustomRoles.Wraith or CustomRoles.Chameleon)) || (seer.IsImpostor() && target.IsImpostor())))
additionalSuffixes.Add(ColorString(Palette.White_75Alpha, "\n" + GetString("Invisible")));
switch (target.GetCustomRole())
+14 -6
View File
@@ -31,11 +31,15 @@ public class Swapper : RoleBase
{
Options.SetupSingleRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.Swapper);
SwapMax = new IntegerOptionItem(Id + 3, "SwapperMax", new(0, 20, 1), 1, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper])
SwapMax = new IntegerOptionItem(Id + 3, "SwapperMax", new(0, 20, 1), 1, TabGroup.CrewmateRoles)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper])
.SetValueFormat(OptionFormat.Times);
CanSwapSelf = new BooleanOptionItem(Id + 2, "CanSwapSelfVotes", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper]);
CanStartMeeting = new BooleanOptionItem(Id + 4, "JesterCanUseButton", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper]);
CanSwapSelf = new BooleanOptionItem(Id + 2, "CanSwapSelfVotes", false, TabGroup.CrewmateRoles)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper]);
CanStartMeeting = new BooleanOptionItem(Id + 4, "JesterCanUseButton", true, TabGroup.CrewmateRoles)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper]);
SwapperAbilityUseGainWithEachTaskCompleted = new FloatOptionItem(Id + 6, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 0.3f, TabGroup.CrewmateRoles)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper])
@@ -45,7 +49,8 @@ public class Swapper : RoleBase
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper])
.SetValueFormat(OptionFormat.Times);
HideMsg = new BooleanOptionItem(Id + 5, "SwapperHideMsg", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper]);
HideMsg = new BooleanOptionItem(Id + 5, "SwapperHideMsg", true, TabGroup.CrewmateRoles)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Swapper]);
}
public override void Init()
@@ -248,8 +253,11 @@ public class Swapper : RoleBase
{
if (Starspawn.IsDayBreak) return;
if (CNO == null) CNO = CanSwapSelf.GetBool() ? new ShapeshiftMenuElement(shapeshifter.PlayerId) : null;
else if (CNO.playerControl.NetId == target.NetId) target = shapeshifter;
if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla)
{
if (CNO == null) CNO = CanSwapSelf.GetBool() ? new ShapeshiftMenuElement(shapeshifter.PlayerId) : null;
else if (CNO.playerControl.NetId == target.NetId) target = shapeshifter;
}
SwapMsg(shapeshifter, $"/sw {target.PlayerId}");
}