Currently, several screens (CharacterCreation and CustomBattleMenu for example) are populated using hard-coded static fields. Here is an example from CustomBattleData.cs:
The character creation culture selection VM is populated in a similar fashion, and I wouldn't be surprised if other UI VM's also are populated with static fields.
A simple solution would be making those methods virtual, which would allow for modders to implement their own class inheriting from CustomBattleData which loads whichever cultures/characters/etc. they want without having to use harmony patching/re-implementing a significant amount of code.
C#:
public static IEnumerable<BasicCharacterObject> Characters
{
get
{
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_1");
if (!Module.CurrentModule.IsOnlyCoreContentEnabled)
{
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_2");
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_3");
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_4");
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_5");
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_6");
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_7");
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_8");
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_9");
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_10");
}
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_11");
if (!Module.CurrentModule.IsOnlyCoreContentEnabled)
yield return Game.Current.ObjectManager.GetObject<BasicCharacterObject>("commander_12");
}
}
public static IEnumerable<BasicCultureObject> Factions
{
get
{
yield return Game.Current.ObjectManager.GetObject<BasicCultureObject>("empire");
if (!Module.CurrentModule.IsOnlyCoreContentEnabled)
{
yield return Game.Current.ObjectManager.GetObject<BasicCultureObject>("sturgia");
yield return Game.Current.ObjectManager.GetObject<BasicCultureObject>("aserai");
yield return Game.Current.ObjectManager.GetObject<BasicCultureObject>("vlandia");
yield return Game.Current.ObjectManager.GetObject<BasicCultureObject>("battania");
yield return Game.Current.ObjectManager.GetObject<BasicCultureObject>("khuzait");
}
}
}
The character creation culture selection VM is populated in a similar fashion, and I wouldn't be surprised if other UI VM's also are populated with static fields.
A simple solution would be making those methods virtual, which would allow for modders to implement their own class inheriting from CustomBattleData which loads whichever cultures/characters/etc. they want without having to use harmony patching/re-implementing a significant amount of code.