more fixes

This commit is contained in:
Gurge44 committed 2025-04-27 20:16:04 +02:00
1 parent 20ef028ac1
commit f06af53c4a
8 files changed
+38 -25

No files matched your search

+3
View File
@@ -51,6 +51,7 @@ public enum CustomRoles
EvilGuesser,
EvilTracker,
FireWorks,
Forger,
Framer,
Freezer,
Gambler,
@@ -141,6 +142,7 @@ public enum CustomRoles
Ankylosaurus,
Autocrat,
Bane,
Battery,
Beacon,
Benefactor,
Bodyguard,
@@ -159,6 +161,7 @@ public enum CustomRoles
LovingImpostor,
Crusader,
Dad,
Dealer,
Demolitionist,
Deputy,
Detective,
+3 -2
View File
@@ -568,7 +568,8 @@ internal static class MoveAndStop
data.UpdateCounters();
LastSuffix[pc.PlayerId] = GetSuffixText(pc);
if (!IsEventActive || Event.Type != Events.FrozenTimers)
LastSuffix[pc.PlayerId] = GetSuffixText(pc);
bool IsCounterRed(Counter counter) => counter.IsRed && (pc.IsHost() || counter.Timer != counter.TotalRedTime);
}
@@ -577,7 +578,7 @@ internal static class MoveAndStop
LastFixedUpdate = now;
RoundTime--;
Utils.NotifyRoles();
}
}
+8 -6
View File
@@ -144,6 +144,14 @@ public static class BanManager
{
if (!AmongUsClient.Instance.AmHost || !Options.ApplyBanList.GetBool() || player == null) return;
if (TempBanWhiteList.Contains(player.GetHashedPuid()))
{
AmongUsClient.Instance.KickPlayer(player.Id, true);
Logger.Info($"{player.PlayerName} was in temp ban list", "BAN");
}
if (GameStates.CurrentServerType is GameStates.ServerType.ModdedWithCNOSupport or GameStates.ServerType.ModdedWithoutCNOSupport) return;
string friendcode = player.FriendCode.Replace(':', '#');
if (friendcode.Length < 7) // #1234 is 5 chars, and it's impossible for a friend code to only have 3
@@ -189,12 +197,6 @@ public static class BanManager
Logger.Info($"{player.PlayerName} is on the EAC ban list", "BAN");
return;
}
if (TempBanWhiteList.Contains(player.GetHashedPuid()))
{
AmongUsClient.Instance.KickPlayer(player.Id, true);
Logger.Info($"{player.PlayerName} was in temp ban list", "BAN");
}
}
public static bool CheckBanList(string code, string hashedpuid = "")
+2
View File
@@ -115,6 +115,8 @@ internal static class CustomRoleSelector
case CustomRoles.Commander when optImpNum <= 1 && Commander.CannotSpawnAsSoloImp.GetBool():
case CustomRoles.Changeling when Changeling.GetAvailableRoles(true).Count == 0:
case CustomRoles.Camouflager when Camouflager.DoesntSpawnOnFungle.GetBool() && Main.CurrentMap == MapNames.Fungle:
case CustomRoles.Battery when Main.CurrentMap == MapNames.Fungle:
case CustomRoles.Beacon when Main.CurrentMap == MapNames.Fungle:
case CustomRoles.DarkHide when Main.CurrentMap == MapNames.Fungle:
case CustomRoles.Doormaster when Main.CurrentMap == MapNames.MiraHQ:
case CustomRoles.Pelican when Roles[RoleAssignType.Impostor].Any(x => x.Role == CustomRoles.Duellist):
+2 -2
View File
@@ -154,7 +154,7 @@ internal static class OnPlayerJoinedPatch
catch { }
}, 4f, "green bean kick late task", false);
if (AmongUsClient.Instance.AmHost && client.FriendCode == "" && Options.KickPlayerFriendCodeNotExist.GetBool() && !GameStates.IsLocalGame)
if (AmongUsClient.Instance.AmHost && client.FriendCode == "" && Options.KickPlayerFriendCodeNotExist.GetBool() && !GameStates.IsLocalGame && GameStates.CurrentServerType is not GameStates.ServerType.ModdedWithCNOSupport and not GameStates.ServerType.ModdedWithoutCNOSupport)
{
if (!BanManager.TempBanWhiteList.Contains(client.GetHashedPuid())) BanManager.TempBanWhiteList.Add(client.GetHashedPuid());
@@ -177,7 +177,7 @@ internal static class OnPlayerJoinedPatch
Logger.SendInGame("They were probably hacking tbh");
}
if (FastDestroyableSingleton<FriendsListManager>.Instance.IsPlayerBlockedUsername(client.FriendCode) && AmongUsClient.Instance.AmHost)
if (FastDestroyableSingleton<FriendsListManager>.Instance.IsPlayerBlockedUsername(client.FriendCode) && AmongUsClient.Instance.AmHost && GameStates.CurrentServerType is not GameStates.ServerType.ModdedWithCNOSupport and not GameStates.ServerType.ModdedWithoutCNOSupport)
{
AmongUsClient.Instance.KickPlayer(client.Id, true);
Logger.Info($"Blocked Player {client.PlayerName}({client.FriendCode}) has been banned.", "BAN");
+1 -1
View File
@@ -40,7 +40,7 @@ internal class Disco : IAddon
public static void OnFixedUpdate(PlayerControl pc)
{
if (!pc.Is(CustomRoles.Disco) || !GameStates.IsInTask || pc.IsShifted() || Camouflage.IsCamouflage || pc.inVent || pc.MyPhysics.Animations.IsPlayingEnterVentAnimation() || pc.walkingToVent || pc.onLadder || pc.MyPhysics.Animations.IsPlayingAnyLadderAnimation() || pc.inMovingPlat) return;
if (!pc.Is(CustomRoles.Disco) || !GameStates.IsInTask || ExileController.Instance || AntiBlackout.SkipTasks || pc.IsShifted() || Camouflage.IsCamouflage || pc.inVent || pc.MyPhysics.Animations.IsPlayingEnterVentAnimation() || pc.walkingToVent || pc.onLadder || pc.MyPhysics.Animations.IsPlayingAnyLadderAnimation() || pc.inMovingPlat) return;
long now = Utils.TimeStamp;
if (LastChange.TryGetValue(pc.PlayerId, out long change) && change + DiscoChangeInterval.GetInt() > now) return;
+4 -3
View File
@@ -66,13 +66,14 @@ internal class Beacon : RoleBase
float radius = Radius.GetFloat();
bool beaconNearby = Beacons.Any(x => Vector2.Distance(x.Pos(), pos) <= radius);
bool affectedPlayer = AffectedPlayers.Contains(pc.PlayerId);
bool lightsOff = Utils.IsActive(SystemTypes.Electrical);
switch (affectedPlayer)
{
case true when !beaconNearby:
{
AffectedPlayers.Remove(pc.PlayerId);
if (Utils.IsActive(SystemTypes.Electrical)) pc.MarkDirtySettings();
if (lightsOff) pc.MarkDirtySettings();
LastChange[pc.PlayerId] = now;
break;
@@ -80,11 +81,11 @@ internal class Beacon : RoleBase
case false when beaconNearby:
{
AffectedPlayers.Add(pc.PlayerId);
if (Utils.IsActive(SystemTypes.Electrical)) pc.MarkDirtySettings();
if (lightsOff) pc.MarkDirtySettings();
LastChange[pc.PlayerId] = now;
if (pc.IsLocalPlayer())
if (pc.IsLocalPlayer() && lightsOff)
Achievements.Type.ALightInTheShadows.CompleteAfterGameEnd();
break;
+15 -11
View File
@@ -60,22 +60,26 @@ internal class Predator : RoleBase
for (var i = 0; i < NumOfRolesToKill.GetInt(); i++)
{
int index = r.Next(allRoles.Count);
CustomRoles role = allRoles[index];
allRoles.RemoveAt(index);
if (role.Is(Team.Impostor))
try
{
if (impRoles >= MaxImpRolePicks.GetInt())
int index = r.Next(allRoles.Count);
CustomRoles role = allRoles[index];
allRoles.RemoveAt(index);
if (role.Is(Team.Impostor))
{
i--;
continue;
if (impRoles >= MaxImpRolePicks.GetInt())
{
i--;
continue;
}
impRoles++;
}
impRoles++;
RolesToKill.Add(role);
}
RolesToKill.Add(role);
catch (Exception e) { Utils.ThrowException(e); }
}
Logger.Info($"Predator Roles: {RolesToKill.Join()}", "Predator");