Skip to content

Commit 4b6a7d8

Browse files
committed
Probably fixed the Revenant issues
1 parent f419b50 commit 4b6a7d8

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

NewMod/Buttons/Revenant/DoomAwakening.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class DoomAwakening : CustomActionButton
6060
/// <returns>True if the role is <see cref="RV"/>, otherwise false.</returns>
6161
public override bool Enabled(RoleBehaviour role)
6262
{
63-
return role is RV;
63+
return role is RV && RV.StalkingStates.ContainsKey(PlayerControl.LocalPlayer.PlayerId);
6464
}
6565

6666
/// <summary>

NewMod/Roles/ImpostorRoles/Revenant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class Revenant : ImpostorRole, ICustomRole
2828
DefaultChance = 50,
2929
DefaultRoleCount = 1,
3030
CanModifyChance = true,
31-
GhostRole = AmongUs.GameOptions.RoleTypes.Crewmate, //Indeed
31+
GhostRole = (AmongUs.GameOptions.RoleTypes)RoleId.Get<Revenant>(),
3232
RoleHintType = RoleHintType.RoleTab
3333
};
3434
public static Dictionary<byte, FeignDeathInfo> FeignDeathStates = new Dictionary<byte, FeignDeathInfo>();

NewMod/Utilities/Utils.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,8 @@ public static IEnumerator StartFeignDeath(PlayerControl player)
815815
{
816816
var clip = NewModAsset.FeignDeathSound.LoadAsset();
817817

818+
SavePlayerRole(player.PlayerId, player.Data.Role);
819+
818820
player.RpcCustomMurder(player,
819821
didSucceed: true,
820822
resetKillTimer: false,
@@ -853,16 +855,21 @@ public static IEnumerator StartFeignDeath(PlayerControl player)
853855
if (info.Reported)
854856
{
855857
yield return CoroutinesHelper.CoNotify("<color=red>Your feign death has been reported. You remain dead.</color>");
858+
Revenant.FeignDeathStates.Remove(player.PlayerId);
856859
SoundManager.Instance.StopSound(clip);
857860
yield break;
858861
}
859862
}
860-
HandleRevive(player, player.PlayerId, (RoleTypes)RoleId.Get<Revenant>(), body.transform.position.x, body.transform.position.y);
863+
Revenant.HasUsedFeignDeath = true;
864+
Revenant.StalkingStates[player.PlayerId] = true;
865+
866+
var roleHistory = GetPlayerRolesHistory(player.PlayerId);
867+
var roleToRestore = roleHistory.Count > 0 ? roleHistory[^1].Role : (RoleTypes)RoleId.Get<Revenant>();
868+
869+
HandleRevive(player, player.PlayerId, roleToRestore, body.transform.position.x, body.transform.position.y);
861870
yield return new WaitForSeconds(0.2f);
862871
player.RpcShapeshift(GetRandomPlayer(p => !p.Data.IsDead && !p.Data.Disconnected), false);
863872
Coroutines.Start(CoroutinesHelper.CoNotify("<color=green>You have been revived in a new body!</color>"));
864-
Revenant.HasUsedFeignDeath = true;
865-
Revenant.StalkingStates[player.PlayerId] = true;
866873
Revenant.FeignDeathStates.Remove(player.PlayerId);
867874

868875
if (player.AmOwner)

0 commit comments

Comments
 (0)