Content.Server/Construction/StackHelpers.cs
/// <summary>
///     Spawns a stack of a specified type given an amount.
/// </summary>
Spawns a stack of a specified type given an amount.
Spawns a stack of a specified type given an amount .
public static IEntity SpawnStack(StackType stack, int amount, EntityCoordinates coordinates, IEntityManager? entityManager = null)
        {
            entityManager ??= IoCManager.Resolve<IEntityManager>();
            string prototype;
            switch (stack)
            {
                case StackType.Metal:
                    prototype = "SteelSheet1";
                    break;
                case StackType.Glass:
                    prototype = "GlassSheet1";
                    break;
                case StackType.MetalRod:
                    prototype = "MetalRodStack1";
                    break;
                case StackType.Plasma:
                    prototype = "PlasmaStack1";
                    break;
                case StackType.Plasteel:
                    prototype = "PlasteelSheet1";
                    break;
                case StackType.Cable:
                    prototype = "ApcExtensionCableStack1";
                    break;
                default:
                    throw new ArgumentOutOfRangeException(nameof(stack),"Stack type doesn't have a prototype specified yet!");
            }
            var ent = entityManager.SpawnEntity(prototype, coordinates);
            var stackComponent = ent.GetComponent<StackComponent>();
            stackComponent.Count = Math.Min(amount, stackComponent.MaxCount);
            return ent;
        }
public static IEntity SpawnStack ( StackType stack , int amount , EntityCoordinates coordinates , IEntityManager ? entityManager = null ) { entityManager ??= IoCManager . Resolve < IEntityManager > ( ) ; string prototype ; switch ( stack ) { case StackType . Metal : prototype = " " ; break ; case StackType . Glass : prototype = " " ; break ; case StackType . MetalRod : prototype = " " ; break ; case StackType . Plasma : prototype = " " ; break ; case StackType . Plasteel : prototype = " " ; break ; case StackType . Cable : prototype = " " ; break ; default : throw new ArgumentOutOfRangeException ( nameof ( stack ) , " " ) ; } var ent = entityManager . SpawnEntity ( prototype , coordinates ) ; var stackComponent = ent . GetComponent < StackComponent > ( ) ; stackComponent . Count = Math . Min ( amount , stackComponent . MaxCount ) ; return ent ; }
Spawns a stack of a specified type given an amount.
Spawns a stack of a specified type given an amount .
// TODO: Add more.
stack
StackType
amount
int
coordinates
EntityCoordinates
entityManager
IEntityManager?