forked from ajkroeg/ShellShuffler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAmmoHolder.cs
54 lines (50 loc) · 1.94 KB
/
AmmoHolder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System.Collections.Generic;
using BattleTech;
using BattleTech.Data;
using ShellShuffler.Init;
namespace ShellShuffler
{
public class AmmoHolder
{
private static AmmoHolder _instance;
public DataManager dataManager;
public List <AmmunitionDef> ammoList = new List<AmmunitionDef>();
public List <AmmunitionBoxDef> ammoBoxList = new List<AmmunitionBoxDef>();
public static AmmoHolder AmmoHolderInstance
{
get
{
if (_instance == null) _instance = new AmmoHolder();
return _instance;
}
}
internal void Initialize(DataManager dm)
{
dataManager = dm;
ammoBoxList = new List<AmmunitionBoxDef>();
foreach (var t in dataManager.AmmoBoxDefs)
{
if (!t.Value.Description.Id.EndsWith("ContentAmmunitionBoxDef"))
{
if((t.Value.ComponentTags != null) && (t.Value.ComponentTags.ContainsAny(ModInit.modSettings.BlacklistAmmoboxOutTags)))
{
ModInit.modLog.LogMessage($"Skipping Ammo Box Def: {t.Value.Description.Name} due to blacklisted tags");
continue;
}
ammoBoxList.Add(t.Value);
ModInit.modLog.LogMessage($"Added Ammo Box Def: {t.Value.Description.Name} to ammoBoxList with capacity {t.Value.Capacity}");
}
else
{
ModInit.modLog.LogMessage($"Ammo Box Def: {t.Value.Description.Name} was ContentAmmunitionBoxDef, skipping.");
}
}
ammoList = new List<AmmunitionDef>();
foreach (var t in dataManager.AmmoDefs)
{
ammoList.Add(t.Value);
ModInit.modLog.LogMessage($"Added Ammo Def: {t.Value.Description.Name} to ammoList");
}
}
}
}