Show / Hide Table of Contents

Class MyResourceSinkComponent

Inheritance
System.Object
MyComponentBase
MyEntityComponentBase
MyResourceSinkComponentBase
MyResourceSinkComponent
Inherited Members
MyEntityComponentBase.OnAddedToContainer()
MyEntityComponentBase.Container
MyEntityComponentBase.AttachSyncToEntity
MyEntityComponentBase.OnAfterAddedToContainer
MyEntityComponentBase.BeforeRemovedFromContainer
MyComponentBase.SetContainer(IMyComponentContainer)
MyComponentBase.GetAs<T>()
MyComponentBase.OnAddedToScene()
MyComponentBase.OnRemovedFromScene()
MyComponentBase.Serialize(Boolean)
MyComponentBase.Deserialize(MyObjectBuilder_ComponentBase)
MyComponentBase.Init(MyComponentDefinitionBase)
MyComponentBase.IsSerialized()
MyComponentBase.RemoveExistingComponentOnNewInsert
MyComponentBase.ContainerBase
Namespace: Sandbox.Game.EntityComponents
Assembly: Sandbox.Game.dll
Syntax
public class MyResourceSinkComponent : MyResourceSinkComponentBase, IMyEntityComponentBase, IMyComponentBase, IMyResourceSinkComponent

Constructors

MyResourceSinkComponent(Int32)

Declaration
public MyResourceSinkComponent(int initialAllocationSize = 1)
Parameters
Type Name Description
System.Int32 initialAllocationSize

Fields

ParentBlock

Declaration
public MyCubeBlock ParentBlock
Field Value
Type Description
MyCubeBlock

Properties

AcceptedResources

Declaration
public override ListReader<MyDefinitionId> AcceptedResources { get; }
Property Value
Type Description
ListReader<MyDefinitionId>
Overrides
MyResourceSinkComponentBase.AcceptedResources

ComponentTypeDebugString

Declaration
public override string ComponentTypeDebugString { get; }
Property Value
Type Description
System.String
Overrides
MyEntityComponentBase.ComponentTypeDebugString

CurrentInput

Declaration
public float CurrentInput { get; }
Property Value
Type Description
System.Single

Entity

Declaration
public MyEntity Entity { get; }
Property Value
Type Description
MyEntity

Grid

Grid of assigned entity. If no entity is assigned gets manualy set grid

Declaration
public MyCubeGrid Grid { get; set; }
Property Value
Type Description
MyCubeGrid

IsPowered

Declaration
public bool IsPowered { get; }
Property Value
Type Description
System.Boolean

MaxRequiredInput

Declaration
public float MaxRequiredInput { get; set; }
Property Value
Type Description
System.Single

RequiredInput

Declaration
public float RequiredInput { get; }
Property Value
Type Description
System.Single

SuppliedRatio

Declaration
public float SuppliedRatio { get; }
Property Value
Type Description
System.Single

TemporaryConnectedEntity

Declaration
public override IMyEntity TemporaryConnectedEntity { get; set; }
Property Value
Type Description
IMyEntity
Overrides
MyResourceSinkComponentBase.TemporaryConnectedEntity

Methods

add_CurrentInputChanged(MyCurrentResourceInputChangedDelegate)

Declaration
public void add_CurrentInputChanged(MyCurrentResourceInputChangedDelegate value)
Parameters
Type Name Description
MyCurrentResourceInputChangedDelegate value

add_RequiredInputChanged(MyRequiredResourceChangeDelegate)

Declaration
public void add_RequiredInputChanged(MyRequiredResourceChangeDelegate value)
Parameters
Type Name Description
MyRequiredResourceChangeDelegate value

add_ResourceAvailable(MyResourceAvailableDelegate)

Declaration
public void add_ResourceAvailable(MyResourceAvailableDelegate value)
Parameters
Type Name Description
MyResourceAvailableDelegate value

AddType(ref MyResourceSinkInfo)

Declaration
public void AddType(ref MyResourceSinkInfo sinkData)
Parameters
Type Name Description
MyResourceSinkInfo sinkData

ClearAllData()

Declaration
public void ClearAllData()

CurrentInputByType(MyDefinitionId)

Declaration
public override float CurrentInputByType(MyDefinitionId resourceTypeId)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
Returns
Type Description
System.Single
Overrides
MyResourceSinkComponentBase.CurrentInputByType(MyDefinitionId)

DebugDraw(Matrix)

Declaration
public void DebugDraw(Matrix worldMatrix)
Parameters
Type Name Description
Matrix worldMatrix

ForceCallNextIsPoweredChanged()

Declaration
public void ForceCallNextIsPoweredChanged()

GetTypeIndex(MyDefinitionId)

Declaration
protected int GetTypeIndex(MyDefinitionId resourceTypeId)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
Returns
Type Description
System.Int32

Init(MyStringHash, List<MyResourceSinkInfo>, MyCubeBlock)

Declaration
public void Init(MyStringHash group, List<MyResourceSinkInfo> sinkData, MyCubeBlock parent)
Parameters
Type Name Description
MyStringHash group
System.Collections.Generic.List<MyResourceSinkInfo> sinkData
MyCubeBlock parent

Init(MyStringHash, Single, Func<Single>, MyCubeBlock)

Declaration
public void Init(MyStringHash group, float maxRequiredInput, Func<float> requiredInputFunc, MyCubeBlock parent)
Parameters
Type Name Description
MyStringHash group
System.Single maxRequiredInput
System.Func<System.Single> requiredInputFunc
MyCubeBlock parent

Init(MyStringHash, MyResourceSinkInfo)

Declaration
public void Init(MyStringHash group, MyResourceSinkInfo sinkData)
Parameters
Type Name Description
MyStringHash group
MyResourceSinkInfo sinkData

Init(MyStringHash, MyResourceSinkInfo, MyCubeBlock)

Declaration
public void Init(MyStringHash group, MyResourceSinkInfo sinkData, MyCubeBlock parent)
Parameters
Type Name Description
MyStringHash group
MyResourceSinkInfo sinkData
MyCubeBlock parent

IsPowerAvailable(MyDefinitionId, Single)

Declaration
public override bool IsPowerAvailable(MyDefinitionId resourceTypeId, float power)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
System.Single power
Returns
Type Description
System.Boolean
Overrides
MyResourceSinkComponentBase.IsPowerAvailable(MyDefinitionId, Single)

IsPoweredByType(MyDefinitionId)

Declaration
public override bool IsPoweredByType(MyDefinitionId resourceTypeId)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
Returns
Type Description
System.Boolean
Overrides
MyResourceSinkComponentBase.IsPoweredByType(MyDefinitionId)

MaxRequiredInputByType(MyDefinitionId)

Declaration
public override float MaxRequiredInputByType(MyDefinitionId resourceTypeId)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
Returns
Type Description
System.Single
Overrides
MyResourceSinkComponentBase.MaxRequiredInputByType(MyDefinitionId)

OnBeforeRemovedFromContainer()

Declaration
public override void OnBeforeRemovedFromContainer()
Overrides
MyEntityComponentBase.OnBeforeRemovedFromContainer()

remove_CurrentInputChanged(MyCurrentResourceInputChangedDelegate)

Declaration
public void remove_CurrentInputChanged(MyCurrentResourceInputChangedDelegate value)
Parameters
Type Name Description
MyCurrentResourceInputChangedDelegate value

remove_RequiredInputChanged(MyRequiredResourceChangeDelegate)

Declaration
public void remove_RequiredInputChanged(MyRequiredResourceChangeDelegate value)
Parameters
Type Name Description
MyRequiredResourceChangeDelegate value

remove_ResourceAvailable(MyResourceAvailableDelegate)

Declaration
public void remove_ResourceAvailable(MyResourceAvailableDelegate value)
Parameters
Type Name Description
MyResourceAvailableDelegate value

RemoveType(ref MyDefinitionId)

Declaration
public void RemoveType(ref MyDefinitionId resourceType)
Parameters
Type Name Description
MyDefinitionId resourceType

RequiredInputByType(MyDefinitionId)

Declaration
public override float RequiredInputByType(MyDefinitionId resourceTypeId)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
Returns
Type Description
System.Single
Overrides
MyResourceSinkComponentBase.RequiredInputByType(MyDefinitionId)

ResourceAvailableByType(MyDefinitionId)

Declaration
public float ResourceAvailableByType(MyDefinitionId resourceTypeId)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
Returns
Type Description
System.Single

SetInputFromDistributor(MyDefinitionId, Single, Boolean, Boolean)

This should be called only from MyResourceDistributor.

Declaration
public override void SetInputFromDistributor(MyDefinitionId resourceTypeId, float newResourceInput, bool isAdaptible, bool fireEvents = true)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
System.Single newResourceInput
System.Boolean isAdaptible
System.Boolean fireEvents
Overrides
MyResourceSinkComponentBase.SetInputFromDistributor(MyDefinitionId, Single, Boolean, Boolean)

SetMaxRequiredInputByType(MyDefinitionId, Single)

Declaration
public override void SetMaxRequiredInputByType(MyDefinitionId resourceTypeId, float newMaxRequiredInput)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
System.Single newMaxRequiredInput
Overrides
MyResourceSinkComponentBase.SetMaxRequiredInputByType(MyDefinitionId, Single)

SetRequiredInputByType(MyDefinitionId, Single)

Declaration
public override void SetRequiredInputByType(MyDefinitionId resourceTypeId, float newRequiredInput)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
System.Single newRequiredInput
Overrides
MyResourceSinkComponentBase.SetRequiredInputByType(MyDefinitionId, Single)

SetRequiredInputFuncByType(MyDefinitionId, Func<Single>)

Change the required input function (callback) for given type of resource. It does not call it immediatelly to update required input value.

Declaration
public override Func<float> SetRequiredInputFuncByType(MyDefinitionId resourceTypeId, Func<float> newRequiredInputFunc)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
System.Func<System.Single> newRequiredInputFunc
Returns
Type Description
System.Func<System.Single>
Overrides
MyResourceSinkComponentBase.SetRequiredInputFuncByType(MyDefinitionId, Func<Single>)

SuppliedRatioByType(MyDefinitionId)

Declaration
public override float SuppliedRatioByType(MyDefinitionId resourceTypeId)
Parameters
Type Name Description
MyDefinitionId resourceTypeId
Returns
Type Description
System.Single
Overrides
MyResourceSinkComponentBase.SuppliedRatioByType(MyDefinitionId)

Update()

Declaration
public void Update()

Events

CurrentInputChanged

Declaration
public event MyCurrentResourceInputChangedDelegate CurrentInputChanged
Event Type
Type Description
MyCurrentResourceInputChangedDelegate

IsPoweredChanged

Declaration
public event Action IsPoweredChanged
Event Type
Type Description
System.Action

OnAddType

Declaration
public event Action<MyResourceSinkComponent, MyDefinitionId> OnAddType
Event Type
Type Description
System.Action<MyResourceSinkComponent, MyDefinitionId>

OnRemoveType

Declaration
public event Action<MyResourceSinkComponent, MyDefinitionId> OnRemoveType
Event Type
Type Description
System.Action<MyResourceSinkComponent, MyDefinitionId>

RequiredInputChanged

Declaration
public event MyRequiredResourceChangeDelegate RequiredInputChanged
Event Type
Type Description
MyRequiredResourceChangeDelegate

ResourceAvailable

Declaration
public event MyResourceAvailableDelegate ResourceAvailable
Event Type
Type Description
MyResourceAvailableDelegate

Extension Methods

MyEntityContainerEventExtensions.RegisterForEntityEvent(MyEntityComponentBase, MyStringHash, MyEntityContainerEventExtensions.EntityEventHandler)
MyEntityContainerEventExtensions.RegisterForEntityEvent(MyEntityComponentBase, MyEntity, MyStringHash, MyEntityContainerEventExtensions.EntityEventHandler)
MyEntityContainerEventExtensions.UnregisterForEntityEvent(MyEntityComponentBase, MyEntity, MyStringHash)
MyEntityContainerEventExtensions.RaiseEntityEvent(MyEntityComponentBase, MyStringHash, MyEntityContainerEventExtensions.EntityEventParams)
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾