Client LuaCsForBarotrauma
StartItemSet.cs
1 #nullable enable
2 using System.Collections.Immutable;
3 using System.Linq;
4 using System.Xml.Linq;
5 
6 namespace Barotrauma
7 {
8  internal class StartItem
9  {
10  public Identifier Item;
11  public int Amount;
12  public bool MultiPlayerOnly;
13 
14  public StartItem(XElement element)
15  {
16  Item = element.GetAttributeIdentifier("identifier", Identifier.Empty);
17  Amount = element.GetAttributeInt(nameof(Amount), 1);
18  MultiPlayerOnly = element.GetAttributeBool(nameof(MultiPlayerOnly), false);
19  }
20  }
21 
25  internal class StartItemSet : PrefabWithUintIdentifier
26  {
27  public readonly static PrefabCollection<StartItemSet> Sets = new PrefabCollection<StartItemSet>();
28 
29  public readonly ImmutableArray<StartItem> Items;
30 
34  public readonly int Order;
35 
36  public StartItemSet(ContentXElement element, StartItemsFile file) : base(file, element.GetAttributeIdentifier("identifier", Identifier.Empty))
37  {
38  Items = element.Elements().Select(e => new StartItem(e!)).ToImmutableArray();
39  Order = element.GetAttributeInt("order", 0);
40  }
41 
42  public override void Dispose() { }
43  }
44 }
readonly Identifier Identifier
Definition: Prefab.cs:34