Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaShared/SharedSource/Items/StartItemSet.cs
T
Markus Isberg 077917fa5d Build 0.18.2.0
2022-05-19 23:43:21 +09:00

36 lines
1.1 KiB
C#

#nullable enable
using System.Collections.Immutable;
using System.Linq;
using System.Xml.Linq;
namespace Barotrauma
{
internal class StartItem
{
public Identifier Item;
public int Amount;
public StartItem(XElement element)
{
Item = element.GetAttributeIdentifier("identifier", Identifier.Empty);
Amount = element.GetAttributeInt("amount", 1);
}
}
/// <summary>
/// Additive sets of items spawned only at the start of the game.
/// </summary>
internal class StartItemSet : PrefabWithUintIdentifier
{
public readonly static PrefabCollection<StartItemSet> Sets = new PrefabCollection<StartItemSet>();
public readonly ImmutableArray<StartItem> Items;
public StartItemSet(ContentXElement element, StartItemsFile file) : base(file, element.GetAttributeIdentifier("identifier", Identifier.Empty))
{
Items = element.Elements().Select(e => new StartItem(e!)).ToImmutableArray();
}
public override void Dispose() { }
}
}