Show / Hide Table of Contents

Class MyComponentStack

Inheritance
System.Object
MyComponentStack
Implements
IMyComponentStack
Namespace: Sandbox.Game.Entities
Assembly: Sandbox.Game.dll
Syntax
public class MyComponentStack : Object, IMyComponentStack

Constructors

MyComponentStack(MyCubeBlockDefinition, Single, Single)

Declaration
public MyComponentStack(MyCubeBlockDefinition BlockDefinition, float integrityPercent, float buildPercent)
Parameters
Type Name Description
MyCubeBlockDefinition BlockDefinition
System.Single integrityPercent
System.Single buildPercent

Fields

IntegrityChanged

Declaration
public Action<MyComponentStack, float, float> IntegrityChanged
Field Value
Type Description
System.Action<MyComponentStack, System.Single, System.Single>

MOUNT_THRESHOLD

Mount threshold, required because of float inaccuracy. Component that has integrity beyond this threshold is considered unmounted. The integrity of the whole stack will never fall beyond this level (unless the stack is fully dismounted)

Declaration
public const float MOUNT_THRESHOLD = 1.52590219E-05F
Field Value
Type Description
System.Single

Properties

BuildIntegrity

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

BuildRatio

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

GroupCount

Declaration
public int GroupCount { get; }
Property Value
Type Description
System.Int32

Integrity

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

IntegrityRatio

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

IsBuilt

Block is built and it final model can be shown

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

IsDestroyed

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

IsFullIntegrity

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

IsFullyDismounted

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

IsFunctional

Component stack is functional when critical part is not destroyed (integrity > 0). IMPORTANT: When you change the logic beyond this property, don't forget to call CheckFunctionalState every time the functional state could have been changed! (Also, remove calls to CheckFunctionalState where no longer needed)

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

LastChangeStamp

Declaration
public int LastChangeStamp { get; }
Property Value
Type Description
System.Int32

MaxIntegrity

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

NewBlockIntegrity

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

YieldLastComponent

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

Methods

ApplyDamage(Single, MyConstructionStockpile)

Applies damage to the component stack. The method works almost the same as dismounting, it just leaves the build level at the original value and also the parts that are put into the outputStockpile are damaged.

Declaration
public void ApplyDamage(float damage, MyConstructionStockpile outputStockpile = null)
Parameters
Type Name Description
System.Single damage
MyConstructionStockpile outputStockpile

CanContinueBuild(MyInventoryBase, MyConstructionStockpile)

Declaration
public bool CanContinueBuild(MyInventoryBase inventory, MyConstructionStockpile stockpile)
Parameters
Type Name Description
MyInventoryBase inventory
MyConstructionStockpile stockpile
Returns
Type Description
System.Boolean

DecreaseMountLevel(Single, MyConstructionStockpile, Boolean)

Dismounts component stack, dismounted items are put into output stockpile

Declaration
public void DecreaseMountLevel(float unmountAmount, MyConstructionStockpile outputStockpile = null, bool useDefaultDeconstructEfficiency = false)
Parameters
Type Name Description
System.Single unmountAmount
MyConstructionStockpile outputStockpile
System.Boolean useDefaultDeconstructEfficiency

DestroyCompletely()

Declaration
public void DestroyCompletely()

DisableLastComponentYield()

Declaration
public void DisableLastComponentYield()

GetAllMissingComponents(Dictionary<String, Int32>)

Declaration
public void GetAllMissingComponents(Dictionary<string, int> addToDictionary)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<System.String, System.Int32> addToDictionary

GetComponentStackInfo(Int32)

Declaration
public MyComponentStackInfo GetComponentStackInfo(int index)
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
MyComponentStackInfo

GetGroupInfo(Int32)

Declaration
public MyComponentStack.GroupInfo GetGroupInfo(int index)
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
MyComponentStack.GroupInfo

GetMissingComponents(Dictionary<String, Int32>, MyConstructionStockpile)

Declaration
public void GetMissingComponents(Dictionary<string, int> addToDictionary, MyConstructionStockpile availableItems = null)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<System.String, System.Int32> addToDictionary
MyConstructionStockpile availableItems

GetMissingInfo(out Int32, out Int32)

Declaration
public void GetMissingInfo(out int groupIndex, out int componentCount)
Parameters
Type Name Description
System.Int32 groupIndex
System.Int32 componentCount

GetMountedComponents(MyComponentList, MyObjectBuilder_CubeBlock)

Declaration
public static void GetMountedComponents(MyComponentList addToList, MyObjectBuilder_CubeBlock block)
Parameters
Type Name Description
Sandbox.Game.Entities.Cube.MyComponentList addToList
MyObjectBuilder_CubeBlock block

IncreaseMountLevel(Single, MyConstructionStockpile)

Declaration
public void IncreaseMountLevel(float mountAmount, MyConstructionStockpile stockpile = null)
Parameters
Type Name Description
System.Single mountAmount
MyConstructionStockpile stockpile

UpdateBuildIntegrityDown(Single)

Declaration
public void UpdateBuildIntegrityDown(float ratio)
Parameters
Type Name Description
System.Single ratio

UpdateBuildIntegrityUp()

Declaration
public void UpdateBuildIntegrityUp()

WillFunctionalityRise(Single)

Declaration
public Nullable<bool> WillFunctionalityRise(float mountAmount)
Parameters
Type Name Description
System.Single mountAmount

How much integrity changes

Returns
Type Description
System.Nullable<System.Boolean>

Null if no change, true if block will become functional, false if block stops being functional

Events

IsFunctionalChanged

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

Explicit Interface Implementations

IMyComponentStack.IntegrityChanged

Declaration
event Action<IMyComponentStack, float, float> IMyComponentStack.IntegrityChanged
Returns
Type Description
System.Action<IMyComponentStack, System.Single, System.Single>

Implements

IMyComponentStack
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾