Class ZoneStore
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
zoneProvidersIEnumerable<IZoneProvider>playerServiceIPlayerServiceloggerILogger<ZoneStore>isGlobalboolwarfareWarfareModuleeventDispatcherEventDispatcher
Properties
IsGlobal
If this instance of ZoneStore is the global instance, not the one created for flag layouts.
public bool IsGlobal { get; }
Property Value
ProximityZones
All available zones (not just the ones in-game).
public IReadOnlyList<ZoneProximity>? ProximityZones { get; }
Property Value
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
Methods
CreateColliderForZone(Zone)
Creates a new IProximity depending on the type of zone defined.
public ITrackingProximity<WarfarePlayer> CreateColliderForZone(Zone zone)
Parameters
zoneZone
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
zoneZone
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
tokenCancellationToken
Returns
- UniTask
EnumerateInsideZones(Vector2, ZoneType?)
Enumerate through all zones that point is inside.
public IEnumerable<Zone> EnumerateInsideZones(Vector2 point, ZoneType? type = null)
Parameters
pointVector2typeZoneType?
Returns
EnumerateInsideZones(Vector3, ZoneType?)
Enumerate through all zones that point is inside.
public IEnumerable<Zone> EnumerateInsideZones(Vector3 point, ZoneType? type = null)
Parameters
pointVector3typeZoneType?
Returns
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
Returns
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
pointVector3typeZoneType?
Returns
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
Returns
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
posVector2The position to search for.
noOverlapboolIf null should be returned if more than one zone match.
Returns
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
posVector3The position to search for.
noOverlapboolIf null should be returned if more than one zone match.
Returns
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
positionVector3shortNamebool
Returns
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
positionVector3typeZoneType?factionFactionInfo
Returns
Initialize(CancellationToken)
Initialize Zones from all the registered IZoneProvider.
public UniTask Initialize(CancellationToken token = default)
Parameters
tokenCancellationToken
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
pointVector2typeZoneTypefactionFactionInfo
Returns
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
pointVector3typeZoneTypefactionFactionInfo
Returns
SearchZone(string, FactionInfo?)
Find a zone matching the given name, or null.
public Zone? SearchZone(string term, FactionInfo? relevantFaction = null)
Parameters
termstringrelevantFactionFactionInfo
Returns
SearchZone(ZoneType, FactionInfo?)
Find the first zone matching the given zone type and faction.
public Zone? SearchZone(ZoneType type, FactionInfo? faction = null)
Parameters
typeZoneTypefactionFactionInfo