Skip to content
EvilEngine.Api

PlayerId record struct

public readonly record struct PlayerId

One player in a session, as the host knows them for as long as they’re connected. A Plugin gets one from the API that hands out players and passes it back to name that player, as ICrosshairs.Of takes one.

Two ids are the same player only while that player is connected. When they leave, their slot is free for the next to join, who gets a new Serial, so an id kept past a player leaving never reaches someone else.

Assembly
EvilEngine.Api
Commit
4ff877b1

Members

PlayerId constructor

public PlayerId(int Slot, int Serial)

Makes an id from a slot and a serial. A Plugin only needs this to keep an id somewhere and rebuild it.

Slot property

public int Slot { get; init; }

The player’s slot in the session, from 0 up to one less than its most players.

Serial property

public int Serial { get; init; }

How many times the slot has been taken, so a new player in an old slot is a new id.