mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Even more fixes
This commit is contained in:
1 parent
3d82a22b50
commit
13dce00fc6
17 files changed
+69
-67
No files matched your search
+3
-20
@@ -52,8 +52,6 @@ internal static class FFAManager
|
||||
public static OptionItem FFATeamMode;
|
||||
public static OptionItem FFATeamNumber;
|
||||
|
||||
public static Dictionary<byte, (string TEXT, long TIMESTAMP)> NameNotify = [];
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
FFAGameTime = new IntegerOptionItem(67_223_001, "FFA_GameTime", new(30, 600, 10), 300, TabGroup.GameSettings)
|
||||
@@ -151,26 +149,17 @@ internal static class FFAManager
|
||||
}
|
||||
}
|
||||
|
||||
LateTask.New(() => { Utils.NotifyRoles(NoCache: true, ForceLoop: true); }, 10f, log: false);
|
||||
LateTask.New(() => Utils.NotifyRoles(NoCache: true, ForceLoop: true), 10f, log: false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetNameNotify(PlayerControl player, ref string name)
|
||||
{
|
||||
if (Options.CurrentGameMode != CustomGameMode.FFA || player == null) return;
|
||||
if (NameNotify.TryGetValue(player.PlayerId, out (string TEXT, long TIMESTAMP) value))
|
||||
{
|
||||
name = value.TEXT;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetRankOfScore(byte playerId)
|
||||
public static int GetRankFromScore(byte playerId)
|
||||
{
|
||||
try
|
||||
{
|
||||
int ms = KillCount[playerId];
|
||||
int rank = 1 + KillCount.Values.Count(x => x > ms);
|
||||
rank += KillCount.Where(x => x.Value == ms).ToList().IndexOf(new(playerId, ms));
|
||||
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
|
||||
@@ -397,12 +386,6 @@ internal static class FFAManager
|
||||
|
||||
RoundTime--;
|
||||
|
||||
foreach (var pc in Main.AllPlayerControls.Where(pc => NameNotify.TryGetValue(pc.PlayerId, out var nn) && nn.TIMESTAMP < now).ToArray())
|
||||
{
|
||||
NameNotify.Remove(pc.PlayerId);
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
}
|
||||
|
||||
var rd = IRandom.Instance;
|
||||
byte FFAdoTPdecider = (byte)rd.Next(0, 100);
|
||||
bool FFAdoTP = FFAdoTPdecider == 0;
|
||||
|
||||
+12
-1
@@ -210,8 +210,19 @@ namespace EHR
|
||||
|
||||
private static void StartNewRound(bool initial = false)
|
||||
{
|
||||
SystemTypes previous = !initial
|
||||
? RoomGoal
|
||||
: Main.CurrentMap switch
|
||||
{
|
||||
MapNames.Skeld => SystemTypes.Cafeteria,
|
||||
MapNames.Mira => SystemTypes.Launchpad,
|
||||
MapNames.Dleks => SystemTypes.Cafeteria,
|
||||
MapNames.Polus => SystemTypes.Dropship,
|
||||
MapNames.Airship => SystemTypes.MainHall,
|
||||
MapNames.Fungle => SystemTypes.Dropship,
|
||||
_ => throw new ArgumentOutOfRangeException(Main.CurrentMap.ToString(), "Invalid map")
|
||||
};
|
||||
DonePlayers.Clear();
|
||||
SystemTypes previous = RoomGoal;
|
||||
RoomGoal = AllRooms.Without(previous).RandomElement();
|
||||
Vector2 goalPos = Map.Positions.GetValueOrDefault(RoomGoal, RoomGoal.GetRoomClass().transform.position);
|
||||
Vector2 previousPos = Map.Positions.GetValueOrDefault(previous, initial ? Main.AllAlivePlayerControls.RandomElement().Pos() : previous.GetRoomClass().transform.position);
|
||||
|
||||
@@ -42,7 +42,7 @@ public static class Camouflage
|
||||
public static bool BlockCamouflage;
|
||||
public static Dictionary<byte, NetworkedPlayerInfo.PlayerOutfit> PlayerSkins = [];
|
||||
public static List<byte> ResetSkinAfterDeathPlayers = [];
|
||||
public static HashSet<byte> WaitingForSkinChange = [];
|
||||
private static HashSet<byte> WaitingForSkinChange = [];
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
|
||||
@@ -330,7 +330,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Venter => CustomRoles.Impostor,
|
||||
CustomRoles.Agent => CustomRoles.Impostor,
|
||||
CustomRoles.Taskinator => CustomRoles.Crewmate,
|
||||
|
||||
|
||||
// Room Rush
|
||||
CustomRoles.RRPlayer => CustomRoles.Crewmate,
|
||||
|
||||
@@ -1174,6 +1174,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Technician => RoleOptionType.Neutral_Benign,
|
||||
CustomRoles.Tank => RoleOptionType.Neutral_Benign,
|
||||
CustomRoles.Totocalcio => RoleOptionType.Neutral_Benign,
|
||||
CustomRoles.Arsonist => RoleOptionType.Neutral_Evil,
|
||||
CustomRoles.Jester => RoleOptionType.Neutral_Evil,
|
||||
CustomRoles.Gaslighter => RoleOptionType.Neutral_Evil,
|
||||
CustomRoles.God => RoleOptionType.Neutral_Evil,
|
||||
|
||||
+15
-18
@@ -29,16 +29,16 @@ public static class DevManager
|
||||
[
|
||||
// Dev
|
||||
new(code: "actorour#0029", color: "#ffc0cb", tag: "TOHE/TONX Developer", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "KARPED1EM"),
|
||||
new(code: "pinklaze#1776", color: null, tag: "null", isUp: true, isDev: true, deBug: true, colorCmd: false, upName: "NCSIMON"),
|
||||
new(code: "keepchirpy#6354", color: "#1FF3C6", tag: "TOHE Developer", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "TommyXL"), //Tommy-XL
|
||||
new(code: "pinklaze#1776", color: null, tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "NCSIMON"),
|
||||
new(code: "keepchirpy#6354", color: "#1FF3C6", tag: "TOHEN Developer", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "TommyXL"), //Tommy-XL
|
||||
new(code: "motelchief#4112", color: "#eb57af", tag: "<alpha=#CC>Twilight Raven<alpha=#FF>", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "Drakos"), //Drakos
|
||||
new(code: "eagergaol#1562", color: "#5534eb", tag: "Drakos Alt", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "Drakos"), //Drakos Steam Alt
|
||||
new(code: "timedapper#9496", color: null, tag: null, isUp: false, isDev: true, deBug: false, colorCmd: false, upName: null), //阿龍
|
||||
new(code: "sofaagile#3120", color: "null", tag: "null", isUp: false, isDev: true, deBug: true, colorCmd: false, upName: null), //天寸
|
||||
new(code: "keyscreech#2151", color: "null", tag: null, isUp: false, isDev: true, deBug: false, upName: null), //Endrmen40409
|
||||
new(code: "timedapper#9496", color: null, tag: null, isUp: false, isDev: false, deBug: false, colorCmd: false, upName: null), //阿龍
|
||||
new(code: "sofaagile#3120", color: "null", tag: "null", isUp: false, isDev: false, deBug: false, colorCmd: false, upName: null), //天寸
|
||||
new(code: "keyscreech#2151", color: "null", tag: null, isUp: false, isDev: false, deBug: false, upName: null), //Endrmen40409
|
||||
|
||||
// Up
|
||||
new(code: "primether#5348", color: "null", tag: "<color=#FF0000>YouTuber</color>/<color=#8800FF>Streamer</color>", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "AnonWorks"),
|
||||
new(code: "primether#5348", color: "null", tag: "<color=#FF0000>YouTuber</color>/<color=#8800FF>Streamer</color>", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "AnonWorks"),
|
||||
new(code: "truantwarm#9165", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "萧暮不姓萧"),
|
||||
new(code: "drilldinky#1386", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "爱玩AU的河豚"),
|
||||
new(code: "farardour#6818", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "-提米SaMa-"),
|
||||
@@ -54,19 +54,18 @@ public static class DevManager
|
||||
new(code: "storkfey#3570", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Calypso"),
|
||||
new(code: "fellowsand#1003", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "C-Faust"),
|
||||
new(code: "jetsafe#8512", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Hoream是好人"),
|
||||
new(code: "primether#5348", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "AnonWorks"),
|
||||
new(code: "spoonkey#0792", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "没好康的"),
|
||||
new(code: "beakedmire#6099", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "茄-au"),
|
||||
new(code: "doggedsize#7892", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "TronAndRey"),
|
||||
new(code: "openlanded#9533", color: "#9e2424", tag: "God Of Death Love Apples", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "ryuk"),
|
||||
new(code: "unlikecity#4086", color: "#eD2F91", tag: "Ward", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Ward"),
|
||||
new(code: "iconicdrop#2727", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "jackler"),
|
||||
new(code: "openlanded#9533", color: "#9e2424", tag: "God Of Death Love Apples", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "ryuk"),
|
||||
new(code: "unlikecity#4086", color: "#eD2F91", tag: "Ward", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Ward"),
|
||||
new(code: "iconicdrop#2727", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "jackler"),
|
||||
|
||||
|
||||
new(code: "goneria#8334", color: "#FFFF00", tag: "The Dev on Phone", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "[Developer] The 200IQ guy"), // Me on phone
|
||||
new(code: "neatnet#5851", color: "#FFFF00", tag: "[Developer] The 200IQ guy", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "[Developer] The 200IQ guy"),
|
||||
new(code: "contenthue#0404", color: "#FFFF00", tag: "[Developer] The 200IQ guy", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "[Developer] The 200IQ guy"),
|
||||
new(code: "theseform#5686", color: "null", tag: "<color=#7800FF>PTBR-Translator</color>/<color=#FF0000>Role Idea Creator</color>", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Role idea creator"),
|
||||
new(code: "theseform#5686", color: "null", tag: "<color=#7800FF>PTBR-Translator</color>/<color=#FF0000>Role Idea Creator</color>", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Tomix"),
|
||||
new(code: "heavyclod#2286", color: "#FFFF00", tag: "小叨.exe已停止运行", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "小叨院长"),
|
||||
new(code: "storeroan#0331", color: "#FF0066", tag: "Night_瓜", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Night_瓜"),
|
||||
new(code: "teamelder#5856", color: "#1379bf", tag: "屑Slok(没信誉的鸽子)", isUp: true, isDev: false, colorCmd: false, deBug: false, upName: "Slok7565"),
|
||||
@@ -111,6 +110,8 @@ public static class DevManager
|
||||
new(code: "pagersane#4064", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Bluejava3"),
|
||||
new(code: "pocketdoor#9080", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Imnot"),
|
||||
new(code: "motorstack#2287", color: "#E34234", tag: "Foxfire", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Esrazraft"),
|
||||
new(code: "luckyframe#0173", color: "#666DCD", tag: "SUS Detector", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "[Blank]"),
|
||||
new(code: "numbsett#3800", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Shoyo"),
|
||||
|
||||
// Sponsor
|
||||
new(code: "recentduct#6068", color: "#FF00FF", tag: "高冷男模法师", isUp: false, isDev: false, colorCmd: false, deBug: true, upName: null),
|
||||
@@ -125,16 +126,12 @@ public static class DevManager
|
||||
new(code: "lordcosy#8966", color: "#FFD6EC", tag: "HostEHR", isUp: false, isDev: false, colorCmd: false, deBug: false, upName: null), //K
|
||||
new(code: "honestsofa#2870", color: "#D381D9", tag: "Discord: SolarFlare#0700", isUp: true, isDev: false, colorCmd: false, deBug: false, upName: "SolarFlare"), //SolarFlare
|
||||
new(code: "caseeast#7194", color: "#1c2451", tag: "disc.gg/maul", isUp: false, isDev: false, colorCmd: false, deBug: false, upName: null), //laikrai
|
||||
// lol hi go away
|
||||
//new(code: "gnuedaphic#7196", color: "#ffc0cb", tag: "TOH-RE Developer", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Loonie"), //Loonie
|
||||
// Lauryn and Moe
|
||||
new(code: "straymovie#6453", color: "#F6B05E", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Moe"), //Moe
|
||||
new(code: "singlesign#1823", color: "#ffb6cd", tag: "Princess", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Lauryn"), //Lauryn
|
||||
|
||||
// Other
|
||||
new(code: "peakcrown#8292", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: null), //Hakaka
|
||||
new(code: "peakcrown#8292", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: null) //Hakaka
|
||||
];
|
||||
}
|
||||
|
||||
public static bool IsDevUser(this string code) => DevUserList.Any(x => x.Code == code);
|
||||
private static bool IsDevUser(this string code) => DevUserList.Any(x => x.Code == code);
|
||||
public static DevUser GetDevUser(this string code) => code.IsDevUser() ? DevUserList.Find(x => x.Code == code) : DefaultDevUser;
|
||||
}
|
||||
+3
-3
@@ -706,7 +706,7 @@ static class CheckInvalidMovementPatch
|
||||
|
||||
public static void Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (!GameStates.IsInTask || ExileController.Instance || !Options.EnableMovementChecking.GetBool() || Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod) >= 1.9f || AmongUsClient.Instance.Ping >= 300 || Options.CurrentGameMode == CustomGameMode.NaturalDisasters || Utils.GetRegionName() is not ("EU" or "NA" or "AS") || __instance == null || __instance.PlayerId == 255 || !__instance.IsAlive()) return;
|
||||
if (!GameStates.IsInTask || ExileController.Instance || !Options.EnableMovementChecking.GetBool() || Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod) >= 1.9f || AmongUsClient.Instance.Ping >= 300 || Options.CurrentGameMode == CustomGameMode.NaturalDisasters || Utils.GetRegionName() is not ("EU" or "NA" or "AS") || __instance == null || __instance.PlayerId == 255 || !__instance.IsAlive() || __instance.inVent) return;
|
||||
|
||||
var pos = __instance.Pos();
|
||||
var now = Utils.TimeStamp;
|
||||
@@ -721,10 +721,10 @@ static class CheckInvalidMovementPatch
|
||||
|
||||
SetCurrentData();
|
||||
|
||||
if (ExemptedPlayers.Remove(__instance.PlayerId)) return;
|
||||
|
||||
if (Vector2.Distance(lastPosition, pos) > 10f && PhysicsHelpers.AnythingBetween(__instance.Collider, lastPosition, pos, Constants.ShipOnlyMask, false))
|
||||
{
|
||||
if (ExemptedPlayers.Remove(__instance.PlayerId)) return;
|
||||
|
||||
EAC.WarnHost();
|
||||
EAC.Report(__instance, "This player is moving too fast, possibly using a speed hack.");
|
||||
}
|
||||
|
||||
@@ -302,6 +302,8 @@ static class ExtendedPlayerControl
|
||||
player.RpcResetAbilityCooldown();
|
||||
player.SyncGeneralOptions();
|
||||
|
||||
if (Camouflage.IsCamouflage) Camouflage.RpcSetSkin(player);
|
||||
|
||||
NotifyRoles(SpecifySeer: player, NoCache: true);
|
||||
NotifyRoles(SpecifyTarget: player, NoCache: true);
|
||||
}
|
||||
|
||||
@@ -457,6 +457,8 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
|
||||
AURoleOptions.ProtectionDurationSeconds = 0f;
|
||||
AURoleOptions.ImpostorsCanSeeProtect = false;
|
||||
|
||||
Logger.Info($"Updated vision for {player.GetNameWithRole()}: Crew = {opt.GetFloat(FloatOptionNames.CrewLightMod)}, Impostor = {opt.GetFloat(FloatOptionNames.ImpostorLightMod)}", "BuildGameOptions");
|
||||
|
||||
return opt;
|
||||
|
||||
void SetMaxVision()
|
||||
|
||||
@@ -312,6 +312,7 @@ public static class GuessManager
|
||||
case CustomRoles.Pestilence:
|
||||
if (!isUI) Utils.SendMessage(GetString("GuessPestilence"), pc.PlayerId);
|
||||
else pc.ShowPopUp(GetString("GuessPestilence"));
|
||||
if (DoubleShot.CheckGuess(pc, isUI)) return true;
|
||||
guesserSuicide = true;
|
||||
break;
|
||||
case CustomRoles.Phantasm:
|
||||
@@ -367,7 +368,11 @@ public static class GuessManager
|
||||
if (!isUI) Utils.SendMessage(GetString("GuessOnbound"), pc.PlayerId);
|
||||
else pc.ShowPopUp(GetString("GuessOnbound"));
|
||||
|
||||
if (Onbound.GuesserSuicides.GetBool()) guesserSuicide = true;
|
||||
if (Onbound.GuesserSuicides.GetBool())
|
||||
{
|
||||
if (DoubleShot.CheckGuess(pc, isUI)) return true;
|
||||
guesserSuicide = true;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
|
||||
@@ -466,18 +471,14 @@ public static class GuessManager
|
||||
if (DoubleShot.CheckGuess(pc, isUI)) return true;
|
||||
guesserSuicide = true;
|
||||
}
|
||||
else if (pc.Is(CustomRoles.NiceGuesser) && target.Is(CustomRoleTypes.Crewmate) && !Options.GGCanGuessCrew.GetBool() && !pc.Is(CustomRoles.Madmate))
|
||||
else if (pc.Is(CustomRoles.NiceGuesser) && target.IsCrewmate() && !Options.GGCanGuessCrew.GetBool() && !pc.Is(CustomRoles.Madmate))
|
||||
{
|
||||
if (DoubleShot.CheckGuess(pc, isUI)) return true;
|
||||
|
||||
if (!isUI) Utils.SendMessage(GetString("GuessCrewRole"), pc.PlayerId, Utils.ColorString(Color.cyan, GetString("MessageFromGurge44")));
|
||||
else pc.ShowPopUp(Utils.ColorString(Color.cyan, GetString("MessageFromGurge44")) + "\n" + GetString("GuessCrewRole"));
|
||||
return true;
|
||||
}
|
||||
else if (pc.Is(CustomRoles.EvilGuesser) && target.Is(CustomRoleTypes.Impostor) && !Options.EGCanGuessImp.GetBool())
|
||||
else if (pc.Is(CustomRoles.EvilGuesser) && target.IsImpostor() && !Options.EGCanGuessImp.GetBool())
|
||||
{
|
||||
if (DoubleShot.CheckGuess(pc, isUI)) return true;
|
||||
|
||||
if (!isUI) Utils.SendMessage(GetString("GuessImpRole"), pc.PlayerId, Utils.ColorString(Color.cyan, GetString("MessageFromGurge44")));
|
||||
else pc.ShowPopUp(Utils.ColorString(Color.cyan, GetString("MessageFromGurge44")) + "\n" + GetString("GuessImpRole"));
|
||||
return true;
|
||||
|
||||
+1
-2
@@ -1383,7 +1383,7 @@ public static class Utils
|
||||
break;
|
||||
case CustomGameMode.FFA:
|
||||
List<(int, byte)> list2 = [];
|
||||
list2.AddRange(cloneRoles.Select(id => (FFAManager.GetRankOfScore(id), id)));
|
||||
list2.AddRange(cloneRoles.Select(id => (FFAManager.GetRankFromScore(id), id)));
|
||||
|
||||
list2.Sort();
|
||||
foreach ((int, byte) id in list2)
|
||||
@@ -2130,7 +2130,6 @@ public static class Utils
|
||||
SelfName = $"<size={fontSize}>{SelfTaskText}</size>\r\n{SelfName}";
|
||||
break;
|
||||
case CustomGameMode.FFA:
|
||||
FFAManager.GetNameNotify(seer, ref SelfName);
|
||||
SelfName = $"<size={fontSize}>{SelfTaskText}</size>\r\n{SelfName}";
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -564,7 +564,7 @@ static class GameEndChecker
|
||||
|
||||
if (FFAManager.RoundTime <= 0)
|
||||
{
|
||||
var winner = Main.GM.Value && Main.AllPlayerControls.Length == 1 ? PlayerControl.LocalPlayer : Main.AllPlayerControls.Where(x => !x.Is(CustomRoles.GM) && x != null).OrderBy(x => FFAManager.GetRankOfScore(x.PlayerId)).First();
|
||||
var winner = Main.GM.Value && Main.AllPlayerControls.Length == 1 ? PlayerControl.LocalPlayer : Main.AllPlayerControls.Where(x => !x.Is(CustomRoles.GM) && x != null).OrderBy(x => FFAManager.GetRankFromScore(x.PlayerId)).First();
|
||||
|
||||
byte winnerId = winner.PlayerId;
|
||||
|
||||
@@ -644,7 +644,7 @@ static class GameEndChecker
|
||||
}
|
||||
|
||||
PlayerControl[] aapc = Main.AllAlivePlayerControls;
|
||||
|
||||
|
||||
if (aapc.Any(x => x.GetTaskState().IsTaskFinished))
|
||||
{
|
||||
SetWinner(aapc.First(x => x.GetTaskState().IsTaskFinished));
|
||||
@@ -774,7 +774,7 @@ static class GameEndChecker
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class RoomRushGameEndPredicate : GameEndPredicate
|
||||
{
|
||||
public override bool CheckForEndGame(out GameOverReason reason)
|
||||
|
||||
+2
-2
@@ -671,7 +671,7 @@ static class TaskPanelBehaviourPatch
|
||||
|
||||
case CustomGameMode.FFA:
|
||||
|
||||
AllText += Main.PlayerStates.Keys.OrderBy(FFAManager.GetRankOfScore).Aggregate("<size=70%>", (s, x) => $"{s}\r\n{FFAManager.GetRankOfScore(x)}. {x.ColoredPlayerName()} -{string.Format(GetString("KillCount"), FFAManager.KillCount.GetValueOrDefault(x, 0))}");
|
||||
AllText += Main.PlayerStates.Keys.OrderBy(FFAManager.GetRankFromScore).Aggregate("<size=70%>", (s, x) => $"{s}\r\n{FFAManager.GetRankFromScore(x)}. {x.ColoredPlayerName()} -{string.Format(GetString("KillCount"), FFAManager.KillCount.GetValueOrDefault(x, 0))}");
|
||||
|
||||
AllText += "</size>";
|
||||
break;
|
||||
@@ -764,7 +764,7 @@ static class TaskPanelBehaviourPatch
|
||||
|
||||
AllText += "</size>";
|
||||
break;
|
||||
|
||||
|
||||
case CustomGameMode.RoomRush:
|
||||
|
||||
AllText += Main.AllPlayerControls
|
||||
|
||||
@@ -417,7 +417,7 @@ internal static class StartGameHostPatch
|
||||
while (true)
|
||||
{
|
||||
bool stopWaiting = true;
|
||||
int maxTimer = GameOptionsManager.Instance.CurrentGameOptions.MapId is 5 or 4 ? 20 : 15;
|
||||
int maxTimer = GameOptionsManager.Instance.CurrentGameOptions.MapId is 5 or 4 ? 17 : 12;
|
||||
lock (AUClient.allClients)
|
||||
{
|
||||
// For loop is necessary, or else when a client times out, a foreach loop will throw:
|
||||
@@ -840,10 +840,10 @@ internal static class StartGameHostPatch
|
||||
|
||||
if ((MapNames)Main.NormalOptions.MapId == MapNames.Airship && AmongUsClient.Instance.AmHost && Main.GM.Value)
|
||||
{
|
||||
LateTask.New(() => { PlayerControl.LocalPlayer.NetTransform.SnapTo(new(15.5f, 0.0f), (ushort)(PlayerControl.LocalPlayer.NetTransform.lastSequenceId + 8)); }, 15f, "GM Auto-TP Failsafe"); // TP to Main Hall
|
||||
LateTask.New(() => PlayerControl.LocalPlayer.NetTransform.SnapTo(new(15.5f, 0.0f), (ushort)(PlayerControl.LocalPlayer.NetTransform.lastSequenceId + 8)), 15f, "GM Auto-TP Failsafe"); // TP to Main Hall
|
||||
}
|
||||
|
||||
LateTask.New(() => { Main.HasJustStarted = false; }, 10f, "HasJustStarted to false");
|
||||
LateTask.New(() => Main.HasJustStarted = false, 12f, "HasJustStarted to false");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -430,7 +430,7 @@ class SetEverythingUpPatch
|
||||
case CustomGameMode.FFA:
|
||||
{
|
||||
List<(int, byte)> list = [];
|
||||
list.AddRange(cloneRoles.Select(id => (FFAManager.GetRankOfScore(id), id)));
|
||||
list.AddRange(cloneRoles.Select(id => (FFAManager.GetRankFromScore(id), id)));
|
||||
|
||||
list.Sort();
|
||||
foreach (var id in list.Where(x => EndGamePatch.SummaryText.ContainsKey(x.Item2)))
|
||||
|
||||
@@ -1171,7 +1171,7 @@ static class FixedUpdatePatch
|
||||
public static void Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (__instance == null || __instance.PlayerId == 255) return;
|
||||
|
||||
|
||||
if (__instance.PlayerId == PlayerControl.LocalPlayer.PlayerId)
|
||||
CustomNetObject.FixedUpdate();
|
||||
|
||||
@@ -1260,6 +1260,7 @@ static class FixedUpdatePatch
|
||||
ThrowException(ex);
|
||||
LastErrorTS = now;
|
||||
}
|
||||
|
||||
Logger.Error($"Error for {__instance.GetNameWithRole()}: {ex}", "FixedUpdatePatch");
|
||||
}
|
||||
}
|
||||
@@ -1487,7 +1488,7 @@ static class FixedUpdatePatch
|
||||
RoleText.enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool shouldSeeTargetAddons = playerId == lpId || new[] { PlayerControl.LocalPlayer, player }.All(x => x.Is(Team.Impostor));
|
||||
|
||||
var RoleTextData = GetRoleText(lpId, playerId, seeTargetBetrayalAddons: shouldSeeTargetAddons);
|
||||
@@ -1555,7 +1556,6 @@ static class FixedUpdatePatch
|
||||
SoloKombatManager.GetNameNotify(target, ref RealName);
|
||||
break;
|
||||
case CustomGameMode.FFA:
|
||||
FFAManager.GetNameNotify(target, ref RealName);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1957,6 +1957,8 @@ static class CoEnterVentPatch
|
||||
Main.KillTimers[__instance.myPlayer.PlayerId] = timer + 0.5f;
|
||||
}
|
||||
|
||||
CheckInvalidMovementPatch.ExemptedPlayers.Add(__instance.myPlayer.PlayerId);
|
||||
|
||||
switch (Options.CurrentGameMode)
|
||||
{
|
||||
case CustomGameMode.FFA when FFAManager.FFADisableVentingWhenTwoPlayersAlive.GetBool() && Main.AllAlivePlayerControls.Length <= 2:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 231 KiB |
@@ -179,11 +179,15 @@ namespace EHR.Crewmate
|
||||
|
||||
switch (TaskMode)
|
||||
{
|
||||
case true when pc.GetAbilityUseLimit() >= 1 || pc.GetTaskState().IsTaskFinished:
|
||||
case true when (pc.GetAbilityUseLimit() >= 1 || pc.GetTaskState().IsTaskFinished) && pc.IsAlive():
|
||||
pc.RpcChangeRoleBasis(CustomRoles.Wizard);
|
||||
TaskMode = false;
|
||||
break;
|
||||
case false when pc.GetAbilityUseLimit() < 1 || !pc.IsAlive():
|
||||
case false when !pc.IsAlive():
|
||||
pc.RpcSetRoleDesync(RoleTypes.CrewmateGhost, pc.GetClientId());
|
||||
TaskMode = true;
|
||||
break;
|
||||
case false when pc.GetAbilityUseLimit() < 1 && pc.IsAlive():
|
||||
pc.RpcChangeRoleBasis(CustomRoles.CrewmateEHR);
|
||||
pc.Notify(Translator.GetString("OutOfAbilityUsesDoMoreTasks"));
|
||||
TaskMode = true;
|
||||
|
||||
Reference in new issue
Block a user