-
Notifications
You must be signed in to change notification settings - Fork 1
/
SubModule.cs
25 lines (23 loc) · 1012 Bytes
/
SubModule.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
using TaleWorlds.CampaignSystem;
using TaleWorlds.Core;
using TaleWorlds.MountAndBlade;
namespace Int19h.Bannerlord.PettyKingdoms {
public class SubModule : MBSubModuleBase {
protected override void OnGameStart(Game game, IGameStarter gameStarterObject) {
base.OnGameStart(game, gameStarterObject);
if (gameStarterObject is CampaignGameStarter campaignStarter) {
campaignStarter.AddBehavior(new PettyKingdomsCampaignBehavior());
}
}
public override void OnAfterGameInitializationFinished(Game game, object starterObject) {
base.OnAfterGameInitializationFinished(game, starterObject);
if (Campaign.Current != null) {
var behavior = Campaign.Current.GetCampaignBehavior<PettyKingdomsCampaignBehavior>();
if (!behavior.WasApplied) {
PettyKingdoms.Create();
behavior.WasApplied = true;
}
}
}
}
}