-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #700 from Bannerlord-Coop-Team/Enter-exit-settleme…
…nt-fix Settlement Enter Spam & Leave Crash fix
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
source/GameInterface/Services/Settlements/Patches/EncounterGameMenuBehaviorPatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using GameInterface.Services.MobileParties.Patches; | ||
using HarmonyLib; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using TaleWorlds.CampaignSystem; | ||
using TaleWorlds.CampaignSystem.CampaignBehaviors; | ||
using TaleWorlds.CampaignSystem.Encounters; | ||
using TaleWorlds.CampaignSystem.GameMenus; | ||
|
||
namespace GameInterface.Services.Settlements.Patches | ||
{ | ||
[HarmonyPatch(typeof(EncounterGameMenuBehavior))] | ||
public class EncounterGameMenuBehaviorPatch | ||
{ | ||
//These patches disables opening of these menus if EncounterSettlement is null as it seems to get called multiple times. | ||
[HarmonyPrefix] | ||
[HarmonyPatch("game_menu_town_outside_on_init")] | ||
public static bool Prefix(MenuCallbackArgs args) | ||
{ | ||
if (PlayerEncounter.EncounterSettlement != null) return true; | ||
|
||
return false; | ||
} | ||
|
||
[HarmonyPrefix] | ||
[HarmonyPatch("game_menu_town_town_besiege_on_condition")] | ||
public static bool CheckFortificationEncounterSettlement(MenuCallbackArgs args) | ||
{ | ||
if (PlayerEncounter.EncounterSettlement != null) return true; | ||
|
||
return false; | ||
} | ||
} | ||
} |