mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
lot of fixes, again
This commit is contained in:
1 parent
6c43700ac9
commit
65ee8a5e31
11 files changed
+950
-936
No files matched your search
@@ -99,7 +99,7 @@ public class CustomRpcSender
|
||||
{
|
||||
// StartMessage processing
|
||||
if (currentState == State.InRootMessage)
|
||||
EndMessage(startNew: GameStates.CurrentServerType == GameStates.ServerType.Vanilla || stream.Length > 800);
|
||||
EndMessage(startNew: true);
|
||||
|
||||
StartMessage(targetClientId);
|
||||
}
|
||||
@@ -130,12 +130,12 @@ public class CustomRpcSender
|
||||
{
|
||||
if (doneStreams.Count > 0)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var sb = new StringBuilder(" + Lengths: ");
|
||||
|
||||
doneStreams.ForEach(x =>
|
||||
{
|
||||
if (x.Length >= 1500 && sendOption == SendOption.Reliable) Logger.Warn($"Large reliable packet \"{name}\" is sending ({x.Length} bytes)", "CustomRpcSender");
|
||||
else if (log || x.Length > 3) sb.Append($" + Part {doneStreams.IndexOf(x) + 2} (Length: {x.Length})");
|
||||
else if (log || x.Length > 3) sb.Append($" | {x.Length}");
|
||||
|
||||
AmongUsClient.Instance.SendOrDisconnect(x);
|
||||
x.Recycle();
|
||||
|
||||
@@ -110,6 +110,8 @@ internal static class ExtendedPlayerControl
|
||||
// From: https://github.com/Rabek009/MoreGamemodes/blob/master/Modules/ExtendedPlayerControl.cs - coded by Rabek009
|
||||
public static void SetChatVisible(this PlayerControl player, bool visible)
|
||||
{
|
||||
Logger.Info($"Setting the chat {(visible ? "visible" : "hidden")} for {player.GetNameWithRole()}", "SetChatVisible");
|
||||
|
||||
if (player.AmOwner)
|
||||
{
|
||||
HudManager.Instance.Chat.SetVisible(visible);
|
||||
|
||||
+887
-882
File diff suppressed because it is too large.
Load diff
+8
-6
@@ -2460,13 +2460,15 @@ public static class Utils
|
||||
break;
|
||||
case CustomGameMode.AllInOne:
|
||||
bool alive = seer.IsAlive();
|
||||
if (alive) SelfSuffix.Append(SoloPVP.GetDisplayHealth(seer, true) + "\n");
|
||||
if (alive) SelfSuffix.Append(MoveAndStop.GetSuffixText(seer) + "\n");
|
||||
SelfSuffix.Append(HotPotato.GetSuffixText(seer.PlayerId) + "\n");
|
||||
if (alive && !seer.Is(CustomRoles.Killer)) SelfSuffix.Append(string.Format(GetString("DamoclesTimeLeft"), Speedrun.Timers[seer.PlayerId]) + "\n");
|
||||
SelfSuffix.Append(NaturalDisasters.SuffixText() + "\n");
|
||||
if (alive && CustomGameMode.SoloKombat.IsActiveOrIntegrated()) SelfSuffix.Append(SoloPVP.GetDisplayHealth(seer, true) + "\n");
|
||||
if (alive && CustomGameMode.MoveAndStop.IsActiveOrIntegrated()) SelfSuffix.Append(MoveAndStop.GetSuffixText(seer) + "\n");
|
||||
if (CustomGameMode.HotPotato.IsActiveOrIntegrated()) SelfSuffix.Append(HotPotato.GetSuffixText(seer.PlayerId) + "\n");
|
||||
if (alive && !seer.Is(CustomRoles.Killer) && CustomGameMode.Speedrun.IsActiveOrIntegrated()) SelfSuffix.Append(string.Format(GetString("DamoclesTimeLeft"), Speedrun.Timers[seer.PlayerId]) + "\n");
|
||||
if (CustomGameMode.NaturalDisasters.IsActiveOrIntegrated()) SelfSuffix.Append(NaturalDisasters.SuffixText() + "\n");
|
||||
const StringSplitOptions splitFlags = StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries;
|
||||
SelfSuffix.Append(RoomRush.GetSuffix(seer).Split('\n', splitFlags).Join(delimiter: " - "));
|
||||
if (CustomGameMode.RoomRush.IsActiveOrIntegrated()) SelfSuffix.Append(RoomRush.GetSuffix(seer).Split('\n', splitFlags).Join(delimiter: " - ") + "\n");
|
||||
if (CustomGameMode.KingOfTheZones.IsActiveOrIntegrated()) SelfSuffix.Append(KingOfTheZones.GetSuffix(seer) + "\n");
|
||||
if (CustomGameMode.Quiz.IsActiveOrIntegrated()) SelfSuffix.Append(Quiz.GetSuffix(seer));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1261,6 +1261,8 @@ internal static class ChatCommands
|
||||
|
||||
while ((notEveryoneVoted || gmPoll) && PollTimer > 0f)
|
||||
{
|
||||
if (!GameStates.IsLobby) yield break;
|
||||
|
||||
notEveryoneVoted = Main.AllPlayerControls.Length - 1 > PollVotes.Values.Sum();
|
||||
PollTimer -= Time.deltaTime;
|
||||
resendTimer += Time.deltaTime;
|
||||
@@ -1293,7 +1295,7 @@ internal static class ChatCommands
|
||||
PollAnswers.Clear();
|
||||
PollVoted.Clear();
|
||||
|
||||
if (winners.Length == 1 && gmPoll)
|
||||
if (winners.Length == 1 && gmPoll && GameStates.IsLobby)
|
||||
{
|
||||
int winnerIndex = winners[0].Key - 65;
|
||||
if (winnerIndex != 0) Options.GameMode.SetValue(winnerIndex - 1);
|
||||
|
||||
@@ -943,11 +943,13 @@ internal static class GameEndChecker
|
||||
{
|
||||
reason = GameOverReason.ImpostorsByKill;
|
||||
|
||||
if (Quiz.AllowKills) return false;
|
||||
|
||||
PlayerControl[] appc = Main.AllAlivePlayerControls;
|
||||
|
||||
switch (appc.Length)
|
||||
{
|
||||
case 1 when !Quiz.AllowKills:
|
||||
case 1:
|
||||
PlayerControl winner = appc[0];
|
||||
Logger.Info($"Winner: {winner.GetRealName().RemoveHtmlTags()}", "Quiz");
|
||||
WinnerIds = [winner.PlayerId];
|
||||
|
||||
+20
-16
@@ -779,31 +779,35 @@ internal static class BeginImpostorPatch
|
||||
{
|
||||
CustomRoles role = PlayerControl.LocalPlayer.GetCustomRole();
|
||||
|
||||
if (PlayerControl.LocalPlayer.Is(CustomRoles.Madmate) || role.IsMadmate())
|
||||
if (PlayerControl.LocalPlayer.IsImpostor() && Options.ImpKnowWhosMadmate.GetBool())
|
||||
{
|
||||
foreach (var pc in Main.AllPlayerControls)
|
||||
{
|
||||
if (pc.IsMadmate() && !pc.IsLocalPlayer())
|
||||
yourTeam.Add(pc);
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerControl.LocalPlayer.IsMadmate())
|
||||
{
|
||||
yourTeam = new();
|
||||
yourTeam.Add(PlayerControl.LocalPlayer);
|
||||
|
||||
if (role != CustomRoles.Parasite) // Parasite and Impostor doesn't know each other
|
||||
if (Options.MadmateKnowWhosImp.GetBool())
|
||||
{
|
||||
// Crewpostor is counted as Madmate but should be an Impostor
|
||||
if (Options.MadmateKnowWhosImp.GetBool() || role != CustomRoles.Madmate)
|
||||
foreach (var pc in Main.AllPlayerControls)
|
||||
{
|
||||
foreach (var pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
if (pc.GetCustomRole().IsImpostor() && pc.PlayerId != PlayerControl.LocalPlayer.PlayerId)
|
||||
yourTeam.Add(pc);
|
||||
}
|
||||
if (pc.IsImpostor() && !pc.IsLocalPlayer())
|
||||
yourTeam.Add(pc);
|
||||
}
|
||||
}
|
||||
|
||||
// Crewpostor is counted as Madmate but should be an Impostor
|
||||
if (Options.MadmateKnowWhosMadmate.GetBool() || role != CustomRoles.Madmate && Options.ImpKnowWhosMadmate.GetBool())
|
||||
if (Options.MadmateKnowWhosMadmate.GetBool())
|
||||
{
|
||||
foreach (var pc in Main.AllPlayerControls)
|
||||
{
|
||||
foreach (var pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
if (pc.Is(CustomRoles.Madmate) && pc.PlayerId != PlayerControl.LocalPlayer.PlayerId)
|
||||
yourTeam.Add(pc);
|
||||
}
|
||||
if (pc.IsMadmate() && !pc.IsLocalPlayer())
|
||||
yourTeam.Add(pc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +234,8 @@ internal static class CheckMurderPatch
|
||||
FreeForAll.OnPlayerAttack(killer, target);
|
||||
return false;
|
||||
case CustomGameMode.HotPotato:
|
||||
if (HotPotato.CanPassViaKillButton && HotPotato.GetState().HolderID == killer.PlayerId)
|
||||
(byte holderID, byte lastHolderID) = HotPotato.GetState();
|
||||
if (HotPotato.CanPassViaKillButton && holderID == killer.PlayerId && lastHolderID != target.PlayerId)
|
||||
HotPotato.FixedUpdatePatch.PassHotPotato(target, false);
|
||||
return false;
|
||||
case CustomGameMode.MoveAndStop:
|
||||
@@ -1832,10 +1833,12 @@ internal static class FixedUpdatePatch
|
||||
Suffix.Append(Quiz.GetSuffix(seer));
|
||||
break;
|
||||
case CustomGameMode.AllInOne:
|
||||
if (alive) Suffix.Append(SoloPVP.GetDisplayHealth(target, self));
|
||||
if (self && alive) Suffix.Append("\n" + MoveAndStop.GetSuffixText(seer) + "\n");
|
||||
if (self && alive && !seer.Is(CustomRoles.Killer)) Suffix.Append(string.Format(GetString("DamoclesTimeLeft"), Speedrun.Timers[seer.PlayerId]) + "\n");
|
||||
if (self) Suffix.Append(RoomRush.GetSuffix(seer).Replace("\n", " - "));
|
||||
if (alive && CustomGameMode.SoloKombat.IsActiveOrIntegrated()) Suffix.Append(SoloPVP.GetDisplayHealth(target, self));
|
||||
if (self && alive && CustomGameMode.MoveAndStop.IsActiveOrIntegrated()) Suffix.Append("\n" + MoveAndStop.GetSuffixText(seer) + "\n");
|
||||
if (self && alive && !seer.Is(CustomRoles.Killer) && CustomGameMode.Speedrun.IsActiveOrIntegrated()) Suffix.Append(string.Format(GetString("DamoclesTimeLeft"), Speedrun.Timers[seer.PlayerId]) + "\n");
|
||||
if (self && CustomGameMode.RoomRush.IsActiveOrIntegrated()) Suffix.Append(RoomRush.GetSuffix(seer).Replace("\n", " - ") + "\n");
|
||||
if (self && CustomGameMode.KingOfTheZones.IsActiveOrIntegrated()) Suffix.Append(KingOfTheZones.GetSuffix(seer) + "\n");
|
||||
if (self && CustomGameMode.Quiz.IsActiveOrIntegrated()) Suffix.Append(Quiz.GetSuffix(seer));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,9 @@ public class Abyssbringer : RoleBase
|
||||
|
||||
void RemoveBlackHole()
|
||||
{
|
||||
LateTask.New(() => BlackHoles.RemoveAt(i), 0f, log: false);
|
||||
BlackHoles.RemoveAt(i);
|
||||
i--;
|
||||
count--;
|
||||
blackHole.NetObject.Despawn();
|
||||
Utils.SendRPC(CustomRPC.SyncRoleData, AbyssbringerId, 3, i);
|
||||
Notify();
|
||||
|
||||
@@ -139,7 +139,7 @@ public class Councillor : RoleBase
|
||||
if (target != null)
|
||||
{
|
||||
Logger.Info($"{pc.GetNameWithRole().RemoveHtmlTags()} murdered {target.GetNameWithRole().RemoveHtmlTags()}", "Councillor");
|
||||
var CouncillorSuicide = true;
|
||||
var councillorSuicide = true;
|
||||
|
||||
if (pc.GetAbilityUseLimit() < 1)
|
||||
{
|
||||
@@ -181,7 +181,7 @@ public class Councillor : RoleBase
|
||||
return true;
|
||||
}
|
||||
|
||||
var NoSuicide = false;
|
||||
var noSuicide = false;
|
||||
|
||||
if (pc.PlayerId == targetId)
|
||||
{
|
||||
@@ -191,26 +191,17 @@ public class Councillor : RoleBase
|
||||
pc.ShowPopUp(Utils.ColorString(Color.cyan, GetString("MessageFromKPD")) + "\n" + GetString("LaughToWhoMurderSelf"));
|
||||
}
|
||||
else if (target.IsMadmate() && CanMurderMadmate.GetBool())
|
||||
CouncillorSuicide = false;
|
||||
else if (target.Is(CustomRoles.SuperStar))
|
||||
NoSuicide = true;
|
||||
else if (target.Is(CustomRoles.Snitch) && target.AllTasksCompleted())
|
||||
NoSuicide = true;
|
||||
else if (target.Is(CustomRoles.Guardian) && target.AllTasksCompleted())
|
||||
NoSuicide = true;
|
||||
else if (target.Is(CustomRoles.Merchant) && Merchant.IsBribedKiller(pc, target))
|
||||
NoSuicide = true;
|
||||
else if (target.IsImpostor() && CanMurderImpostor.GetBool())
|
||||
CouncillorSuicide = false;
|
||||
else if (target.IsCrewmate())
|
||||
CouncillorSuicide = false;
|
||||
else if (target.GetCustomRole().IsNeutral() && !target.Is(CustomRoles.Pestilence)) CouncillorSuicide = false;
|
||||
councillorSuicide = false;
|
||||
else if (target.Is(CustomRoles.SuperStar) || target.Is(CustomRoles.Snitch) && target.AllTasksCompleted() || target.Is(CustomRoles.Guardian) && target.AllTasksCompleted() || target.Is(CustomRoles.Merchant) && Merchant.IsBribedKiller(pc, target))
|
||||
noSuicide = true;
|
||||
else if (target.IsImpostor() && CanMurderImpostor.GetBool() || target.IsCrewmate() || target.GetCustomRole().IsNeutral() && !target.Is(CustomRoles.Pestilence) || target.Is(CustomRoleTypes.Coven))
|
||||
councillorSuicide = false;
|
||||
|
||||
if (NoSuicide) return true;
|
||||
if (noSuicide) return true;
|
||||
|
||||
PlayerControl dp = CouncillorSuicide ? pc : target;
|
||||
PlayerControl dp = councillorSuicide ? pc : target;
|
||||
|
||||
string Name = dp.GetRealName();
|
||||
string name = dp.GetRealName();
|
||||
|
||||
pc.RpcRemoveAbilityUse();
|
||||
MeetingKillLimit[pc.PlayerId]--;
|
||||
@@ -224,7 +215,7 @@ public class Councillor : RoleBase
|
||||
|
||||
Utils.AfterPlayerDeathTasks(dp, true);
|
||||
|
||||
LateTask.New(() => Utils.SendMessage(string.Format(GetString("MurderKill"), Name), 255, Utils.ColorString(Utils.GetRoleColor(CustomRoles.NiceGuesser), GetString("MurderKillTitle"))), 0.6f, "Guess Msg");
|
||||
LateTask.New(() => Utils.SendMessage(string.Format(GetString("MurderKill"), name), 255, Utils.ColorString(Utils.GetRoleColor(CustomRoles.NiceGuesser), GetString("MurderKillTitle"))), 0.6f, "Guess Msg");
|
||||
}, 0.2f, "Murder Kill");
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,8 @@ internal class Arsonist : RoleBase
|
||||
|
||||
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
killer.SetKillCooldown(ArsonistDouseTime.GetFloat());
|
||||
float douseTime = ArsonistDouseTime.GetFloat();
|
||||
killer.SetKillCooldown(Mathf.Approximately(douseTime, 0f) ? ArsonistCooldown.GetFloat() : douseTime);
|
||||
|
||||
if (!IsDoused[(killer.PlayerId, target.PlayerId)] && !ArsonistTimer.ContainsKey(killer.PlayerId))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user