some fixes & improvements

This commit is contained in:
Gurge44 committed 2025-11-04 11:44:23 +01:00
1 parent 3171969b83
commit c83de1e5a5
8 files changed
+22 -34

No files matched your search

+3 -1
View File
@@ -49,6 +49,8 @@ public static class AntiBlackout
dummyImp.RpcSetRoleGlobal(RoleTypes.Impostor);
players.Without(dummyImp).Where(x => x.GetRoleMap().RoleType != RoleTypes.Detective).Do(x => x.RpcSetRoleGlobal(RoleTypes.Crewmate));
Main.AllPlayerControls.DoIf(x => !x.IsAlive() && x.Data != null && x.Data.IsDead, x => x.RpcSetRoleGlobal(x.HasGhostRole() ? RoleTypes.GuardianAngel : RoleTypes.CrewmateGhost));
}
// After the ejection screen, we revert the role types to their actual values.
@@ -89,7 +91,7 @@ public static class AntiBlackout
if (seer == null || target == null) continue;
if (target.IsAlive()) target.RpcSetRoleDesync(roleType, seer.OwnerId);
else target.RpcSetRoleDesync(target.HasGhostRole() ? RoleTypes.GuardianAngel : roleType is RoleTypes.Impostor or RoleTypes.Shapeshifter or RoleTypes.Phantom ? RoleTypes.ImpostorGhost : RoleTypes.CrewmateGhost, seer.OwnerId);
else target.RpcSetRoleDesync(target.HasGhostRole() ? RoleTypes.GuardianAngel : seer.PlayerId == target.PlayerId && target.Is(CustomRoleTypes.Impostor) ? RoleTypes.ImpostorGhost : RoleTypes.CrewmateGhost, seer.OwnerId);
}
catch (Exception e) { Utils.ThrowException(e); }
}
+1
View File
@@ -72,6 +72,7 @@ public class PlayerState(byte playerId)
DidntVote,
SkippedVote,
Deafened,
Patrolled,
// Natural Disasters
Meteor,
+1 -2
View File
@@ -77,8 +77,7 @@ internal static class ExternalRpcPetPatch
&& !physics.Animations.IsPlayingClimbAnimation()
&& !physics.Animations.IsPlayingAnyLadderAnimation()
&& !Pelican.IsEaten(pc.PlayerId)
&& GameStates.IsInTask
&& pc.GetCustomRole().PetActivatedAbility())
&& GameStates.IsInTask)
{
CancelPet();
LateTask.New(CancelPet, 0.4f, log: false);
+3 -29
View File
@@ -2329,38 +2329,12 @@ internal static class PlayerControlSetRolePatch
if (roleType is RoleTypes.CrewmateGhost or RoleTypes.ImpostorGhost)
{
bool targetIsKiller = __instance.Is(CustomRoleTypes.Impostor) || __instance.HasDesyncRole();
Dictionary<PlayerControl, RoleTypes> ghostRoles = new();
foreach (PlayerControl seer in Main.AllPlayerControls)
{
bool self = seer.PlayerId == __instance.PlayerId;
bool seerIsKiller = seer.Is(CustomRoleTypes.Impostor) || seer.HasDesyncRole();
if (__instance.HasGhostRole() || GhostRolesManager.ShouldHaveGhostRole(__instance))
ghostRoles[seer] = RoleTypes.GuardianAngel;
else if ((self && targetIsKiller) || (!seerIsKiller && __instance.Is(CustomRoleTypes.Impostor)))
ghostRoles[seer] = RoleTypes.ImpostorGhost;
else
ghostRoles[seer] = RoleTypes.CrewmateGhost;
}
if (__instance.HasGhostRole() || GhostRolesManager.ShouldHaveGhostRole(__instance))
roleType = RoleTypes.GuardianAngel;
else if (ghostRoles.All(kvp => kvp.Value == RoleTypes.CrewmateGhost))
roleType = RoleTypes.CrewmateGhost;
else if (ghostRoles.All(kvp => kvp.Value == RoleTypes.ImpostorGhost))
roleType = RoleTypes.ImpostorGhost;
else if (__instance.Is(CustomRoleTypes.Impostor))
roleType = RoleTypes.Impostor;
else
{
foreach ((PlayerControl seer, RoleTypes role) in ghostRoles)
{
Logger.Info($"Desync {targetName} => {role} for {seer.GetNameWithRole().RemoveHtmlTags()}", "PlayerControl.RpcSetRole");
__instance.RpcSetRoleDesync(role, seer.OwnerId);
}
return false;
}
roleType = RoleTypes.CrewmateGhost;
}
return true;
+4
View File
@@ -446,6 +446,10 @@ public static class SabotageSystemTypeRepairDamagePatch
}
}
if (Stasis.IsTimeFrozen) return false;
if (Pelican.IsEaten(player.PlayerId)) return false;
if (__instance != null && systemTypes == SystemTypes.Electrical && Main.PlayerStates.Values.FindFirst(x => !x.IsDead && x.MainRole == CustomRoles.Battery && x.Player != null && x.Player.GetAbilityUseLimit() >= 1f, out var batteryState))
{
batteryState.Player.RpcRemoveAbilityUse();
+1
View File
@@ -1984,6 +1984,7 @@
"DeathReason.DidntVote": "Didn't Vote",
"DeathReason.SkippedVote": "Skipped Voting",
"DeathReason.Deafened": "Deafened",
"DeathReason.Patrolled": "Patrolled",
"ND_DRLaughMessage.Meteor": "Meteor.... I hardly knew her!",
"ND_DRLaughMessage.Lava": "Lava is not the best place to swim, huh?",
"ND_DRLaughMessage.Tornado": "Out for a spin? I hope this tornado didn't make you dizzy!",
+1 -1
View File
@@ -86,7 +86,7 @@ public class PatrollingState(byte sentinelId, int patrolDuration, float patrolRa
if (!GameStates.IsInTask) return;
foreach (PlayerControl pc in NearbyKillers)
pc.Suicide(realKiller: Sentinel);
pc.Suicide(PlayerState.DeathReason.Patrolled, Sentinel);
Sentinel.MarkDirtySettings();
}
+8 -1
View File
@@ -16,6 +16,7 @@ public class Stasis : RoleBase
private static OptionItem AffectsOtherImpostors;
private static OptionItem CanVent;
private static OptionItem KillCooldown;
private static OptionItem CanSabotage;
private bool UsingAbility;
@@ -30,7 +31,8 @@ public class Stasis : RoleBase
.AutoSetupOption(ref AbilityDuration, 10, new IntegerValueRule(1, 60, 1), OptionFormat.Seconds)
.AutoSetupOption(ref AffectsOtherImpostors, true)
.AutoSetupOption(ref CanVent, false)
.AutoSetupOption(ref KillCooldown, 30f, new FloatValueRule(0f, 180f, 1f), OptionFormat.Seconds);
.AutoSetupOption(ref KillCooldown, 30f, new FloatValueRule(0f, 180f, 1f), OptionFormat.Seconds)
.AutoSetupOption(ref CanSabotage, false);
}
public override void Init()
@@ -61,6 +63,11 @@ public class Stasis : RoleBase
Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
}
public override bool CanUseSabotage(PlayerControl pc)
{
return CanSabotage.GetBool();
}
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
{
if (Options.UsePhantomBasis.GetBool())