Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ public Role Role
get => role ??= Role.Create(RoleManager.CurrentRole);
internal set
{
PreviousRole = role.Type;
PreviousRole = role?.Type ?? RoleTypeId.None;
role = value;
}
}
Expand Down
36 changes: 36 additions & 0 deletions EXILED/Exiled.API/Features/Roles/DestroyedRole.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// -----------------------------------------------------------------------
// <copyright file="DestroyedRole.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Features.Roles
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using PlayerRoles;
using PlayerRoles.Voice;

/// <summary>
/// Defines a role that represents players with destroyed role.
/// </summary>
internal class DestroyedRole : Role
{
/// <summary>
/// Initializes a new instance of the <see cref="DestroyedRole"/> class.
/// </summary>
/// <param name="baseRole">the base <see cref="DestroyedRole"/>.</param>
internal DestroyedRole(PlayerRoleBase baseRole)
: base(baseRole)
{
}

/// <inheritdoc/>
public override RoleTypeId Type { get; } = RoleTypeId.Destroyed;
}
}
2 changes: 2 additions & 0 deletions EXILED/Exiled.API/Features/Roles/Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Exiled.API.Features.Roles
using PlayerRoles.PlayableScps.Scp049.Zombies;
using UnityEngine;

using DestroyedGameRole = PlayerRoles.DestroyedRole;
using FilmmakerGameRole = PlayerRoles.Filmmaker.FilmmakerRole;
using HumanGameRole = PlayerRoles.HumanRole;
using NoneGameRole = PlayerRoles.NoneRole;
Expand Down Expand Up @@ -228,6 +229,7 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s
HumanGameRole humanRole => new HumanRole(humanRole),
FilmmakerGameRole filmmakerRole => new FilmMakerRole(filmmakerRole),
NoneGameRole noneRole => new NoneRole(noneRole),
DestroyedGameRole destroyedRole => new DestroyedRole(destroyedRole),
_ => null,
};
}
Expand Down