SetClass

Raise

This Event is raised when a Player's Role Type is set.

Exceptions: SCP049 revives a Player, Player activated overwatch and Role Type changes to Spectator

Usage

You can use this Event to change the Spawn behavior of a Role

When you change the RoleType won't the other Attributes change as well so the Player will still get the items/ spawn position of the first selected role.

SetClassEvent

EventArgsTypeDescription

Player

SynapsePlayer

The Player whose role is being changed

Allow

bool

If the Server is allowed to change the RoleType

Role

RoleType

The RoleType that the Player will become

SpawnReason

SpawnReason

The Reason because of which the Player Role is changed

Items

List<uint>

The Items which will be given to the Player after his role changed

EscapeItems

List<SynapseItem>

The Items which the Player had before his role changed when he is trying to escape

Position

Vector3

The Position where the Player will spawn

Rotation

PlayerRotation

The Rotation which the Player will be set after set to the new Role

Ammo

Dictionary<AmmoType, ushort>

The Ammo the player will get after his role was changed

public class SetClassEvent : PlayerInteractEvent
{
    public SetClassEvent(SynapsePlayer player, RoleType role, CharacterClassManager.SpawnReason reason) : base(player,
        true)
    {
        Role = role;
        SpawnReason = reason;
    }
    
    public RoleType Role { get; set; }
    
    public CharacterClassManager.SpawnReason SpawnReason { get; }

    public List<uint> Items { get; set; } = new();

    public List<SynapseItem> EscapeItems { get; set; } = new();
    
    public Vector3 Position { get; set; } = Vector3.zero;

    public PlayerMovementSync.PlayerRotation Rotation { get; set; }

    public Dictionary<AmmoType, ushort> Ammo { get; set; } = new();
}

Last updated