Class MyComponentStack
Inheritance
System.Object
MyComponentStack
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
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
CanContinueBuild(MyInventoryBase, MyConstructionStockpile)
Declaration
public bool CanContinueBuild(MyInventoryBase inventory, MyConstructionStockpile stockpile)
Parameters
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
GetGroupInfo(Int32)
Declaration
public MyComponentStack.GroupInfo GetGroupInfo(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
Returns
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
IncreaseMountLevel(Single, MyConstructionStockpile)
Declaration
public void IncreaseMountLevel(float mountAmount, MyConstructionStockpile stockpile = null)
Parameters
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
Implements