Class SharedDeviceLinkSystem
Namespace: Content.Shared.DeviceLinking
Assembly: Content.Shared.dll
Syntax
public abstract class SharedDeviceLinkSystem : EntitySystem
Fields
| Improve this Doc View SourceInvokedPort
Declaration
public const string InvokedPort = null
Field Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceEnsureSinkPorts(EntityUid, String[])
Convenience function to add several ports to an entity.
Declaration
public void EnsureSinkPorts(EntityUid uid, params string[] ports)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.String[] | ports |
EnsureSourcePorts(EntityUid, String[])
Convenience function to add several ports to an entity
Declaration
public void EnsureSourcePorts(EntityUid uid, params string[] ports)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.String[] | ports |
GetDefaults(List<SourcePortPrototype>)
Returns the default links for the given list of source port prototypes
Declaration
public List<(string source, string sink)> GetDefaults(List<SourcePortPrototype> sources)
Parameters
Type | Name | Description |
---|---|---|
List<SourcePortPrototype> | sources | The list of source port prototypes to get the default links for |
Returns
Type | Description |
---|---|
List<System.ValueTuple<System.String, System.String>> | A list of sink and source port ids |
GetLinks(EntityUid, EntityUid, DeviceLinkSourceComponent)
Returns the links of a source
Declaration
public HashSet<(string source, string sink)> GetLinks(EntityUid sourceUid, EntityUid sinkUid, DeviceLinkSourceComponent sourceComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | sourceUid | |
EntityUid | sinkUid | |
DeviceLinkSourceComponent | sourceComponent |
Returns
Type | Description |
---|---|
HashSet<System.ValueTuple<System.String, System.String>> | A list of sink and source port ids that are linked together |
GetSinkPorts(EntityUid, DeviceLinkSinkComponent)
Retrieves the available ports from a sink
Declaration
public List<SinkPortPrototype> GetSinkPorts(EntityUid sinkUid, DeviceLinkSinkComponent sinkComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | sinkUid | |
DeviceLinkSinkComponent | sinkComponent |
Returns
Type | Description |
---|---|
List<SinkPortPrototype> | A list of sink port prototypes |
GetSourcePorts(EntityUid, DeviceLinkSourceComponent)
Retrieves the available ports from a source
Declaration
public List<SourcePortPrototype> GetSourcePorts(EntityUid sourceUid, DeviceLinkSourceComponent sourceComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | sourceUid | |
DeviceLinkSourceComponent | sourceComponent |
Returns
Type | Description |
---|---|
List<SourcePortPrototype> | A list of source port prototypes |
Initialize()
Declaration
public override void Initialize()
LinkDefaults(Nullable<EntityUid>, EntityUid, EntityUid, DeviceLinkSourceComponent, DeviceLinkSinkComponent)
Links the given source and sink by their default links
Declaration
public void LinkDefaults(EntityUid? userId, EntityUid sourceUid, EntityUid sinkUid, DeviceLinkSourceComponent sourceComponent = null, DeviceLinkSinkComponent sinkComponent = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<EntityUid> | userId | Optinal user uid for displaying popups |
EntityUid | sourceUid | The source uid |
EntityUid | sinkUid | The sink uid |
DeviceLinkSourceComponent | sourceComponent | |
DeviceLinkSinkComponent | sinkComponent |
PortName<TPort>(String)
Convenience function to retrieve the name of a port prototype
Declaration
public string PortName<TPort>(string port)
where TPort : DevicePortPrototype, IPrototype
Parameters
Type | Name | Description |
---|---|---|
System.String | port |
Returns
Type | Description |
---|---|
System.String |
Type Parameters
Name | Description |
---|---|
TPort |
RemoveAllFromSink(EntityUid, DeviceLinkSinkComponent)
Removes every link from the given sink
Declaration
public void RemoveAllFromSink(EntityUid sinkUid, DeviceLinkSinkComponent sinkComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | sinkUid | |
DeviceLinkSinkComponent | sinkComponent |
RemoveSinkFromSource(EntityUid, EntityUid, DeviceLinkSourceComponent, DeviceLinkSinkComponent)
Removes all links between a source and a sink
Declaration
public void RemoveSinkFromSource(EntityUid sourceUid, EntityUid sinkUid, DeviceLinkSourceComponent sourceComponent = null, DeviceLinkSinkComponent sinkComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | sourceUid | |
EntityUid | sinkUid | |
DeviceLinkSourceComponent | sourceComponent | |
DeviceLinkSinkComponent | sinkComponent |
SaveLinks(Nullable<EntityUid>, EntityUid, EntityUid, List<(String source, String sink)>, DeviceLinkSourceComponent, DeviceLinkSinkComponent)
Saves multiple links between a source and a sink device. Ignores links where either the source or sink port aren't present
Declaration
public void SaveLinks(EntityUid? userId, EntityUid sourceUid, EntityUid sinkUid, List<(string source, string sink)> links, DeviceLinkSourceComponent sourceComponent = null, DeviceLinkSinkComponent sinkComponent = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<EntityUid> | userId | Optinal user uid for displaying popups |
EntityUid | sourceUid | The source uid |
EntityUid | sinkUid | The sink uid |
List<System.ValueTuple<System.String, System.String>> | links | List of source and sink ids to link |
DeviceLinkSourceComponent | sourceComponent | |
DeviceLinkSinkComponent | sinkComponent |
ToggleLink(Nullable<EntityUid>, EntityUid, EntityUid, String, String, DeviceLinkSourceComponent, DeviceLinkSinkComponent)
Adds or removes a link depending on if it's already present
Declaration
public bool ToggleLink(EntityUid? userId, EntityUid sourceUid, EntityUid sinkUid, string source, string sink, DeviceLinkSourceComponent sourceComponent = null, DeviceLinkSinkComponent sinkComponent = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<EntityUid> | userId | |
EntityUid | sourceUid | |
EntityUid | sinkUid | |
System.String | source | |
System.String | sink | |
DeviceLinkSourceComponent | sourceComponent | |
DeviceLinkSinkComponent | sinkComponent |
Returns
Type | Description |
---|---|
System.Boolean | True if the link was successfully added or removed |