private static void SetupDef <V, M>(Dictionary <int, V> defs, GameDataModder gameDataModder, GameData __instance, AssetProvider prefabProvider) where V : Definition, new() where M : IDataMod <V> { foreach (var mod in gameDataModder.GetMods <M>().Where(x => !x.IsAdditive)) { mod.SetData(defs[mod.Id], __instance, prefabProvider); } foreach (var mod in gameDataModder.GetMods <M>().Where(x => x.IsAdditive)) { mod.SetData(defs[mod.Id], __instance, prefabProvider); } }
private static Dictionary <int, V> CreateEmpties <V, M>(Dictionary <int, V> dict, GameDataModder gameDataModder) where V : Definition, new() where M : IDataMod <V> { var defs = new Dictionary <int, V>(); foreach (var mod in gameDataModder.GetMods <M>()) { if (!dict.ContainsKey(mod.Id)) { dict.Add(mod.Id, new V()); } defs.Add(mod.Id, dict[mod.Id]); } return(defs); }