mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
use role data
This commit is contained in:
1 parent
4c581c7abb
commit
46389d30c4
5 files changed
+7
-8
No files matched your search
@@ -163,7 +163,7 @@ static class ExtendedPlayerControl
|
||||
// Check if player role name
|
||||
public static string GetRoleName(this PlayerControl player)
|
||||
{
|
||||
if (!player.IsAlive() && !player.IsGhostRole() && Main.GetRoleName.TryGetValue((int)player.BetterData().DeadDisplayRole, out var roleName))
|
||||
if (!player.IsAlive() && !player.IsGhostRole() && Main.GetRoleName.TryGetValue((int)player.BetterData().RoleInfo.DeadDisplayRole, out var roleName))
|
||||
{
|
||||
return roleName;
|
||||
}
|
||||
|
||||
@@ -12,18 +12,17 @@ public class ExtendedPlayerInfo
|
||||
public bool BannedByAntiCheat { get; set; } = false;
|
||||
|
||||
// Track Game Info
|
||||
|
||||
public bool HasNoisemakerNotify { get; set; } = false;
|
||||
public float TimeSinceLastTask { get; set; } = 5f;
|
||||
public uint LastTaskId { get; set; } = 0;
|
||||
public int TimesCalledMeeting { get; set; } = 0;
|
||||
public RoleTypes DeadDisplayRole { get; set; }
|
||||
public ExtendedRoleInfo? RoleInfo { get; set; }
|
||||
}
|
||||
|
||||
public class ExtendedRoleInfo
|
||||
{
|
||||
public int Kills { get; set; } = 0;
|
||||
public bool HasNoisemakerNotify { get; set; } = false;
|
||||
public RoleTypes DeadDisplayRole { get; set; }
|
||||
}
|
||||
|
||||
public static class PlayerControlExtensions
|
||||
|
||||
@@ -71,7 +71,7 @@ class PlayerControlPatch
|
||||
if (!GameStates.IsInGamePlay)
|
||||
{
|
||||
__instance.BetterData().TimesCalledMeeting = 0;
|
||||
__instance.BetterData().HasNoisemakerNotify = false;
|
||||
__instance.BetterData().RoleInfo.HasNoisemakerNotify = false;
|
||||
__instance.BetterData().TimeSinceLastTask = 5f;
|
||||
__instance.BetterData().LastTaskId = 999;
|
||||
__instance.BetterData().RoleInfo.Kills = 0;
|
||||
|
||||
@@ -254,7 +254,7 @@ public class RoleManagerPatch
|
||||
public static bool AssignRoleOnDeath_Prefix(/*RoleManager __instance*/ [HarmonyArgument(0)] PlayerControl player)
|
||||
{
|
||||
if (player.Data.RoleType != RoleTypes.CrewmateGhost && player.Data.RoleType != RoleTypes.ImpostorGhost)
|
||||
player.BetterData().DeadDisplayRole = player.Data.RoleType;
|
||||
player.BetterData().RoleInfo.DeadDisplayRole = player.Data.RoleType;
|
||||
|
||||
if (!Main.BetterRoleAlgorithma.Value) return true;
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ class RolePatch
|
||||
[HarmonyPrefix]
|
||||
public static bool NotifyOfDeath_Prefix(NoisemakerRole __instance)
|
||||
{
|
||||
if (__instance.Player.BetterData().HasNoisemakerNotify)
|
||||
if (__instance.Player.BetterData().RoleInfo.HasNoisemakerNotify)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
__instance.Player.BetterData().HasNoisemakerNotify = true;
|
||||
__instance.Player.BetterData().RoleInfo.HasNoisemakerNotify = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user