Skip to content

Commit

Permalink
Show/Remove ImportantTaskText in freeplay
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardel-DW committed Jun 28, 2021
1 parent b9b7d6d commit b4c7610
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Harion/CustomRoles/FreeplayTaskTester/FileRole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ private static void Start(TaskAddButton taskFolder, RoleManager role) {
private static void OnClick(TaskAddButton taskFolder, RoleManager role) {
GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data;
if (role.HasRole(data.Object)) {
role.RpcRemovePlayer(data.Object);
taskFolder.Overlay.enabled = false;

if (data.IsImpostor) {
PlayerControl.LocalPlayer.RemoveInfected();
}

role.RpcRemovePlayer(data.Object);
taskFolder.Overlay.enabled = false;
} else {
if (RoleManager.HasMainRole(data.Object)) {
RoleManager Role = RoleManager.GetMainRole(data.Object);
Expand Down
7 changes: 6 additions & 1 deletion Harion/CustomRoles/RoleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ private void AddPlayer(byte PlayerId) {
if (Player != null) {
RoleManager MainRole = GetMainRole(Player);

if (MainRole == null || !IsMainRole)
if (MainRole == null || !IsMainRole) {
AllPlayers.Add(Player);
AddImportantTasks(Player);
}
}

DefineVisibleByWhitelist();
Expand Down Expand Up @@ -185,6 +187,9 @@ public void RpcAddPlayerRange(List<byte> PlayerIds) {

// Remove method
private void RemovePlayer(byte PlayerId) {
if (PlayerId == PlayerControl.LocalPlayer.PlayerId)
RemoveImportantTasks(PlayerControl.LocalPlayer);

AllPlayers.RemovePlayer(PlayerId);
DefineVisibleByWhitelist();
}
Expand Down

0 comments on commit b4c7610

Please sign in to comment.