even more fixes

This commit is contained in:
Gurge44 committed 2026-06-17 18:43:10 +02:00
1 parent 62ec0a25eb
commit f23b4ea53b
7 files changed
+54 -19

No files matched your search

+1 -1
View File
@@ -91,7 +91,7 @@ internal static class HotPotato
public static string GetIndicator(byte id)
{
return HotPotatoState.HolderID == id ? " \u2668 " : string.Empty;
return HotPotatoState.HolderID == id ? " \u2668 <b>" : string.Empty;
}
public static string GetSuffixText(byte id, bool hud)
+8 -3
View File
@@ -132,6 +132,7 @@ public static class NaturalDisasters
public static void OnGameStart()
{
LoadAllDisasters();
DeathMessageQueue.Clear();
SurvivalTimes.Clear();
ActiveDisasters.Clear();
PreparingDisasters.Clear();
@@ -173,7 +174,11 @@ public static class NaturalDisasters
var collapsedRooms = BuildingCollapse.CollapsedRooms;
string cb;
if (allRooms.Count / 2 <= collapsedRooms.Count)
if (DisasterSpawnChances["BuildingCollapse"].GetInt() == 0)
{
cb = string.Empty;
}
else if (allRooms.Count / 2 <= collapsedRooms.Count)
{
SystemTypes[] remainingRooms = allRooms.Select(x => x.RoomId).Where(x => x is not (SystemTypes.Hallway or SystemTypes.Outside or SystemTypes.Decontamination2 or SystemTypes.Decontamination3)).Except(collapsedRooms.ConvertAll(x => x.RoomId)).ToArray();
cb = string.Format(Translator.GetString("AvailableBuildings"), remainingRooms.Length > 0
@@ -266,9 +271,9 @@ public static class NaturalDisasters
CustomGameMode.BedWars => (30, BedWars.IsGracePeriod),
CustomGameMode.HideAndSeek => (0, CustomHnS.IsBlindTime),
CustomGameMode.KingOfTheZones => (0, !KingOfTheZones.GameGoing),
CustomGameMode.RoomRush => (40, false),
CustomGameMode.RoomRush => (0, !RoomRush.GameGoing),
CustomGameMode.Deathrace => (0, !Deathrace.GameGoing),
CustomGameMode.Mingle => (60, !Mingle.GameGoing),
CustomGameMode.Mingle => (40, !Mingle.GameGoing),
_ => (0, false)
};
+20 -9
View File
@@ -35,7 +35,7 @@ public static class RoomRush
private static long TimeLimitEndTS;
private static HashSet<byte> DonePlayers = [];
private static bool GameGoing;
public static bool GameGoing;
public static DateTime GameStartDateTime;
private static RandomSpawn.SpawnMap Map;
@@ -700,7 +700,7 @@ public static class RoomRush
GameGoing = false;
int ventLimit = VentTimes.GetInt();
VentLimit = Main.EnumeratePlayerControls().ToDictionary(x => x.PlayerId, _ => ventLimit);
VentLimit = Main.CachedAllPlayerControls().ToDictionary(x => x.PlayerId, _ => ventLimit);
AllRooms = ShipStatus.Instance.AllRooms.Select(x => x.RoomId).ToHashSet();
AllRooms.Remove(SystemTypes.Hallway);
@@ -711,7 +711,7 @@ public static class RoomRush
Points = [];
if (WinByPointsInsteadOfDeaths.GetBool())
Points = Main.EnumeratePlayerControls().ToDictionary(x => x.PlayerId, _ => 0);
Points = Main.CachedAllPlayerControls().ToDictionary(x => x.PlayerId, _ => 0);
try { Map = RandomSpawn.SpawnMap.GetSpawnMap(); }
catch { }
@@ -807,7 +807,14 @@ public static class RoomRush
}
if (ventLimit > 0)
aapc.Do(x => x.RpcSetRoleGlobal(RoleTypes.Engineer));
{
for (int i = 0; i < aapc.Count; i++)
{
var pc = aapc[i];
if (!pc || !pc.IsAlive()) continue;
pc.RpcSetRoleGlobal(RoleTypes.Engineer);
}
}
Utils.SendRPC(CustomRPC.RoomRushDataSync, 1);
@@ -839,7 +846,6 @@ public static class RoomRush
DonePlayers.Clear();
RoomGoal = AllRooms.Without(previous).RandomElement();
Vector2 goalPos = RoomGoal.GetRoomClass().transform.position;
float speed = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
int time;
@@ -880,8 +886,13 @@ public static class RoomRush
TimeLimitEndTS = Utils.TimeStamp + time;
Logger.Info($"Starting a new round - Goal = from: {Translator.GetString(previous)} ({previous}), to: {Translator.GetString(RoomGoal)} ({RoomGoal}) - Time: {time} ({map})", "RoomRush");
Main.EnumeratePlayerControls().Do(x => LocateArrow.RemoveAllTarget(x.PlayerId));
if (DisplayArrowToRoom.GetBool()) Main.EnumeratePlayerControls().Do(x => LocateArrow.Add(x.PlayerId, goalPos));
try
{
Main.CachedAllPlayerControls().Do(x => LocateArrow.RemoveAllTarget(x.PlayerId));
Vector2 goalPos = RoomGoal.GetRoomClass().transform.position;
if (DisplayArrowToRoom.GetBool()) Main.CachedAllPlayerControls().Do(x => LocateArrow.Add(x.PlayerId, goalPos));
}
catch (Exception e) { Utils.ThrowException(e); }
Utils.NotifyRoles();
LateTask.New(() => Utils.DirtyName.Add(PlayerControl.LocalPlayer.PlayerId), 0.2f);
@@ -961,8 +972,8 @@ public static class RoomRush
case 1:
PointsToWinValue = PointsToWin.GetInt() * Main.AllAlivePlayerControlsCount;
int ventLimit = VentTimes.GetInt();
VentLimit = Main.EnumeratePlayerControls().ToDictionary(x => x.PlayerId, _ => ventLimit);
if (WinByPointsInsteadOfDeaths.GetBool()) Points = Main.EnumeratePlayerControls().ToDictionary(x => x.PlayerId, _ => 0);
VentLimit = Main.CachedAllPlayerControls().ToDictionary(x => x.PlayerId, _ => ventLimit);
if (WinByPointsInsteadOfDeaths.GetBool()) Points = Main.CachedAllPlayerControls().ToDictionary(x => x.PlayerId, _ => 0);
break;
case 2:
int limit = reader.ReadPackedInt32();
+1 -1
View File
@@ -189,7 +189,7 @@ public static class SpamManager
if (text.Length > 35)
return false;
string normalized = Normalize(text);
string normalized = Normalize(text).Replace("starlight", string.Empty);
foreach (string word in words)
{
+3 -3
View File
@@ -563,11 +563,11 @@ public static class TemplateManager
blocked = false;
blockSource = null;
List<TemplateEntry> restricted = [.. eligible.FindAll(hasCondition)];
List<TemplateEntry> restricted = eligible.FindAll(hasCondition);
if (restricted.Count == 0) return eligible;
List<TemplateEntry> unrestricted = [.. eligible.FindAll(e => !hasCondition(e))];
List<TemplateEntry> passing = [.. restricted.FindAll(meetsCondition)];
List<TemplateEntry> unrestricted = eligible.FindAll(e => !hasCondition(e));
List<TemplateEntry> passing = restricted.FindAll(meetsCondition);
if (passing.Count > 0) return passing;
if (unrestricted.Count > 0) return unrestricted;
+20 -1
View File
@@ -96,7 +96,26 @@ public static class Utils
private static readonly Dictionary<byte, (string Text, int Duration, bool Long)> LongRoleDescriptions = [];
public static bool DoRPC => AmongUsClient.Instance.AmHost && Main.EnumeratePlayerControls().Any(x => x.IsModdedClient() && !x.IsHost());
public static bool DoRPC
{
get
{
if (!AmongUsClient.Instance.AmHost) return false;
var apc = Main.CachedAllPlayerControls();
for (int i = 0; i < apc.Count; i++)
{
PlayerControl pc = apc[i];
if (pc && !pc.AmOwner && Main.PlayerVersion.ContainsKey(pc.PlayerId))
return true;
}
return false;
}
}
public static int TotalTaskCountForReset => Main.RealOptionsData.GetInt(Int32OptionNames.NumLongTasks) + Main.RealOptionsData.GetInt(Int32OptionNames.NumShortTasks);
public static bool IsAllAlive => Main.PlayerStates.Values.All(state => state.countTypes == CountTypes.OutOfGame || !state.IsDead);
+1 -1
View File
@@ -1387,7 +1387,7 @@ internal static class TaskPanelBehaviourPatch
{
FinalTextBuilder.Append("\r\n\r\n")
.Append("<size=90%>")
.Append(string.Join('\n', Main.EnumeratePlayerControls().Select(pc => new { pc, alive = pc.IsAlive() }).OrderByDescending(x => x.alive).Select(x => $"{(!x.alive ? "<#777777><s>" : "")}{HotPotato.GetIndicator(x.pc.PlayerId)}{(x.alive ? x.pc.PlayerId.ColoredPlayerName() : Main.AllPlayerNames.GetValueOrDefault(x.pc.PlayerId, $"ID {x.pc.PlayerId}"))}{(!x.alive ? $"</color> <#ff0000>{GetString("Dead")}</color></s>" : "")}")))
.Append(string.Join('\n', Main.EnumeratePlayerControls().Select(pc => new { pc, alive = pc.IsAlive() }).OrderByDescending(x => x.alive).Select(x => $"{(!x.alive ? "<#777777><s>" : "")}{HotPotato.GetIndicator(x.pc.PlayerId)}{(x.alive ? x.pc.PlayerId.ColoredPlayerName() : Main.AllPlayerNames.GetValueOrDefault(x.pc.PlayerId, $"ID {x.pc.PlayerId}"))}{(!x.alive ? $"</color></s> <#ff0000>{GetString("Dead")}</color>" : "</b>")}")))
.Append("</size>");
break;
}