Table of Contents

Class TwoSidedTeamManager

Namespace
Uncreated.Warfare.Layouts.Teams
Assembly
Uncreated.Warfare.dll

Supports exactly 2 teams, with an optional 'attacker' and 'defender'.

public class TwoSidedTeamManager : ITeamManager<Team>
Inheritance
TwoSidedTeamManager
Implements
Inherited Members

Constructors

TwoSidedTeamManager(ILogger<TwoSidedTeamManager>, PointsService, IServiceProvider)

public TwoSidedTeamManager(ILogger<TwoSidedTeamManager> logger, PointsService points, IServiceProvider serviceProvider)

Parameters

logger ILogger<TwoSidedTeamManager>
points PointsService
serviceProvider IServiceProvider

Properties

AdminGroupId

The group admins can join when placing buildables or doing other duties where they shouldn't be in a group.

public CSteamID AdminGroupId { get; }

Property Value

CSteamID

AllTeams

List of all teams currently active.

public IReadOnlyList<Team> AllTeams { get; }

Property Value

IReadOnlyList<Team>

Blufor

The 'good guys' who are spreading their influence forcibly.

public Team Blufor { get; }

Property Value

Team

Exceptions

InvalidOperationException

There is no Blufor team.

Configuration

Team manager extra configuration from config file.

public IConfiguration? Configuration { get; set; }

Property Value

IConfiguration

HasBothTeams

If both Blufor and Opfor teams are specified.

public bool HasBothTeams { get; }

Property Value

bool

Opfor

The 'bad guys' who are defending something against the interests of the other team.

public Team Opfor { get; }

Property Value

Team

Exceptions

InvalidOperationException

There is no Opfor team.

SpawnAtWarRoom

Whether or not players should spawn at the war room over the main base.

public bool SpawnAtWarRoom { get; set; }

Property Value

bool

Teams

Info about all teams, binded from configuration.

public IReadOnlyList<TwoSidedTeamInfo>? Teams { get; set; }

Property Value

IReadOnlyList<TwoSidedTeamInfo>

Methods

BeginAsync(CancellationToken)

Activates the team manager. This happens just before the first phase is activated.

public UniTask BeginAsync(CancellationToken token = default)

Parameters

token CancellationToken

Returns

UniTask

EndAsync(CancellationToken)

Deactivates the team manager.

public UniTask EndAsync(CancellationToken token = default)

Parameters

token CancellationToken

Returns

UniTask

FindTeam(string?)

Find a team from a string value, such as from config.

public Team? FindTeam(string? teamSearch)

Parameters

teamSearch string

Can be (in order of priority) A faction name, a team ID, 'blufor', or 'opfor'.

Returns

Team

GetLayoutRole(Team)

Gets the role of the team in the current layout.

public LayoutRole GetLayoutRole(Team team)

Parameters

team Team

Returns

LayoutRole

GetSpawnPointWhenRespawningAtMain(IPlayer, Team, ZoneStore)

Gets the desired spawn point when a player needs to respawn at main base.

public virtual Vector4? GetSpawnPointWhenRespawningAtMain(IPlayer player, Team team, ZoneStore globalZoneStore)

Parameters

player IPlayer
team Team
globalZoneStore ZoneStore

Returns

Vector4?

The spawn position as a UnityEngine.Vector4, where UnityEngine.Vector4.w is yaw rotation.

Remarks

The player may not have joined the server yet.

GetTeam(CSteamID)

Will return the default team if groupId doesn't correspond to a team, otherwise the "no team" default.

public Team GetTeam(CSteamID groupId)

Parameters

groupId CSteamID

Returns

Team

InitializeAsync(CancellationToken)

Used to initialize team info from the layout and map configuration.

public virtual UniTask InitializeAsync(CancellationToken token = default)

Parameters

token CancellationToken

Returns

UniTask

JoinTeamAsync(WarfarePlayer, Team, bool, CancellationToken)

Joins a player into a team if they're not already.

public UniTask JoinTeamAsync(WarfarePlayer player, Team team, bool wasByAdminCommand, CancellationToken token = default)

Parameters

player WarfarePlayer
team Team
wasByAdminCommand bool
token CancellationToken

Returns

UniTask