public static void ReloadTankDefs() { tankTypes.Clear(); // Structural tank type is hard coded tankTypes.Add(structuralTankName, StructuralTankType); foreach (var node in GameDatabase.Instance.GetConfigNodes("B9_TANK_TYPE")) { TankType t = new TankType(); OperationContext context = new OperationContext(Operation.LoadPrefab, t); try { t.Load(node, context); } catch (Exception ex) { Exception ex2 = new Exception($"Fatal exception while loading tank type {t.tankName ?? "<unknown>"}", ex); FatalErrorHandler.HandleFatalError(ex2); throw ex2; } if (tankTypes.ContainsKey(t.tankName)) { Log.error("B9TankSettings: The tank type {0} already exists", t.tankName); continue; } tankTypes.Add(t.tankName, t); Log.info("B9TankSettings: registered tank type {0}", t.tankName); } LoadedTankDefs = true; }
public static void ReloadTankDefs() { tankTypes.Clear(); // Structural tank type is hard coded tankTypes.Add(structuralTankName, StructuralTankType); foreach (var node in GameDatabase.Instance.GetConfigNodes("B9_TANK_TYPE")) { TankType t = new TankType(); t.Load(node); if (tankTypes.ContainsKey(t.tankName)) { Debug.LogError($"B9TankSettings: The tank type {t.tankName} already exists"); continue; } tankTypes.Add(t.tankName, t); Debug.Log($"B9TankSettings: registered tank type {t.tankName}"); } LoadedTankDefs = true; }
public static void ReloadTankDefs() { tankTypes.Clear(); // Structural tank type is hard coded tankTypes.Add(StructuralTankType.tankName, StructuralTankType); ConfigNode[] nodes = GameDatabase.Instance.GetConfigNodes("B9_TANK_TYPE"); for (int i = 0; i < nodes.Length; i++) { TankType t = new TankType(); t.Load(nodes[i]); if (tankTypes.ContainsKey(t.tankName)) { Debug.LogError("The tank type " + t.tankName + " already exists"); continue; } tankTypes.Add(t.tankName, t); Debug.Log("B9TankSettings: registered tank type " + t.tankName); } LoadedTankDefs = true; }