aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

This commit is contained in:
Gurge44 committed 2024-10-05 20:28:53 +02:00
1 parent af9935dbe5
commit 60173ee3db
7 files changed
+39 -23

No files matched your search

+6 -1
View File
@@ -136,7 +136,7 @@ namespace EHR
DisplayRoomName = new BooleanOptionItem(id++, "RR_DisplayRoomName", true, TabGroup.GameSettings)
.SetColor(color)
.SetGameMode(gameMode);
DisplayArrowToRoom = new BooleanOptionItem(id, "RR_DisplayArrowToRoom", false, TabGroup.GameSettings)
.SetColor(color)
.SetGameMode(gameMode);
@@ -375,6 +375,11 @@ namespace EHR
RoomRush.VentLimit[pc.PlayerId]--;
}
public override bool CanUseImpostorVentButton(PlayerControl pc)
{
return !pc.IsHost() && CanUseVent(pc, 0);
}
public override bool CanUseVent(PlayerControl pc, int ventId) => RoomRush.GameGoing && (pc.inVent || RoomRush.VentLimit[pc.PlayerId] > 0);
}
}
+6
View File
@@ -833,6 +833,12 @@ internal static class CustomRolesHelper
CustomRoles.Simon or
CustomRoles.Patroller;
public static bool BlocksVentMovement(this CustomRoles role) => role switch
{
CustomRoles.Jester => Jester.BlockVentMovement.GetBool(),
_ => false
};
public static bool CheckAddonConflict(CustomRoles role, PlayerControl pc) => role.IsAdditionRole() && (!Main.NeverSpawnTogetherCombos.TryGetValue(OptionItem.CurrentPreset, out var neverList) || !neverList.TryGetValue(pc.GetCustomRole(), out var bannedAddonList) || !bannedAddonList.Contains(role)) && pc.GetCustomRole() is not CustomRoles.GuardianAngelEHR and not CustomRoles.God && !pc.Is(CustomRoles.Madmate) && !pc.Is(CustomRoles.GM) && role is not CustomRoles.Lovers && !pc.Is(CustomRoles.Needy) && (!pc.HasSubRole() || pc.GetCustomSubRoles().Count < Options.NoLimitAddonsNumMax.GetInt()) && (!Options.AddonCanBeSettings.TryGetValue(role, out var o) || ((o.Imp.GetBool() || !pc.GetCustomRole().IsImpostor()) && (o.Neutral.GetBool() || !pc.GetCustomRole().IsNeutral()) && (o.Crew.GetBool() || !pc.IsCrewmate()))) && (!role.IsImpOnlyAddon() || pc.IsImpostor()) && role switch
{
CustomRoles.Circumvent when pc.GetCustomRole() is CustomRoles.Swooper or CustomRoles.RiftMaker => false,
+2 -2
View File
@@ -67,7 +67,7 @@ static class ExtendedPlayerControl
public static bool CanUseVent(this PlayerControl player, int ventId)
{
return GameStates.IsInTask && (player.inVent || (player.CanUseImpostorVentButton() || player.GetRoleTypes() == RoleTypes.Engineer) && Main.PlayerStates.Values.All(x => x.Role.CanUseVent(player, ventId)));
return GameStates.IsInTask && ((player.inVent && !player.GetCustomRole().BlocksVentMovement()) || (player.CanUseImpostorVentButton() || player.GetRoleTypes() == RoleTypes.Engineer) && Main.PlayerStates.Values.All(x => x.Role.CanUseVent(player, ventId)));
}
// Next 3: https://github.com/Rabek009/MoreGamemodes/blob/master/Modules/ExtendedPlayerControl.cs
@@ -1481,7 +1481,7 @@ static class ExtendedPlayerControl
public static RoleTypes GetRoleTypes(this PlayerControl pc) => pc.GetCustomSubRoles() switch
{
{ } x when x.Contains(CustomRoles.Bloodlust) => RoleTypes.Impostor,
{ } x when x.Contains(CustomRoles.Nimble) => RoleTypes.Engineer,
{ } x when x.Contains(CustomRoles.Nimble) && !pc.HasDesyncRole() => RoleTypes.Engineer,
{ } x when x.Contains(CustomRoles.Physicist) => RoleTypes.Scientist,
{ } x when x.Contains(CustomRoles.Finder) => RoleTypes.Tracker,
{ } x when x.Contains(CustomRoles.Noisy) => RoleTypes.Noisemaker,
@@ -174,6 +174,10 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
SetMaxVision();
NaturalDisasters.ApplyGameOptions(opt, player.PlayerId);
break;
case CustomGameMode.RoomRush when RoomRush.VentLimit[player.PlayerId] > 0:
AURoleOptions.EngineerCooldown = 0.01f;
AURoleOptions.EngineerInVentMaxTime = 0f;
goto case CustomGameMode.RoomRush;
case CustomGameMode.RoomRush:
case CustomGameMode.Speedrun:
case CustomGameMode.HotPotato:
@@ -192,8 +196,6 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
AURoleOptions.GuardianAngelCooldown = Spiritcaller.SpiritAbilityCooldown.GetFloat();
break;
case CustomRoleTypes.Neutral:
AURoleOptions.GuardianAngelCooldown = Spiritcaller.SpiritAbilityCooldown.GetFloat();
break;
case CustomRoleTypes.Crewmate:
AURoleOptions.GuardianAngelCooldown = Spiritcaller.SpiritAbilityCooldown.GetFloat();
break;
+5 -10
View File
@@ -1902,11 +1902,10 @@ public static class Utils
public static void DoNotifyRoles(bool isForMeeting = false, PlayerControl SpecifySeer = null, PlayerControl SpecifyTarget = null, bool NoCache = false, bool ForceLoop = false, bool CamouflageIsForMeeting = false, bool GuesserIsForMeeting = false, bool MushroomMixup = false)
{
PlayerControl[] seerList = SpecifySeer != null ? [SpecifySeer] : Main.AllPlayerControls;
PlayerControl[] targetList = SpecifyTarget != null ? [SpecifyTarget] : Main.AllPlayerControls;
var apc = Main.AllPlayerControls;
StringBuilder seerLogInfo = new();
StringBuilder targetLogInfo = new();
PlayerControl[] seerList = SpecifySeer != null ? [SpecifySeer] : apc;
PlayerControl[] targetList = SpecifyTarget != null ? [SpecifyTarget] : apc;
var now = TimeStamp;
@@ -1918,8 +1917,6 @@ public static class Utils
{
if (seer == null || seer.Data.Disconnected || (seer.IsModClient() && (seer.IsHost() || Options.CurrentGameMode == CustomGameMode.Standard))) continue;
seerLogInfo.Append($"{seer.GetRealName()}, ");
// During intro scene, set team name for non-modded clients and skip the rest.
string SelfName;
Team seerTeam = seer.GetTeam();
@@ -2155,8 +2152,6 @@ public static class Utils
{
if (target.PlayerId == seer.PlayerId) continue;
targetLogInfo.Append($"{target.GetRealName()}, ");
if (target.Is(CustomRoles.Car))
{
target.RpcSetNamePrivate(Car.Name, seer, force: NoCache);
@@ -2415,8 +2410,8 @@ public static class Utils
if (Options.CurrentGameMode != CustomGameMode.Standard) return;
string seers = seerLogInfo.ToString().TrimEnd(',', ' ');
string targets = targetLogInfo.ToString().TrimEnd(',', ' ');
string seers = seerList.Length == apc.Length ? "Everyone" : string.Join(", ", seerList.Select(x => x.GetRealName()));
string targets = targetList.Length == apc.Length ? "Everyone" : string.Join(", ", targetList.Select(x => x.GetRealName()));
if (seers.Length == 0) seers = "\u2205";
if (targets.Length == 0) targets = "\u2205";
Logger.Info($" Seers: {seers} ---- Targets: {targets}", "NR");
+4 -3
View File
@@ -1951,11 +1951,10 @@ static class CoEnterVentPatch
switch (Options.CurrentGameMode)
{
case CustomGameMode.FFA when FFAManager.FFADisableVentingWhenTwoPlayersAlive.GetBool() && Main.AllAlivePlayerControls.Length <= 2:
var pc = __instance.myPlayer;
LateTask.New(() =>
{
pc?.Notify(GetString("FFA-NoVentingBecauseTwoPlayers"), 7f);
pc?.MyPhysics?.RpcBootFromVent(id);
__instance.myPlayer?.Notify(GetString("FFA-NoVentingBecauseTwoPlayers"), 7f);
__instance.RpcBootFromVent(id);
}, 0.5f, "FFA-NoVentingWhenTwoPlayersAlive");
return true;
case CustomGameMode.FFA when FFAManager.FFADisableVentingWhenKcdIsUp.GetBool() && Main.KillTimers[__instance.myPlayer.PlayerId] <= 0:
@@ -1975,6 +1974,8 @@ static class CoEnterVentPatch
case CustomGameMode.HideAndSeek:
HnSManager.OnCoEnterVent(__instance, id);
break;
case CustomGameMode.RoomRush:
return true;
}
if (__instance.myPlayer.IsRoleBlocked())
+12 -5
View File
@@ -462,7 +462,7 @@ static class VentilationSystemDeterioratePatch
public static Dictionary<byte, int> LastClosestVent = [];
private static readonly Dictionary<byte, bool> LastCanUseVent = [];
private static readonly Dictionary<byte, int> LastClosestVentForUpdate = [];
private static readonly Dictionary<byte, long> LastVentInteractionCheck = [];
private static readonly Dictionary<byte, int> CheckBufferTime = [];
public static void Postfix(VentilationSystem __instance)
{
@@ -608,14 +608,21 @@ static class VentilationSystemDeterioratePatch
{
if (!GameStates.IsInTask || ExileController.Instance) return;
if (!LastVentInteractionCheck.TryGetValue(pc.PlayerId, out long lastCheck))
const int bufferTimeWait = 10;
if (!CheckBufferTime.TryGetValue(pc.PlayerId, out int bufferTime))
{
LastVentInteractionCheck[pc.PlayerId] = Utils.TimeStamp;
CheckBufferTime[pc.PlayerId] = bufferTimeWait;
return;
}
if (Utils.TimeStamp == lastCheck) return;
LastVentInteractionCheck[pc.PlayerId] = Utils.TimeStamp;
if (bufferTime > 0)
{
CheckBufferTime[pc.PlayerId]--;
return;
}
CheckBufferTime[pc.PlayerId] = bufferTimeWait;
int closestVent = pc.GetClosestVent().Id;