Skip to main content

CCitadelPlayerController

Deadlock-specific player controller. Provides access to player data, hero selection, team changes, and console messaging.

public sealed class CCitadelPlayerController : CBasePlayerController

Namespace: DeadworksManaged.Api
Inherits / implements: CBasePlayerController
Source: Entities/CCitadelPlayerController.cs#L7

Properties​

CCitadelPlayerController.PlayerDataGlobal​

Signature

public PlayerDataGlobal PlayerDataGlobal { get; }

Source: Entities/CCitadelPlayerController.cs#L11

CCitadelPlayerController.AssignedLane​

Which lane's zipline this player rides if the match starts with the zipline launch. Setting it doesn't cause a launch, it only picks the lane. LaneColor.Invalid, the default, leaves the choice to the game. Not every map has every lane; dl_midtown has Yellow, Blue and Purple.

Signature

public LaneColor AssignedLane { get; set; }

Source: Entities/CCitadelPlayerController.cs#L19

CCitadelPlayerController.OriginalLaneAssignment​

The lane this player was first assigned, before any lane swap.

Signature

public LaneColor OriginalLaneAssignment { get; set; }

Source: Entities/CCitadelPlayerController.cs#L23

CCitadelPlayerController.Camera​

Moves this player's camera without moving their hero: pull it back, zoom, point it somewhere else and hold it there. See PlayerCamera.

Signature

public PlayerCamera Camera { get; }

Source: Entities/CCitadelPlayerController.cs#L129

Methods​

CCitadelPlayerController.GetHeroPawn()​

Returns the player's current hero pawn, or null if they have none.

Signature

public CCitadelPlayerPawn? GetHeroPawn()

Source: Entities/CCitadelPlayerController.cs#L29

CCitadelPlayerController.TakeOverHero()​

Gives this player from's hero, as it is: level, souls, items, health and position carry over, along with its team and lane. Use it to hand a leaver's hero to someone else. This player's old pawn (usually a spectator's) is removed, and from is left without one.

Signature

public bool TakeOverHero(CCitadelPlayerController from)

Returns False if from has no hero.

Source: Entities/CCitadelPlayerController.cs#L42

CCitadelPlayerController.ChangeTeam()​

Moves this player to the specified team, keeping the pawn's hero, abilities and items. Pass keepHero false for the server's own behaviour, which destroys all three on a real team change and leaves the pawn alive but inert.

Signature

public void ChangeTeam(int teamNum, bool keepHero = true)

Source: Entities/CCitadelPlayerController.cs#L68

CCitadelPlayerController.RemoveWithPawns()​

Removes this player from the game completely: their hero, any other pawn they control (such as a spectator's observer pawn), and this controller, together in the same tick.

By default a player who leaves keeps their controller and hero, so they can reconnect to them, and their portrait stays in the top bar. Call this from IDeadworksPlugin.OnClientDisconnect to drop them instead. Don't remove the hero or the controller on its own: either one left behind crashes clients or the server. To remove a player who is still connected, CBasePlayerController.Kick them.

Signature

public void RemoveWithPawns()

Source: Entities/CCitadelPlayerController.cs#L81

CCitadelPlayerController.MakeObserver()​

Forcibly removes the player's current pawn, spawns an observer pawn, and attaches it.

Signature

public void MakeObserver()

Source: Entities/CCitadelPlayerController.cs#L93

CCitadelPlayerController.SelectHero()​

Forces the player to select the specified hero.

Signature

public void SelectHero(Heroes hero)

Source: Entities/CCitadelPlayerController.cs#L104

CCitadelPlayerController.PrintToConsole()​

Sends a message to this player's console via "echo" client command.

Signature

public void PrintToConsole(string message)

Source: Entities/CCitadelPlayerController.cs#L113

CCitadelPlayerController.HudAnnounce()​

Displays a HUD game announcement banner to this player with the given title and description.

Signature

public void HudAnnounce(string title = "", string description = "")

Source: Entities/CCitadelPlayerController.cs#L118

CCitadelPlayerController.SetCameraAngles()​

Turns this player's camera to face angles (pitch, yaw, roll in degrees).

Signature

public void SetCameraAngles(Vector3 angles)
public void SetCameraAngles(float pitch, float yaw, float roll = 0f)

Notes CBaseEntity.Teleport can't turn a player's camera (its angles are ignored for players), so call this after moving someone to control which way they end up facing, or use CCitadelPlayerPawn.TeleportWithView to do both at once. To restore a view you saved earlier, save CCitadelPlayerPawn.CameraAngles. CCitadelPlayerPawn.EyeAngles is where the crosshair aims, which can be far off from where the camera points.

Source: Entities/CCitadelPlayerController.cs#L141, Entities/CCitadelPlayerController.cs#L149

CCitadelPlayerController.PrintToConsoleAll()​

Sends a message to all connected players' consoles.

Signature

public static void PrintToConsoleAll(string message)

Source: Entities/CCitadelPlayerController.cs#L152