Table of Contents

Class ZoneStore

Namespace
Uncreated.Warfare.Zones
Assembly
Uncreated.Warfare.dll

Stores a full list of active zones.

public class ZoneStore : IHostedService, IEarlyLevelHostedService, IDisposable
Inheritance
ZoneStore
Implements
Inherited Members
Extension Methods

Constructors

ZoneStore(IEnumerable<IZoneProvider>, IPlayerService, ILogger<ZoneStore>, bool, WarfareModule, EventDispatcher)

public ZoneStore(IEnumerable<IZoneProvider> zoneProviders, IPlayerService playerService, ILogger<ZoneStore> logger, bool isGlobal, WarfareModule warfare, EventDispatcher eventDispatcher)

Parameters

zoneProviders IEnumerable<IZoneProvider>
playerService IPlayerService
logger ILogger<ZoneStore>
isGlobal bool
warfare WarfareModule
eventDispatcher EventDispatcher

Properties

IsGlobal

If this instance of ZoneStore is the global instance, not the one created for flag layouts.

public bool IsGlobal { get; }

Property Value

bool

ProximityZones

All available zones (not just the ones in-game).

public IReadOnlyList<ZoneProximity>? ProximityZones { get; }

Property Value

IReadOnlyList<ZoneProximity>

Remarks

This is only available on the global ZoneStore.

Zones

All available zones (not just the ones in-game).

public IReadOnlyList<Zone> Zones { get; }

Property Value

IReadOnlyList<Zone>

Methods

CreateColliderForZone(Zone)

Creates a new IProximity depending on the type of zone defined.

public ITrackingProximity<WarfarePlayer> CreateColliderForZone(Zone zone)

Parameters

zone Zone

Returns

ITrackingProximity<WarfarePlayer>

The proximity, which has collision events.

Exceptions

ArgumentException

This zone doesn't have a valid shape or is missing the associated data object.

NotSupportedException

Not on main thread.

CreateProximityForZone(Zone)

Creates a new IProximity depending on the type of zone defined.

public IProximity CreateProximityForZone(Zone zone)

Parameters

zone Zone

Returns

IProximity

The proximity.

Exceptions

ArgumentException

This zone doesn't have a valid shape or is missing the associated data object.

NotSupportedException

Not on main thread.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

EarlyLoadLevelAsync(CancellationToken)

Executes just before the level starts loading and after all assets are loaded but before the first session starts.

public UniTask EarlyLoadLevelAsync(CancellationToken token)

Parameters

token CancellationToken

Returns

UniTask

EnumerateInsideZones(Vector2, ZoneType?)

Enumerate through all zones that point is inside.

public IEnumerable<Zone> EnumerateInsideZones(Vector2 point, ZoneType? type = null)

Parameters

point Vector2
type ZoneType?

Returns

IEnumerable<Zone>

EnumerateInsideZones(Vector3, ZoneType?)

Enumerate through all zones that point is inside.

public IEnumerable<Zone> EnumerateInsideZones(Vector3 point, ZoneType? type = null)

Parameters

point Vector3
type ZoneType?

Returns

IEnumerable<Zone>

FindClosestZone(Vector2, out float, ZoneType?)

Finds the closest zone to a point based on it's border. Zones with the point inside their borders will return the square distance from the border but negative.

public Zone? FindClosestZone(Vector2 point, out float sqrDistance, ZoneType? type = null)

Parameters

point Vector2
sqrDistance float
type ZoneType?

Returns

Zone

FindClosestZone(in Vector3, ZoneType?)

Finds the closest zone to a point based on it's border.

public Zone? FindClosestZone(in Vector3 point, ZoneType? type = null)

Parameters

point Vector3
type ZoneType?

Returns

Zone

FindClosestZone(in Vector3, out float, ZoneType?)

Finds the closest zone to a point based on it's border. Zones with the point inside their borders will return the square distance from the border but negative.

public Zone? FindClosestZone(in Vector3 point, out float sqrDistance, ZoneType? type = null)

Parameters

point Vector3
sqrDistance float
type ZoneType?

Returns

Zone

FindInsideZone(Vector2, bool)

Get a zone where the given point is inside it. Smaller area zones will be returned before larger ones.

public Zone? FindInsideZone(Vector2 pos, bool noOverlap)

Parameters

pos Vector2

The position to search for.

noOverlap bool

If null should be returned if more than one zone match.

Returns

Zone

FindInsideZone(Vector3, bool)

Get a zone where the given point is inside it. Smaller area zones will be returned before larger ones.

public Zone? FindInsideZone(Vector3 pos, bool noOverlap)

Parameters

pos Vector3

The position to search for.

noOverlap bool

If null should be returned if more than one zone match.

Returns

Zone

GetClosestLocationName(Vector3, bool)

Find the zone which is closest to a point, falling back to the closest SDG.Unturned.LocationDevkitNode if none are found.

public string GetClosestLocationName(Vector3 position, bool shortName = false)

Parameters

position Vector3
shortName bool

Returns

string

GetClosestZone(Vector3, ZoneType?, FactionInfo?)

Find the zone which is closest to a point.

public Zone? GetClosestZone(Vector3 position, ZoneType? type = null, FactionInfo? faction = null)

Parameters

position Vector3
type ZoneType?
faction FactionInfo

Returns

Zone

Initialize(CancellationToken)

Initialize Zones from all the registered IZoneProvider.

public UniTask Initialize(CancellationToken token = default)

Parameters

token CancellationToken

Returns

UniTask

IsInsideZone(Vector2, ZoneType, FactionInfo?)

Check if a point is inside at least one zone matching the given type and faction.

public bool IsInsideZone(Vector2 point, ZoneType type, FactionInfo? faction)

Parameters

point Vector2
type ZoneType
faction FactionInfo

Returns

bool

IsInsideZone(Vector3, ZoneType, FactionInfo?)

Check if a point is inside at least one zone matching the given type and faction.

public bool IsInsideZone(Vector3 point, ZoneType type, FactionInfo? faction)

Parameters

point Vector3
type ZoneType
faction FactionInfo

Returns

bool

SearchZone(string, FactionInfo?)

Find a zone matching the given name, or null.

public Zone? SearchZone(string term, FactionInfo? relevantFaction = null)

Parameters

term string
relevantFaction FactionInfo

Returns

Zone

SearchZone(ZoneType, FactionInfo?)

Find the first zone matching the given zone type and faction.

public Zone? SearchZone(ZoneType type, FactionInfo? faction = null)

Parameters

type ZoneType
faction FactionInfo

Returns

Zone