Show / Hide Table of Contents

Class StackSystem

Entity system that handles everything relating to stacks. This is a good example for learning how to code in an ECS manner.

Inheritance
System.Object
SharedStackSystem
StackSystem
Namespace: Content.Server.Stack
Assembly: Content.Server.dll
Syntax
public sealed class StackSystem : SharedStackSystem

Fields

| Improve this Doc View Source

DefaultSplitAmounts

Declaration
public static readonly int[] DefaultSplitAmounts
Field Value
Type Description
System.Int32[]

Methods

| Improve this Doc View Source

Initialize()

Declaration
public override void Initialize()
Overrides
SharedStackSystem.Initialize()
| Improve this Doc View Source

SetCount(EntityUid, Int32, StackComponent)

Declaration
public override void SetCount(EntityUid uid, int amount, StackComponent component = null)
Parameters
Type Name Description
EntityUid uid
System.Int32 amount
StackComponent component
| Improve this Doc View Source

Spawn(Int32, StackPrototype, EntityCoordinates)

Spawns a stack of a certain stack type. See StackPrototype.

Declaration
public EntityUid Spawn(int amount, StackPrototype prototype, EntityCoordinates spawnPosition)
Parameters
Type Name Description
System.Int32 amount
StackPrototype prototype
Robust.Shared.Map.EntityCoordinates spawnPosition
Returns
Type Description
EntityUid
| Improve this Doc View Source

SpawnMultiple(String, Int32, EntityCoordinates)

Say you want to spawn 97 units of something that has a max stack count of 30. This would spawn 3 stacks of 30 and 1 stack of 7.

Declaration
public List<EntityUid> SpawnMultiple(string entityPrototype, int amount, EntityCoordinates spawnPosition)
Parameters
Type Name Description
System.String entityPrototype
System.Int32 amount
Robust.Shared.Map.EntityCoordinates spawnPosition
Returns
Type Description
List<EntityUid>
| Improve this Doc View Source

Split(EntityUid, Int32, EntityCoordinates, StackComponent)

Try to split this stack into two. Returns a non-null Robust.Shared.GameObjects.EntityUid if successful.

Declaration
public EntityUid? Split(EntityUid uid, int amount, EntityCoordinates spawnPosition, StackComponent stack = null)
Parameters
Type Name Description
EntityUid uid
System.Int32 amount
Robust.Shared.Map.EntityCoordinates spawnPosition
StackComponent stack
Returns
Type Description
System.Nullable<EntityUid>
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾