mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
changelog
This commit is contained in:
1 parent
e833042a66
commit
b7912908fe
33 files changed
+157
-126
No files matched your search
+33
-7
@@ -1,15 +1,41 @@
|
||||
# Thank you so much for finding and using EHR!
|
||||
|
||||
> [!IMPORTANT]
|
||||
> InnerSloth added a way to use chat commands without needing to spam the chat after it to hide who typed it. In the next few weeks, please adapt to using commands with a `/cmd ` prefix. So if you were to type `/bt 4 snitch`, you would now type `/cmd bt 4 snitch`. This is the last major version of EHR that allows the old way of typing commands. Starting v7.3.0, the mod will NOT spam the chat even if you don't use /cmd.
|
||||
> [!CAUTION]
|
||||
> **Use commands with a `/cmd ` prefix, otherwise your message gets leaked.** So if you were to type `/bt 4 snitch`, you would now type `/cmd bt 4 snitch`. The system will NOT spam the chat after command usage even if it would be required.
|
||||
|
||||
## Bug Fixes
|
||||
- **Fixed chat commands sometimes not working when using the 'cmd' prefix**
|
||||
- Fixed an error that caused CNOs to not re-appear after meetings
|
||||
- Fixed some roles appearing in draft choices when they shouldn't
|
||||
- Fixed host's kill button lighting up when it shouldn't (by TommyXL
|
||||
- Natural Disasters: The same room can no longer collapse twice
|
||||
- Fixed Deadlined, Alchemist info not syncing for non-host modded clients
|
||||
- Fixed vanilla clients seeing Double Agent as impostor
|
||||
- Fixed role history sometimes showing incorrect names
|
||||
- Hopefully fixed black screens caused by Chat During Game settings enabled
|
||||
- Fixed Copycat reverting even after changing role mid-round
|
||||
- Fix Benefactor shield not working
|
||||
|
||||
## Changes
|
||||
- New welcome template message
|
||||
- Regular numbers in chat messages are now replaced to full-width unicode numbers to bypass InnerSloth's digit limit (they could've just used char.IsDigit but oh well)
|
||||
- **Major performance improvement**
|
||||
- There are now 20 presets instead of 10
|
||||
- Natural Disasters: If more rooms are collapsed than not, it shows the list of available buildings instead of the collapsed ones
|
||||
- Viper can't get Swift
|
||||
- FFA: Settings now _prevent_ you from entering vents instead of kicking you out of them
|
||||
- Moderators and VIPs are now immune to start spam triggers
|
||||
- Car propel stops in Lower Engine and Upper Engine on Skeld and Dleks
|
||||
- President decree numbers 0-5 ⇒ 1-6
|
||||
- Trapster fake body parents are now random players
|
||||
- Phantom can no longer kill while invisible woooooooooooo
|
||||
|
||||
## Additions
|
||||
- New role: Fakeshifter (Impostor Concealing) (by PH Gaming & Dechis)
|
||||
- New role: Perplexer (Impostor Support) (coded by PH Gaming)
|
||||
- New role: Scanner (Crewmate Support) (by PH Gaming & Dechis)
|
||||
- New role: Unshifter (Crewmate Support) (by PH Gaming & Dechis)
|
||||
- New role: Summoner (Coven Miscellaneous)
|
||||
- New add-on: Blessed (Global Helpful)
|
||||
- Settings to override the vision for all teams while in vents
|
||||
- Settings to have different player speeds for each map
|
||||
- Setting: `Game Time Limit Runs During Meetings`
|
||||
- Setting: `Add-on Assigning Roles Ignore the Maximum Add-ons Limit`
|
||||
- Onbound setting: `Maximum Distinct Guessing Attempts Blocked`
|
||||
|
||||
---
|
||||
@@ -307,7 +307,7 @@ public static class CaptureTheFlag
|
||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
|
||||
// Assign players to teams
|
||||
List<PlayerControl> players = Main.EnumerateAlivePlayerControls().Shuffle().ToList();
|
||||
List<PlayerControl> players = Main.EnumerateAlivePlayerControls().Shuffle();
|
||||
if (Main.GM.Value) players.RemoveAll(x => x.IsHost());
|
||||
if (ChatCommands.Spectators.Count > 0) players.RemoveAll(x => ChatCommands.Spectators.Contains(x.PlayerId));
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ internal static class CustomHnS
|
||||
try
|
||||
{
|
||||
PlayerControl pc = allPlayers.FirstOrDefault(x => x.PlayerId == item.Key);
|
||||
if (pc == null) continue;
|
||||
if (!pc) continue;
|
||||
|
||||
result[pc] = item.Value;
|
||||
allPlayers.RemoveAll(x => x.PlayerId == item.Key);
|
||||
@@ -189,7 +189,7 @@ internal static class CustomHnS
|
||||
try
|
||||
{
|
||||
PlayerControl pc = playerTeams[team][0];
|
||||
if (pc == null) continue;
|
||||
if (!pc) continue;
|
||||
|
||||
result[pc] = role;
|
||||
allPlayers.Remove(pc);
|
||||
@@ -497,7 +497,7 @@ internal static class CustomHnS
|
||||
|
||||
public static void AddFoxesToWinners()
|
||||
{
|
||||
List<byte> foxes = Main.PlayerStates.Values.Where(x => x.MainRole == CustomRoles.Fox && x.Player != null && x.Player.IsAlive()).Select(x => x.Player.PlayerId).ToList();
|
||||
List<byte> foxes = Main.PlayerStates.Values.Where(x => x.MainRole == CustomRoles.Fox && x.Player && x.Player.IsAlive()).Select(x => x.Player.PlayerId).ToList();
|
||||
if (foxes.Count == 0) return;
|
||||
|
||||
CustomWinnerHolder.AdditionalWinnerTeams.Add(AdditionalWinners.Fox);
|
||||
@@ -506,7 +506,7 @@ internal static class CustomHnS
|
||||
|
||||
public static void OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (killer == null || target == null || PlayerRoles[killer.PlayerId].Interface.Team != Team.Impostor || PlayerRoles[target.PlayerId].Interface.Team == Team.Impostor || IsBlindTime) return;
|
||||
if (PlayerRoles[killer.PlayerId].Interface.Team != Team.Impostor || PlayerRoles[target.PlayerId].Interface.Team == Team.Impostor || IsBlindTime) return;
|
||||
|
||||
killer.Kill(target);
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ public static class Deathrace
|
||||
target.MarkDirtySettings();
|
||||
LateTask.New(() =>
|
||||
{
|
||||
if (target == null) return;
|
||||
if (!target) return;
|
||||
Main.AllPlayerSpeed[target.PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
|
||||
RPC.PlaySoundRPC(target.PlayerId, Sounds.TaskComplete);
|
||||
target.MarkDirtySettings();
|
||||
@@ -416,7 +416,7 @@ public static class Deathrace
|
||||
{
|
||||
foreach (PlayerControl player in playersInRange)
|
||||
{
|
||||
if (player == null) continue;
|
||||
if (!player) continue;
|
||||
|
||||
if (Main.AllPlayerSpeed[player.PlayerId] < 0f) Main.AllPlayerSpeed[player.PlayerId] -= SmokeSpeedReduction;
|
||||
else Main.AllPlayerSpeed[player.PlayerId] += SmokeSpeedReduction;
|
||||
@@ -434,7 +434,7 @@ public static class Deathrace
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
if (pc == null || Mathf.Approximately(Main.AllPlayerSpeed[pc.PlayerId], Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod)) || Mathf.Approximately(Main.AllPlayerSpeed[pc.PlayerId], Main.MinSpeed)) return;
|
||||
if (!pc || Mathf.Approximately(Main.AllPlayerSpeed[pc.PlayerId], Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod)) || Mathf.Approximately(Main.AllPlayerSpeed[pc.PlayerId], Main.MinSpeed)) return;
|
||||
if (Main.AllPlayerSpeed[pc.PlayerId] < 0f) Main.AllPlayerSpeed[pc.PlayerId] += EnergyDrinkSpeedIncreasement;
|
||||
else Main.AllPlayerSpeed[pc.PlayerId] -= EnergyDrinkSpeedIncreasement;
|
||||
pc.MarkDirtySettings();
|
||||
@@ -455,7 +455,7 @@ public static class Deathrace
|
||||
{
|
||||
foreach (PlayerControl player in playersInRange)
|
||||
{
|
||||
if (player == null || !Main.PlayerStates.TryGetValue(player.PlayerId, out var state) || !state.IsBlackOut) continue;
|
||||
if (!player || !Main.PlayerStates.TryGetValue(player.PlayerId, out var state) || !state.IsBlackOut) continue;
|
||||
state.IsBlackOut = false;
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.TaskComplete);
|
||||
player.MarkDirtySettings();
|
||||
@@ -476,7 +476,7 @@ public static class Deathrace
|
||||
{
|
||||
foreach (PlayerControl player in playersInRange)
|
||||
{
|
||||
if (player == null || Main.AllPlayerSpeed[player.PlayerId] >= 0f) continue;
|
||||
if (!player || Main.AllPlayerSpeed[player.PlayerId] >= 0f) continue;
|
||||
Main.AllPlayerSpeed[player.PlayerId] *= -1;
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.TaskComplete);
|
||||
player.MarkDirtySettings();
|
||||
@@ -507,7 +507,7 @@ public static class Deathrace
|
||||
|
||||
foreach ((byte id, PlayerData data) in Data)
|
||||
{
|
||||
if (data.Player == null || !data.Player.IsAlive())
|
||||
if (!data.Player || !data.Player.IsAlive())
|
||||
{
|
||||
removeId = id;
|
||||
continue;
|
||||
@@ -525,9 +525,9 @@ public static class Deathrace
|
||||
|
||||
PlainShipRoom room = data.Player.GetPlainShipRoom();
|
||||
bool coordinateCheck = CoordinateChecks.TryGetValue((int)data.NextRoom, out var coordinates);
|
||||
if (room != null && room.RoomId is SystemTypes.Hallway or SystemTypes.Outside or SystemTypes.Decontamination2 or SystemTypes.Decontamination3) room = null;
|
||||
if (room && room.RoomId is SystemTypes.Hallway or SystemTypes.Outside or SystemTypes.Decontamination2 or SystemTypes.Decontamination3) room = null;
|
||||
|
||||
if ((room == null && !coordinateCheck) || (room != null && room.RoomId == data.LastRoom))
|
||||
if ((!room && !coordinateCheck) || (room && room.RoomId == data.LastRoom))
|
||||
{
|
||||
CheckAndNotify(data);
|
||||
continue;
|
||||
|
||||
+20
-15
@@ -168,7 +168,7 @@ internal static class FreeForAll
|
||||
rank += KillCount.Where(x => x.Value == ms).Select(x => x.Key).ToList().IndexOf(playerId); // In the old version, the struct 'KeyValuePair' was checked for equality using the inefficient runtime-provided implementation
|
||||
return rank;
|
||||
}
|
||||
catch { return Main.AllPlayerControls.Count; }
|
||||
catch { return PlayerControl.AllPlayerControls.Count; }
|
||||
}
|
||||
|
||||
public static string GetHudText()
|
||||
@@ -185,8 +185,6 @@ internal static class FreeForAll
|
||||
{
|
||||
try
|
||||
{
|
||||
if (killer == null || target == null || Options.CurrentGameMode != CustomGameMode.FFA) return;
|
||||
|
||||
if (target.inVent)
|
||||
{
|
||||
Logger.Info("Target is in a vent, kill blocked", "FFA");
|
||||
@@ -199,7 +197,7 @@ internal static class FreeForAll
|
||||
return;
|
||||
}
|
||||
|
||||
int totalalive = Main.AllAlivePlayerControls.Count;
|
||||
var aapc = Main.AllAlivePlayerControls;
|
||||
|
||||
if (FFAShieldedList.TryGetValue(target.PlayerId, out long dur))
|
||||
{
|
||||
@@ -218,15 +216,19 @@ internal static class FreeForAll
|
||||
|
||||
OnPlayerKill(killer);
|
||||
|
||||
if (totalalive == 3)
|
||||
if (aapc.Count == 3)
|
||||
{
|
||||
PlayerControl otherPC = null;
|
||||
|
||||
foreach (PlayerControl pc in Main.EnumerateAlivePlayerControls().Where(a => a.PlayerId != killer.PlayerId && a.PlayerId != target.PlayerId && a.IsAlive()))
|
||||
foreach (PlayerControl pc in aapc)
|
||||
{
|
||||
TargetArrow.Add(killer.PlayerId, pc.PlayerId);
|
||||
TargetArrow.Add(pc.PlayerId, killer.PlayerId);
|
||||
otherPC = pc;
|
||||
if (pc.PlayerId != killer.PlayerId && pc.PlayerId != target.PlayerId && pc.IsAlive())
|
||||
{
|
||||
TargetArrow.Add(killer.PlayerId, pc.PlayerId);
|
||||
TargetArrow.Add(pc.PlayerId, killer.PlayerId);
|
||||
otherPC = pc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Info($"The last 2 players ({killer.GetRealName().RemoveHtmlTags()} & {otherPC?.GetRealName().RemoveHtmlTags()}) now have an arrow toward each other", "FFA");
|
||||
@@ -234,7 +236,7 @@ internal static class FreeForAll
|
||||
if (FFADisableVentingWhenTwoPlayersAlive.GetBool())
|
||||
{
|
||||
if (killer.inVent) killer.MyPhysics?.RpcExitVent(killer.GetClosestVent().Id);
|
||||
if (otherPC != null && otherPC.inVent) otherPC.MyPhysics?.RpcExitVent(otherPC.GetClosestVent().Id);
|
||||
if (otherPC && otherPC.inVent) otherPC.MyPhysics?.RpcExitVent(otherPC.GetClosestVent().Id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,10 +354,12 @@ internal static class FreeForAll
|
||||
|
||||
public static string GetPlayerArrow(PlayerControl seer, PlayerControl target = null)
|
||||
{
|
||||
if (GameStates.IsMeeting || target != null && seer.PlayerId != target.PlayerId || Main.AllAlivePlayerControls.Count != 2) return string.Empty;
|
||||
if (GameStates.IsMeeting || target && seer.PlayerId != target.PlayerId) return string.Empty;
|
||||
var aapc = Main.AllAlivePlayerControls;
|
||||
if (aapc.Count != 2) return string.Empty;
|
||||
|
||||
PlayerControl otherPlayer = Main.EnumerateAlivePlayerControls().FirstOrDefault(pc => pc.IsAlive() && pc.PlayerId != seer.PlayerId);
|
||||
if (otherPlayer == null) return string.Empty;
|
||||
PlayerControl otherPlayer = aapc.FirstOrDefault(pc => pc.IsAlive() && pc.PlayerId != seer.PlayerId);
|
||||
if (!otherPlayer) return string.Empty;
|
||||
|
||||
string arrow = TargetArrow.GetArrows(seer, otherPlayer.PlayerId);
|
||||
return Utils.ColorString(Utils.GetRoleColor(CustomRoles.Killer), arrow);
|
||||
@@ -385,13 +389,14 @@ internal static class FreeForAll
|
||||
{
|
||||
Logger.Info("Swap everyone with someone", "FFA");
|
||||
|
||||
var aapc = Main.AllAlivePlayerControls;
|
||||
List<byte> changePositionPlayers = [];
|
||||
|
||||
foreach (PlayerControl pc in Main.EnumerateAlivePlayerControls())
|
||||
foreach (PlayerControl pc in aapc)
|
||||
{
|
||||
if (changePositionPlayers.Contains(pc.PlayerId) || !pc.IsAlive() || pc.onLadder || pc.inVent || pc.inMovingPlat) continue;
|
||||
|
||||
PlayerControl[] filtered = Main.EnumerateAlivePlayerControls().Where(a =>
|
||||
PlayerControl[] filtered = aapc.Where(a =>
|
||||
pc.IsAlive() && !pc.inVent && a.PlayerId != pc.PlayerId && !changePositionPlayers.Contains(a.PlayerId)).ToArray();
|
||||
|
||||
if (filtered.Length == 0) break;
|
||||
|
||||
@@ -139,7 +139,7 @@ internal static class HotPotato
|
||||
|
||||
PlayerControl holder = Utils.GetPlayerById(HotPotatoState.HolderID);
|
||||
|
||||
if (holder == null || holder.Data.Disconnected || !holder.IsAlive())
|
||||
if (!holder || holder.Data.Disconnected || !holder.IsAlive())
|
||||
{
|
||||
PassHotPotato();
|
||||
return;
|
||||
@@ -218,7 +218,7 @@ internal static class HotPotato
|
||||
|
||||
PlayerControl lastHolder = Utils.GetPlayerById(HotPotatoState.LastHolderID);
|
||||
|
||||
if (lastHolder != null)
|
||||
if (lastHolder)
|
||||
{
|
||||
if (CanPassViaKillButton && lastHolder.IsAlive()) lastHolder.RpcSetRoleGlobal(RoleTypes.Crewmate);
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ public static class KingOfTheZones
|
||||
try
|
||||
{
|
||||
PlayerControl player = id.GetPlayer();
|
||||
if (player == null) continue;
|
||||
if (!player) continue;
|
||||
string name = Main.AllPlayerNames[id];
|
||||
|
||||
var writer = CustomRpcSender.Create("KOTZ.GameStart.TeamAssignmentNotifies", SendOption.Reliable);
|
||||
@@ -353,7 +353,7 @@ public static class KingOfTheZones
|
||||
try
|
||||
{
|
||||
PlayerControl player = id.GetPlayer();
|
||||
if (player == null) continue;
|
||||
if (!player) continue;
|
||||
|
||||
byte colorId = team.GetColorId();
|
||||
player.SetColor(colorId);
|
||||
@@ -557,7 +557,7 @@ public static class KingOfTheZones
|
||||
sb.AppendLine(string.Format(GetString("KOTZ.Suffix.SpawnProtectionTime"), protectionEndTS - now));
|
||||
|
||||
PlainShipRoom room = seer.GetPlainShipRoom();
|
||||
SystemTypes zone = room == null ? SystemTypes.Hallway : room.RoomId;
|
||||
SystemTypes zone = !room ? SystemTypes.Hallway : room.RoomId;
|
||||
|
||||
if (justStarted) sb.Append(GetString(Zones.Count == 1 ? "KOTZ.SuffixHelp.Zones.Single" : "KOTZ.SuffixHelp.Zones.Plural"));
|
||||
sb.AppendLine(string.Join(" | ", Zones.Select(x => Utils.ColorString(ZoneDomination[x].GetColor(), (zone == x ? "<u>" : string.Empty) + GetString($"{x}") + (zone == x ? "</u>" : string.Empty) + (ZoneMoveSchedules.TryGetValue(x, out long moveTS) ? $"<size=80%> {(ZoneDowntimeExpire.TryGetValue(x, out long downtimeEndTS) ? Utils.ColorString(Color.gray, $"{downtimeEndTS - now}") : $"<#ffff44>{moveTS - now}</color>")}</size>" : string.Empty)))));
|
||||
@@ -812,7 +812,7 @@ public static class KingOfTheZones
|
||||
try
|
||||
{
|
||||
PlayerControl player = id.GetPlayer();
|
||||
if (player == null) continue;
|
||||
if (!player) continue;
|
||||
|
||||
player.ReviveFromTemporaryExile();
|
||||
player.TP(RandomSpawn.SpawnMap.GetSpawnMap().Positions.ExceptBy(Zones, x => x.Key).RandomElement().Value);
|
||||
|
||||
+5
-5
@@ -148,7 +148,7 @@ public static class Mingle
|
||||
{
|
||||
int count = GetNumPlayersInRoom(room);
|
||||
|
||||
if (plainShipRoom != null && plainShipRoom.RoomId == room)
|
||||
if (plainShipRoom && plainShipRoom.RoomId == room)
|
||||
sb.Append(hud ? "➡ " : "<u>");
|
||||
|
||||
if (DisplayCurrentPlayerCountInEachRoom)
|
||||
@@ -176,7 +176,7 @@ public static class Mingle
|
||||
sb.Append("</color>");
|
||||
}
|
||||
|
||||
if (plainShipRoom != null && plainShipRoom.RoomId == room && !hud)
|
||||
if (plainShipRoom && plainShipRoom.RoomId == room && !hud)
|
||||
sb.Append("</u>");
|
||||
|
||||
sb.Append('\n');
|
||||
@@ -194,7 +194,7 @@ public static class Mingle
|
||||
if (hud) sb.Append("</size></b>");
|
||||
}
|
||||
|
||||
if (plainShipRoom == null || !RequiredPlayerCount.ContainsKey(plainShipRoom.RoomId))
|
||||
if (!plainShipRoom || !RequiredPlayerCount.ContainsKey(plainShipRoom.RoomId))
|
||||
{
|
||||
sb.Append('\n');
|
||||
sb.Append("<#ffff00><size=70%>");
|
||||
@@ -295,7 +295,7 @@ public static class Mingle
|
||||
private static void KillPlayers()
|
||||
{
|
||||
var aapc = Main.AllAlivePlayerControls;
|
||||
Dictionary<PlayerControl, SystemTypes> playerRooms = aapc.Select(x => (pc: x, room: x.GetPlainShipRoom())).ToDictionary(x => x.pc, x => x.room == null ? SystemTypes.Outside : x.room.RoomId);
|
||||
Dictionary<PlayerControl, SystemTypes> playerRooms = aapc.Select(x => (pc: x, room: x.GetPlainShipRoom())).ToDictionary(x => x.pc, x => !x.room ? SystemTypes.Outside : x.room.RoomId);
|
||||
Dictionary<SystemTypes, int> playerCount = [];
|
||||
HashSet<PlayerControl> toKill = [];
|
||||
|
||||
@@ -369,7 +369,7 @@ public static class Mingle
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<SystemTypes, int> numPlayersInRoom = Main.EnumerateAlivePlayerControls().Select(x => (pc: x, room: x.GetPlainShipRoom())).GroupBy(x => x.room == null ? SystemTypes.Outside : x.room.RoomId).ToDictionary(x => x.Key, x => x.Count());
|
||||
Dictionary<SystemTypes, int> numPlayersInRoom = Main.EnumerateAlivePlayerControls().Select(x => (pc: x, room: x.GetPlainShipRoom())).GroupBy(x => !x.room ? SystemTypes.Outside : x.room.RoomId).ToDictionary(x => x.Key, x => x.Count());
|
||||
|
||||
yield return null;
|
||||
|
||||
|
||||
@@ -280,7 +280,12 @@ public static class NaturalDisasters
|
||||
{
|
||||
LastDisaster = now;
|
||||
List<Type> disasters = AllDisasters.ToList();
|
||||
if (ActiveDisasters.Exists(x => x is Thunderstorm)) disasters.RemoveAll(x => x.Name == "Thunderstorm");
|
||||
|
||||
if (ActiveDisasters.Exists(x => x is Thunderstorm))
|
||||
disasters.RemoveAll(x => x.Name == "Thunderstorm");
|
||||
|
||||
if ((Main.LIMap ? ShipStatus.Instance.AllRooms.Count : RandomSpawn.SpawnMap.GetSpawnMap().Positions.Count - (Main.CurrentMap == MapNames.Polus ? 3 : 1)) <= BuildingCollapse.CollapsedRooms.Count)
|
||||
disasters.RemoveAll(x => x.Name == "BuildingCollapse");
|
||||
|
||||
Type disaster = disasters.SelectMany(x => Enumerable.Repeat(x, DisasterSpawnChances[x.Name].GetInt() / 5)).RandomElement();
|
||||
KeyValuePair<SystemTypes, Vector2> roomKvp;
|
||||
|
||||
+6
-6
@@ -183,7 +183,7 @@ public static class Quiz
|
||||
char letter = (char)('A' + i);
|
||||
SystemTypes room = UsedRooms[Main.CurrentMap][letter];
|
||||
|
||||
bool isInThisRoom = room == SystemTypes.Outside ? seer.GetPlainShipRoom() == null || seer.IsInRoom(SystemTypes.Hallway) : seer.IsInRoom(room);
|
||||
bool isInThisRoom = room == SystemTypes.Outside ? !seer.GetPlainShipRoom() || seer.IsInRoom(SystemTypes.Hallway) : seer.IsInRoom(room);
|
||||
|
||||
string prefix = isInThisRoom ? "\u27a1 <u>" : string.Empty;
|
||||
string suffix = isInThisRoom ? "</u>" : string.Empty;
|
||||
@@ -239,7 +239,7 @@ public static class Quiz
|
||||
failed = gotCorrect < requiredCorrect;
|
||||
|
||||
var ffaTimeLeft = FFAEndTS - Utils.TimeStamp;
|
||||
var rooms = Main.EnumerateAlivePlayerControls().Without(seer).Select(x => x.GetPlainShipRoom()).Where(x => x != null).Select(x => x.RoomId).Distinct().Without(SystemTypes.Hallway).Select(x => GetString(x.ToString())).Join();
|
||||
var rooms = Main.EnumerateAlivePlayerControls().Without(seer).Select(x => x.GetPlainShipRoom()).Where(x => x).Select(x => x.RoomId).Distinct().Without(SystemTypes.Hallway).Select(x => GetString(x.ToString())).Join();
|
||||
return string.Format(GetString(failed ? "Quiz.Notify.FFAOngoing" : "Quiz.Notify.FFASpectating"), rooms, ffaTimeLeft);
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ public static class Quiz
|
||||
QuestionTimeLimitEndTS = 0;
|
||||
var aapc = Main.AllAlivePlayerControls;
|
||||
SystemTypes correctRoom = UsedRooms[Main.CurrentMap][(char)('A' + CurrentQuestion.CorrectAnswerIndex)];
|
||||
DyingPlayers = aapc.Select(x => (ID: x.PlayerId, Room: x.GetPlainShipRoom())).Where(x => correctRoom == SystemTypes.Outside ? x.Room != null && x.Room.RoomId != SystemTypes.Hallway : x.Room == null || x.Room.RoomId != correctRoom).Select(x => x.ID).ToList();
|
||||
DyingPlayers = aapc.Select(x => (ID: x.PlayerId, Room: x.GetPlainShipRoom())).Where(x => correctRoom == SystemTypes.Outside ? x.Room && x.Room.RoomId != SystemTypes.Hallway : !x.Room || x.Room.RoomId != correctRoom).Select(x => x.ID).ToList();
|
||||
if (DyingPlayers.Count == 0) NumAllCorrectAnswers++;
|
||||
bool everyoneWasWrong = DyingPlayers.Count == aapc.Count;
|
||||
if (!everyoneWasWrong) NumCorrectAnswers.IntersectBy(aapc.Select(x => x.PlayerId), x => x.Key).DoIf(x => !DyingPlayers.Contains(x.Key), x => x.Value[CurrentDifficulty][Round]++);
|
||||
@@ -486,7 +486,7 @@ public static class Quiz
|
||||
yield break;
|
||||
case 1:
|
||||
var pc = dyingPlayers[0].GetPlayer();
|
||||
if (pc == null) goto case 0;
|
||||
if (!pc) goto case 0;
|
||||
pc.RpcMakeVisible();
|
||||
pc.Suicide();
|
||||
goto case 0;
|
||||
@@ -511,7 +511,7 @@ public static class Quiz
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
if (GameStates.IsMeeting || ExileController.Instance || !GameStates.InGame || GameStates.IsLobby) yield break;
|
||||
Utils.NotifyRoles(SendOption: SendOption.None);
|
||||
stillLiving.RemoveAll(x => x == null || !x.IsAlive());
|
||||
stillLiving.RemoveAll(x => !x || !x.IsAlive());
|
||||
if (stillLiving.Count <= 1) break;
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ public static class Quiz
|
||||
if (CurrentDifficulty == Difficulty.Test)
|
||||
{
|
||||
SystemTypes correctRoom = UsedRooms[Main.CurrentMap][(char)('A' + CurrentQuestion.CorrectAnswerIndex)];
|
||||
DyingPlayers = Main.EnumerateAlivePlayerControls().Select(x => (ID: x.PlayerId, Room: x.GetPlainShipRoom())).Where(x => correctRoom == SystemTypes.Outside ? x.Room != null && x.Room.RoomId != SystemTypes.Hallway : x.Room == null || x.Room.RoomId != correctRoom).Select(x => x.ID).ToList();
|
||||
DyingPlayers = Main.EnumerateAlivePlayerControls().Select(x => (ID: x.PlayerId, Room: x.GetPlainShipRoom())).Where(x => correctRoom == SystemTypes.Outside ? x.Room && x.Room.RoomId != SystemTypes.Hallway : !x.Room || x.Room.RoomId != correctRoom).Select(x => x.ID).ToList();
|
||||
QuestionTimeLimitEndTS = 0;
|
||||
Utils.NotifyRoles();
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ public static class RoomRush
|
||||
|
||||
public static string GetSuffix(PlayerControl seer)
|
||||
{
|
||||
if (!GameGoing || Main.HasJustStarted || seer == null) return string.Empty;
|
||||
if (!GameGoing || Main.HasJustStarted) return string.Empty;
|
||||
|
||||
StringBuilder sb = new();
|
||||
bool dead = !seer.IsAlive();
|
||||
|
||||
@@ -192,7 +192,7 @@ public static class Snowdown
|
||||
if (GameEndsAfterTime && Utils.TimeStamp - GameStartTS >= GameEndTime)
|
||||
{
|
||||
int max = Data.Values.Max(x => x.Points);
|
||||
CustomWinnerHolder.WinnerIds = Data.Where(x => x.Value.Points == max && x.Key.GetPlayer() != null).Select(x => x.Key).ToHashSet();
|
||||
CustomWinnerHolder.WinnerIds = Data.Where(x => x.Value.Points == max && x.Key.GetPlayer()).Select(x => x.Key).ToHashSet();
|
||||
Logger.Info($"Winners: {(string.Join(", ", CustomWinnerHolder.WinnerIds.Select(x => Main.AllPlayerNames.GetValueOrDefault(x, "[Unknown player]"))))}", "Snowdown");
|
||||
Main.DoBlockNameChange = true;
|
||||
return true;
|
||||
@@ -266,7 +266,7 @@ public static class Snowdown
|
||||
{
|
||||
touchingSnowball.SetInactive();
|
||||
|
||||
if (touchingSnowball.Thrower != null && Data.TryGetValue(touchingSnowball.Thrower.PlayerId, out PlayerData throwerData) && throwerData.Coins < throwerData.MaxCoins)
|
||||
if (touchingSnowball.Thrower && Data.TryGetValue(touchingSnowball.Thrower.PlayerId, out PlayerData throwerData) && throwerData.Coins < throwerData.MaxCoins)
|
||||
throwerData.Coins++;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ internal static class SoloPVP
|
||||
rank += PlayerScore.Where(x => x.Value == ms).Select(x => x.Key).ToList().IndexOf(playerId);
|
||||
return rank;
|
||||
}
|
||||
catch { return Main.AllPlayerControls.Count; }
|
||||
catch { return PlayerControl.AllPlayerControls.Count; }
|
||||
}
|
||||
|
||||
public static string GetHudText()
|
||||
|
||||
@@ -103,7 +103,7 @@ public static class Speedrun
|
||||
|
||||
int time = Timers[pc.PlayerId];
|
||||
int alive = Main.AllAlivePlayerControls.Count;
|
||||
int apc = Main.AllPlayerControls.Count;
|
||||
int apc = PlayerControl.AllPlayerControls.Count;
|
||||
int killers = CanKill.Count;
|
||||
|
||||
string arrows = TargetArrow.GetAllArrows(pc.PlayerId);
|
||||
@@ -124,7 +124,7 @@ public static class Speedrun
|
||||
{
|
||||
PlayerControl player = aapc.FirstOrDefault(x => x.GetTaskState().IsTaskFinished);
|
||||
|
||||
if (player != null)
|
||||
if (player)
|
||||
{
|
||||
CustomWinnerHolder.WinnerIds = [player.PlayerId];
|
||||
reason = GameOverReason.CrewmatesByTask;
|
||||
@@ -191,7 +191,7 @@ public static class Speedrun
|
||||
CanKill.RemoveWhere(x =>
|
||||
{
|
||||
PlayerControl player = x.GetPlayer();
|
||||
return player == null || !player.IsAlive();
|
||||
return !player || !player.IsAlive();
|
||||
});
|
||||
|
||||
var aapc = Main.AllAlivePlayerControls;
|
||||
|
||||
@@ -390,7 +390,7 @@ internal static class StopAndGo
|
||||
rank += Main.PlayerStates.Values.Where(x => x.TaskState.CompletedTasksCount == ms).ToList().IndexOf(state);
|
||||
return rank;
|
||||
}
|
||||
catch { return Main.AllPlayerControls.Count; }
|
||||
catch { return PlayerControl.AllPlayerControls.Count; }
|
||||
}
|
||||
|
||||
public static string GetSuffixText(PlayerControl pc)
|
||||
|
||||
@@ -401,7 +401,7 @@ public static class TheMindGame
|
||||
|
||||
Round = 2;
|
||||
|
||||
DefaultColorIds.DoIf(x => x.Key != null && x.Value is >= byte.MinValue and <= byte.MaxValue, x => x.Key.RpcSetColor((byte)x.Value));
|
||||
DefaultColorIds.DoIf(x => x.Key && x.Value is >= byte.MinValue and <= byte.MaxValue, x => x.Key.RpcSetColor((byte)x.Value));
|
||||
|
||||
yield return NotifyEveryone("TMG.Notify.Round", 2, 2);
|
||||
if (Stop) yield break;
|
||||
|
||||
@@ -43,7 +43,7 @@ internal static class CustomRoleSelector
|
||||
{
|
||||
RoleResult = [];
|
||||
|
||||
if (Main.GM.Value && Main.AllPlayerControls.Count == 1) return;
|
||||
if (Main.GM.Value && PlayerControl.AllPlayerControls.Count == 1) return;
|
||||
|
||||
if (Options.CurrentGameMode != CustomGameMode.Standard)
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
foreach (var vent in ShipStatus.Instance.AllVents)
|
||||
{
|
||||
if (closest == null || Vector2.Distance(pos, vent.transform.position) < Vector2.Distance(pos, closest.transform.position))
|
||||
if (!closest || Vector2.Distance(pos, vent.transform.position) < Vector2.Distance(pos, closest.transform.position))
|
||||
closest = vent;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ internal static class ExtendedPlayerControl
|
||||
Vector2.Distance(playerpos, v1.transform.position)
|
||||
.CompareTo(Vector2.Distance(playerpos, v2.transform.position)));
|
||||
|
||||
if ((player.walkingToVent || player.inVent) && ResultBuffer.Count > 0 && ResultBuffer[0] != null)
|
||||
if ((player.walkingToVent || player.inVent) && ResultBuffer.Count > 0 && ResultBuffer[0])
|
||||
{
|
||||
var nearbyVents = ResultBuffer[0].NearbyVents;
|
||||
if (nearbyVents != null)
|
||||
@@ -141,7 +141,7 @@ internal static class ExtendedPlayerControl
|
||||
for (int i = nearbyVents.Length - 1; i >= 0; i--)
|
||||
{
|
||||
var v = nearbyVents[i];
|
||||
if (v != null)
|
||||
if (v)
|
||||
{
|
||||
ResultBuffer.Remove(v);
|
||||
ResultBuffer.Insert(0, v);
|
||||
@@ -792,9 +792,9 @@ internal static class ExtendedPlayerControl
|
||||
{
|
||||
MapNames.Fungle when overlapPointNonAlloc >= 2 => true,
|
||||
MapNames.MiraHQ when overlapPointNonAlloc >= 1 => true,
|
||||
MapNames.MiraHQ when room != null && room.RoomId is SystemTypes.MedBay or SystemTypes.Comms => true,
|
||||
MapNames.MiraHQ when room && room.RoomId is SystemTypes.MedBay or SystemTypes.Comms => true,
|
||||
MapNames.Airship when overlapPointNonAlloc >= 1 => true,
|
||||
MapNames.Skeld or MapNames.Dleks when room != null => true,
|
||||
MapNames.Skeld or MapNames.Dleks when room => true,
|
||||
MapNames.Polus when overlapPointNonAlloc >= 1 => true,
|
||||
MapNames.Polus when pos.y is >= -26.11f and <= -6.41f && pos.x is >= 3.56f and <= 32.68f => true,
|
||||
(MapNames)6 => true,
|
||||
@@ -859,7 +859,7 @@ internal static class ExtendedPlayerControl
|
||||
return;
|
||||
}
|
||||
|
||||
if (target == null) target = killer;
|
||||
if (!target) target = killer;
|
||||
|
||||
// Check Observer
|
||||
if (!forObserver && !MeetingStates.FirstMeeting) Main.EnumeratePlayerControls().Where(x => x.Is(CustomRoles.Observer) && killer.PlayerId != x.PlayerId).Do(x => x.RpcGuardAndKill(target, true));
|
||||
@@ -968,7 +968,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
switch (state.Role)
|
||||
{
|
||||
case SchrodingersCat cat when realKiller != null:
|
||||
case SchrodingersCat cat when realKiller:
|
||||
cat.OnCheckMurderAsTarget(realKiller, pc);
|
||||
return;
|
||||
case Veteran when Veteran.VeteranInProtect.Contains(pc.PlayerId):
|
||||
@@ -981,7 +981,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
Medic.IsDead(pc);
|
||||
|
||||
if (realKiller != null)
|
||||
if (realKiller)
|
||||
{
|
||||
pc.SetRealKiller(realKiller);
|
||||
|
||||
@@ -1019,7 +1019,7 @@ internal static class ExtendedPlayerControl
|
||||
if (!player.CanUseKillButton() && !AntiBlackout.SkipTasks && !IntroCutsceneDestroyPatch.PreventKill) return;
|
||||
|
||||
player.AddKillTimerToDict(cd: time);
|
||||
if (target == null) target = player;
|
||||
if (!target) target = player;
|
||||
|
||||
if (time >= 0f)
|
||||
Main.AllPlayerKillCooldown[player.PlayerId] = time * 2;
|
||||
@@ -1166,7 +1166,7 @@ internal static class ExtendedPlayerControl
|
||||
catch (Exception e)
|
||||
{
|
||||
ThrowException(e);
|
||||
return player == null || player.Data == null ? "Unknown Player" : player.Data.PlayerName;
|
||||
return !player || !player.Data ? "Unknown Player" : player.Data.PlayerName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1357,7 +1357,7 @@ internal static class ExtendedPlayerControl
|
||||
}
|
||||
catch (NullReferenceException nullReferenceException)
|
||||
{
|
||||
Logger.Error($"{nullReferenceException.Message} - player is null? {player == null}", "GetRealName");
|
||||
Logger.Error($"{nullReferenceException.Message} - player is null? {!player}", "GetRealName");
|
||||
return string.Empty;
|
||||
}
|
||||
catch (Exception exception)
|
||||
@@ -1938,7 +1938,7 @@ internal static class ExtendedPlayerControl
|
||||
public static (Vector2 Location, string RoomName) GetPositionInfo(this PlayerControl pc)
|
||||
{
|
||||
PlainShipRoom room = pc.GetPlainShipRoom();
|
||||
string roomName = GetString(room == null ? "Outside" : $"{room.RoomId}");
|
||||
string roomName = GetString(!room ? "Outside" : $"{room.RoomId}");
|
||||
Vector2 pos = pc.Pos();
|
||||
return (pos, roomName);
|
||||
}
|
||||
@@ -1993,7 +1993,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
if (Options.CurrentGameMode == CustomGameMode.SoloPVP || GameStates.IsLobby || !GameStates.InGame || !Main.IntroDestroyed) return;
|
||||
|
||||
if (target == null) target = killer;
|
||||
if (!target) target = killer;
|
||||
|
||||
CheckAndSpawnAdditionalRenegade(target.Data);
|
||||
|
||||
@@ -2013,7 +2013,7 @@ internal static class ExtendedPlayerControl
|
||||
target.SetRealKiller(killer, true);
|
||||
|
||||
PlayerControl realKiller = Main.PlayerStates.TryGetValue(target.PlayerId, out PlayerState state) ? state.RealKiller.ID.GetPlayer() ?? killer : killer;
|
||||
if (realKiller == null) realKiller = killer;
|
||||
if (!realKiller) realKiller = killer;
|
||||
|
||||
if (target.PlayerId == Godfather.GodfatherTarget)
|
||||
realKiller.RpcSetCustomRole(CustomRoles.Renegade);
|
||||
@@ -2115,7 +2115,7 @@ internal static class ExtendedPlayerControl
|
||||
{
|
||||
foreach (PlayerState ps in Main.PlayerStates.Values)
|
||||
{
|
||||
if (!ps.IsDead && ps.Role.SeesArrowsToDeadBodies && !ps.SubRoles.Contains(CustomRoles.Blind) && ps.Player != null)
|
||||
if (!ps.IsDead && ps.Role.SeesArrowsToDeadBodies && !ps.SubRoles.Contains(CustomRoles.Blind) && ps.Player)
|
||||
{
|
||||
LocateArrow.Add(ps.Player.PlayerId, pos);
|
||||
NotifyRoles(SpecifySeer: ps.Player, SpecifyTarget: ps.Player);
|
||||
@@ -2245,7 +2245,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
public static void SetRealKiller(this PlayerControl target, PlayerControl killer, bool notOverRide = false)
|
||||
{
|
||||
if (target == null)
|
||||
if (!target)
|
||||
{
|
||||
Logger.Info("target is null", "SetRealKiller");
|
||||
return;
|
||||
@@ -2254,7 +2254,7 @@ internal static class ExtendedPlayerControl
|
||||
PlayerState state = Main.PlayerStates[target.PlayerId];
|
||||
if (state.RealKiller.TimeStamp != DateTime.MinValue && notOverRide) return; // Do not overwrite if value already exists
|
||||
|
||||
byte killerId = killer == null ? byte.MaxValue : killer.PlayerId;
|
||||
byte killerId = !killer ? byte.MaxValue : killer.PlayerId;
|
||||
RPC.SetRealKiller(target.PlayerId, killerId);
|
||||
}
|
||||
|
||||
@@ -2309,7 +2309,6 @@ internal static class ExtendedPlayerControl
|
||||
return !area.bounds.Contains2D(pos);
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "ForCanBeConvertedToForeach")]
|
||||
public static PlainShipRoom GetPlainShipRoom(this PlayerControl pc)
|
||||
{
|
||||
if (!pc.IsAlive()) return null;
|
||||
@@ -2334,10 +2333,8 @@ internal static class ExtendedPlayerControl
|
||||
}
|
||||
}
|
||||
|
||||
var rooms = ShipStatus.Instance.AllRooms;
|
||||
for (int i = 0; i < rooms.Count; i++)
|
||||
foreach (var room in ShipStatus.Instance.AllRooms)
|
||||
{
|
||||
var room = rooms[i];
|
||||
if (room.RoomId is SystemTypes.Hallway or SystemTypes.Outside) continue;
|
||||
var area = room.roomArea;
|
||||
|
||||
@@ -2362,13 +2359,11 @@ internal static class ExtendedPlayerControl
|
||||
}
|
||||
|
||||
// WARNING: INACCURATE WITH NON-RECTANGLE ROOMS
|
||||
[SuppressMessage("ReSharper", "ForCanBeConvertedToForeach")]
|
||||
public static PlainShipRoom GetPlainShipRoom(this Vector2 pos)
|
||||
{
|
||||
var rooms = ShipStatus.Instance.AllRooms;
|
||||
for (int i = 0; i < rooms.Count; i++)
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var room in ShipStatus.Instance.AllRooms)
|
||||
{
|
||||
var room = rooms[i];
|
||||
if (room.RoomId is SystemTypes.Hallway or SystemTypes.Outside) continue;
|
||||
var area = room.roomArea;
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ public abstract class OptionItem
|
||||
public static void SyncAllOptions(int targetId = -1)
|
||||
{
|
||||
if (
|
||||
Main.AllPlayerControls.Count <= 1
|
||||
PlayerControl.AllPlayerControls.Count <= 1
|
||||
|| !AmongUsClient.Instance.AmHost
|
||||
|| PlayerControl.LocalPlayer == null
|
||||
)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -26,9 +25,8 @@ public static class OptionShower
|
||||
LastText = text;
|
||||
return text;
|
||||
}
|
||||
catch (Exception e)
|
||||
catch
|
||||
{
|
||||
if (!OnGameJoinedPatch.JoiningGame) Utils.ThrowException(e);
|
||||
return LastText;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public static class Statistics
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Options.CurrentGameMode != CustomGameMode.Standard || Main.AllPlayerControls.Count <= MinPlayers) return;
|
||||
if (Options.CurrentGameMode != CustomGameMode.Standard || PlayerControl.AllPlayerControls.Count <= MinPlayers) return;
|
||||
|
||||
PlayerControl lp = PlayerControl.LocalPlayer;
|
||||
|
||||
@@ -287,7 +287,7 @@ public static class Statistics
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!CustomRoleSelector.RoleResult.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out CustomRoles role) || Main.AllPlayerControls.Count <= MinPlayers) return;
|
||||
if (!CustomRoleSelector.RoleResult.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out CustomRoles role) || PlayerControl.AllPlayerControls.Count <= MinPlayers) return;
|
||||
|
||||
const float delay = 15f;
|
||||
|
||||
@@ -309,7 +309,7 @@ public static class Statistics
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Options.CurrentGameMode != CustomGameMode.Standard || killer.PlayerId == target.PlayerId || Main.AllPlayerControls.Count <= MinPlayers) return;
|
||||
if (Options.CurrentGameMode != CustomGameMode.Standard || killer.PlayerId == target.PlayerId || PlayerControl.AllPlayerControls.Count <= MinPlayers) return;
|
||||
|
||||
if (killer.AmOwner)
|
||||
{
|
||||
@@ -367,7 +367,7 @@ public static class Statistics
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Options.CurrentGameMode != CustomGameMode.Standard || Main.AllPlayerControls.Count <= MinPlayers) return;
|
||||
if (Options.CurrentGameMode != CustomGameMode.Standard || PlayerControl.AllPlayerControls.Count <= MinPlayers) return;
|
||||
|
||||
if (shapeshifter.AmOwner && shapeshifting && animated)
|
||||
{
|
||||
|
||||
+3
-3
@@ -346,7 +346,7 @@ public static class Utils
|
||||
{
|
||||
if (seer.Is(CustomRoles.GM) || seer.Is(CustomRoles.Seer)) return true;
|
||||
|
||||
if (!seer.IsAlive() || killer == seer || target == seer) { } //return false;
|
||||
// if (!seer.IsAlive() || killer == seer || target == seer) return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -442,7 +442,7 @@ public static class Utils
|
||||
|
||||
public static string GetRoleMode(CustomRoles role, bool parentheses = true)
|
||||
{
|
||||
if (Options.HideGameSettings.GetBool() && Main.AllPlayerControls.Count > 1) return string.Empty;
|
||||
if (Options.HideGameSettings.GetBool() && PlayerControl.AllPlayerControls.Count > 1) return string.Empty;
|
||||
|
||||
string mode;
|
||||
|
||||
@@ -756,7 +756,7 @@ public static class Utils
|
||||
{
|
||||
if (GameStates.IsLobby) return false;
|
||||
if (p.Tasks == null) return false;
|
||||
if (p.Role == null) return false;
|
||||
if (!p.Role) return false;
|
||||
|
||||
var hasTasks = true;
|
||||
PlayerState state = Main.PlayerStates[p.PlayerId];
|
||||
|
||||
@@ -1619,7 +1619,7 @@ internal static class ChatCommands
|
||||
{
|
||||
if (PollVotes.Count == 0) yield break;
|
||||
|
||||
bool notEveryoneVoted = Main.AllPlayerControls.Count - 1 > PollVotes.Values.Sum();
|
||||
bool notEveryoneVoted = PlayerControl.AllPlayerControls.Count - 1 > PollVotes.Values.Sum();
|
||||
|
||||
var resendTimer = 0f;
|
||||
|
||||
@@ -1627,7 +1627,7 @@ internal static class ChatCommands
|
||||
{
|
||||
if (!GameStates.IsLobby) yield break;
|
||||
|
||||
notEveryoneVoted = Main.AllPlayerControls.Count - 1 > PollVotes.Values.Sum();
|
||||
notEveryoneVoted = PlayerControl.AllPlayerControls.Count - 1 > PollVotes.Values.Sum();
|
||||
PollTimer -= Time.deltaTime;
|
||||
resendTimer += Time.deltaTime;
|
||||
|
||||
@@ -2085,7 +2085,7 @@ internal static class ChatCommands
|
||||
string toVote = text[6..].Replace(" ", string.Empty);
|
||||
if (!byte.TryParse(toVote, out byte voteId) || MeetingHud.Instance.playerStates?.FirstOrDefault(x => x.TargetPlayerId == player.PlayerId)?.DidVote is true or null) return;
|
||||
|
||||
if (voteId > Main.AllPlayerControls.Count) return;
|
||||
if (voteId > PlayerControl.AllPlayerControls.Count) return;
|
||||
|
||||
PlayerControl votedPlayer = voteId.GetPlayer();
|
||||
if (!player.UsesMeetingShapeshift() && Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state) && votedPlayer != null && state.Role.OnVote(player, votedPlayer)) return;
|
||||
|
||||
@@ -819,7 +819,7 @@ internal static class GameEndChecker
|
||||
|
||||
if (FreeForAll.RoundTime <= 0)
|
||||
{
|
||||
PlayerControl winner = Main.GM.Value && Main.AllPlayerControls.Count == 1 ? PlayerControl.LocalPlayer : Main.EnumeratePlayerControls().Where(x => !x.Is(CustomRoles.GM)).OrderBy(x => FreeForAll.GetRankFromScore(x.PlayerId)).First();
|
||||
PlayerControl winner = Main.GM.Value && PlayerControl.AllPlayerControls.Count == 1 ? PlayerControl.LocalPlayer : Main.EnumeratePlayerControls().Where(x => !x.Is(CustomRoles.GM)).OrderBy(x => FreeForAll.GetRankFromScore(x.PlayerId)).First();
|
||||
byte winnerId = winner.PlayerId;
|
||||
Logger.Warn($"Winner: {winner.GetRealName().RemoveHtmlTags()}", "FFA");
|
||||
WinnerIds = [winnerId];
|
||||
|
||||
@@ -130,7 +130,7 @@ internal static class ExileControllerWrapUpPatch
|
||||
AntiBlackout.RevertToActualRoleTypes();
|
||||
}, 2f, "Revert AntiBlackout Measures");
|
||||
|
||||
if (!Options.GameTimeLimitRunsDuringMeetings.GetBool())
|
||||
if (Options.EnableGameTimeLimit.GetBool() && !Options.GameTimeLimitRunsDuringMeetings.GetBool())
|
||||
Main.GameTimer.Start();
|
||||
}
|
||||
|
||||
|
||||
@@ -575,7 +575,7 @@ public static class GameStartRandomMap
|
||||
_ => 0
|
||||
});
|
||||
|
||||
int playerCount = Main.AllPlayerControls.Count;
|
||||
int playerCount = PlayerControl.AllPlayerControls.Count;
|
||||
if (playerCount < Options.MinPlayersForAirship.GetInt()) chance.Remove(4);
|
||||
if (playerCount < Options.MinPlayersForFungle.GetInt()) chance.Remove(5);
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ internal static class SetUpRoleTextPatch
|
||||
}
|
||||
|
||||
sb.Append("-------------Other Information-------------\n");
|
||||
sb.Append($"Number of players: {Main.AllPlayerControls.Count}\n");
|
||||
sb.Append($"Number of players: {PlayerControl.AllPlayerControls.Count}\n");
|
||||
sb.Append($"Game mode: {GetString(Options.CurrentGameMode.ToString())}\n");
|
||||
sb.Append($"Map: {Main.CurrentMap}\n");
|
||||
sb.Append($"Server: {Utils.GetRegionName()}");
|
||||
|
||||
@@ -278,7 +278,7 @@ internal static class CheckForEndVotingPatch
|
||||
if (tie)
|
||||
{
|
||||
var target = byte.MaxValue;
|
||||
int playerNum = Main.AllPlayerControls.Count;
|
||||
int playerNum = PlayerControl.AllPlayerControls.Count;
|
||||
|
||||
foreach (KeyValuePair<byte, int> data in votingData.Where(x => x.Key < playerNum && x.Value == max))
|
||||
{
|
||||
|
||||
@@ -153,7 +153,7 @@ internal static class CheckMurderPatch
|
||||
target = newTarget;
|
||||
}
|
||||
|
||||
if (target.Data == null
|
||||
if (!target.Data
|
||||
|| target.inVent
|
||||
|| target.inMovingPlat
|
||||
|| target.MyPhysics.Animations.IsPlayingEnterVentAnimation()
|
||||
@@ -354,7 +354,7 @@ internal static class CheckMurderPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return false;
|
||||
|
||||
if (target == null) target = killer;
|
||||
if (!target) target = killer;
|
||||
|
||||
if (CustomTeamManager.AreInSameCustomTeam(killer.PlayerId, target.PlayerId) && !CustomTeamManager.IsSettingEnabledForPlayerTeam(killer.PlayerId, CTAOption.KillEachOther))
|
||||
{
|
||||
@@ -755,7 +755,7 @@ internal static class MurderPlayerPatch
|
||||
if (target.Is(CustomRoles.Bait))
|
||||
{
|
||||
var realKiller = target.GetRealKiller();
|
||||
if (realKiller != null) killer = realKiller;
|
||||
if (realKiller) killer = realKiller;
|
||||
|
||||
if (killer.AmOwner && Main.PlayerStates.TryGetValue(killer.PlayerId, out var ks) && ks.GetKillCount() <= 1)
|
||||
Achievements.Type.OhNo.CompleteAfterGameEnd();
|
||||
@@ -951,7 +951,7 @@ internal static class ShapeshiftPatch
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
__instance.RpcSetName(Main.AllPlayerNames[target.PlayerId]);
|
||||
NotifyRoles(NoCache: true);
|
||||
NotifyRoles(SpecifyTarget: __instance, NoCache: true);
|
||||
}
|
||||
}, 1.2f, "PlayerControl.Shapeshift Prefix Patch - Force Name");
|
||||
}
|
||||
@@ -961,7 +961,7 @@ internal static class ShapeshiftPatch
|
||||
foreach (PlayerControl pc in Main.EnumerateAlivePlayerControls())
|
||||
{
|
||||
PlainShipRoom plainShipRoom = pc.GetPlainShipRoom();
|
||||
string room = GetString(plainShipRoom != null ? plainShipRoom.RoomId.ToString() : "Outside");
|
||||
string room = GetString(plainShipRoom ? plainShipRoom.RoomId.ToString() : "Outside");
|
||||
if (pc.Is(CustomRoles.Shiftguard)) pc.Notify($"[<#00ffa5>{room}</color>] {GetString(shapeshifting ? "ShiftguardNotifySS" : "ShiftguardNotifyUnshift")}");
|
||||
|
||||
switch (Main.PlayerStates[pc.PlayerId].Role)
|
||||
@@ -1023,7 +1023,7 @@ internal static class ReportDeadBodyPatch
|
||||
// Next, check whether this meeting is allowed
|
||||
//=============================================
|
||||
|
||||
if (target == null && Main.NumEmergencyMeetingsUsed.TryGetValue(__instance.PlayerId, out int used))
|
||||
if (!target && Main.NumEmergencyMeetingsUsed.TryGetValue(__instance.PlayerId, out int used))
|
||||
{
|
||||
if (used >= Main.RealOptionsData.GetInt(Int32OptionNames.NumEmergencyMeetings))
|
||||
{
|
||||
@@ -1039,7 +1039,7 @@ internal static class ReportDeadBodyPatch
|
||||
|
||||
if (Main.PlayerStates.Values.Any(x => x.Role is Tremor { IsDoom: true })) return false;
|
||||
|
||||
if (target == null)
|
||||
if (!target)
|
||||
{
|
||||
if (IsAnySabotageActive())
|
||||
{
|
||||
@@ -1074,11 +1074,11 @@ internal static class ReportDeadBodyPatch
|
||||
if (!Wyrd.CheckPlayerAction(__instance, Wyrd.Action.Button)) return false; // Player dies, no notify needed
|
||||
}
|
||||
|
||||
if (target != null)
|
||||
if (target)
|
||||
{
|
||||
if (Coroner.UnreportablePlayers.Contains(target.PlayerId)
|
||||
|| Vulture.UnreportablePlayers.Contains(target.PlayerId)
|
||||
|| (killer != null && killer.Is(CustomRoles.Goddess))
|
||||
|| (killer && killer.Is(CustomRoles.Goddess))
|
||||
|| Main.PlayerStates[target.PlayerId].deathReason == PlayerState.DeathReason.Gambled
|
||||
|| killerRole == CustomRoles.Scavenger
|
||||
|| Cleaner.CleanerBodies.Contains(target.PlayerId))
|
||||
@@ -1117,6 +1117,7 @@ internal static class ReportDeadBodyPatch
|
||||
if (!Summoner.OnAnyoneReport())
|
||||
{
|
||||
Notify("SummonedPlayerAlive");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Wyrd.CheckPlayerAction(__instance, Wyrd.Action.Report)) return false; // Player dies, no notify needed
|
||||
@@ -1128,7 +1129,7 @@ internal static class ReportDeadBodyPatch
|
||||
|
||||
if (!Main.PlayerStates[__instance.PlayerId].Role.CheckReportDeadBody(__instance, target, killer)) return false;
|
||||
|
||||
if (__instance.Is(CustomRoles.Unlucky) && (tpc == null || !tpc.Is(CustomRoles.Bait)))
|
||||
if (__instance.Is(CustomRoles.Unlucky) && (!tpc || !tpc.Is(CustomRoles.Bait)))
|
||||
{
|
||||
if (IRandom.Instance.Next(0, 100) < Options.UnluckyReportSuicideChance.GetInt())
|
||||
{
|
||||
@@ -1150,7 +1151,7 @@ internal static class ReportDeadBodyPatch
|
||||
}
|
||||
}
|
||||
|
||||
if (Options.SyncButtonMode.GetBool() && target == null)
|
||||
if (Options.SyncButtonMode.GetBool() && !target)
|
||||
{
|
||||
Logger.Info($"Max buttons: {Options.SyncedButtonCount.GetInt()}, used: {Options.UsedButtonCount}", "ReportDeadBody");
|
||||
|
||||
@@ -1202,7 +1203,7 @@ internal static class ReportDeadBodyPatch
|
||||
MarkEveryoneDirtySettings();
|
||||
}, 3f, "RemoveBlackout");
|
||||
|
||||
if (!Options.GameTimeLimitRunsDuringMeetings.GetBool())
|
||||
if (Main.GameTimer.IsRunning && !Options.GameTimeLimitRunsDuringMeetings.GetBool())
|
||||
Main.GameTimer.Stop();
|
||||
|
||||
LateTask.New(() =>
|
||||
@@ -1258,7 +1259,7 @@ internal static class ReportDeadBodyPatch
|
||||
|
||||
try
|
||||
{
|
||||
if (target == null)
|
||||
if (!target)
|
||||
{
|
||||
switch (Main.PlayerStates[player.PlayerId].Role)
|
||||
{
|
||||
@@ -2101,7 +2102,7 @@ internal static class FixedUpdatePatch
|
||||
if (Lovers.LoverDieConsequence.GetValue() == 0 || Main.IsLoversDead || (Main.LoversPlayers.FindAll(x => x.IsAlive()).Count != 1 && !force)) return;
|
||||
|
||||
PlayerControl partnerPlayer = Main.LoversPlayers.FirstOrDefault(player => player.PlayerId != deathId && player.IsAlive());
|
||||
if (partnerPlayer == null) return;
|
||||
if (!partnerPlayer) return;
|
||||
|
||||
Main.IsLoversDead = true;
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@ internal static class OnPlayerJoinedPatch
|
||||
|
||||
Utils.DirtyName.Add(PlayerControl.LocalPlayer.PlayerId);
|
||||
|
||||
if (Options.KickSlowJoiningPlayers.GetBool() && ((!client.IsDisconnected() && client.Character.Data.IsIncomplete) || ((client.Character.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= client.Character.Data.DefaultOutfit.ColorId) && Main.AllPlayerControls.Count <= 15)))
|
||||
if (Options.KickSlowJoiningPlayers.GetBool() && ((!client.IsDisconnected() && client.Character.Data.IsIncomplete) || ((client.Character.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= client.Character.Data.DefaultOutfit.ColorId) && PlayerControl.AllPlayerControls.Count <= 15)))
|
||||
{
|
||||
Logger.SendInGame(GetString("Error.InvalidColor") + $" {client.Id}/{client.PlayerName}", Color.yellow);
|
||||
AmongUsClient.Instance.KickPlayer(client.Id, false);
|
||||
@@ -493,7 +493,7 @@ internal static class OnPlayerJoinedPatch
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.Character != null && client.Character.Data != null && (client.Character.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= client.Character.Data.DefaultOutfit.ColorId) && Main.AllPlayerControls.Count >= 17)
|
||||
if (client.Character != null && client.Character.Data != null && (client.Character.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= client.Character.Data.DefaultOutfit.ColorId) && PlayerControl.AllPlayerControls.Count >= 17)
|
||||
Disco.ChangeColor(client.Character);
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -17,7 +17,7 @@ internal class Hider : RoleBase, IHideAndSeekRole
|
||||
public override bool IsEnable => On;
|
||||
public Team Team => Team.Crewmate;
|
||||
public int Chance => 100;
|
||||
public int Count => Main.AllPlayerControls.Count;
|
||||
public int Count => PlayerControl.AllPlayerControls.Count;
|
||||
public float RoleSpeed => Speed.GetFloat();
|
||||
public float RoleVision => Vision.GetFloat();
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ public class CovenMember : CovenBase
|
||||
On = true;
|
||||
Instances.Add(this);
|
||||
CovenMemberId = playerId;
|
||||
OnAnyoneDead();
|
||||
}
|
||||
|
||||
public override void Remove(byte playerId)
|
||||
|
||||
@@ -59,8 +59,8 @@ public class Overheat : RoleBase
|
||||
On = true;
|
||||
Temperature = StartingTemperature;
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
var chanceIncreaseTimer = new CountdownTimer(OverheatChanceIncreaseFrequency.GetFloat(), ChanceIncreaseElapsed, cancelOnMeeting: false);
|
||||
var rollChanceTimer = new CountdownTimer(OverheatRollChanceFrequency.GetFloat(), RollElapsed, cancelOnMeeting: false);
|
||||
var chanceIncreaseTimer = new CountdownTimer(OverheatChanceIncreaseFrequency.GetFloat() + 8, ChanceIncreaseElapsed, cancelOnMeeting: false);
|
||||
var rollChanceTimer = new CountdownTimer(OverheatRollChanceFrequency.GetFloat() + 8, RollElapsed, cancelOnMeeting: false);
|
||||
return;
|
||||
|
||||
void ChanceIncreaseElapsed()
|
||||
|
||||
Reference in new issue
Block a user