Skip to content

Commit

Permalink
Merge revert
Browse files Browse the repository at this point in the history
  • Loading branch information
artifixer committed Nov 14, 2021
1 parent 5231621 commit 2060264
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
22 changes: 0 additions & 22 deletions src/Messengers/LeaveEncounterLogic.cs

This file was deleted.

16 changes: 11 additions & 5 deletions src/Messengers/MessengerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void OnEndMission()
_messengers.Remove(_activeMessenger!);
_activeMessenger = null;
_currentMission = null;
CampaignEvents.TickEvent.AddNonSerializedListener(this, CleanUpSettlementEncounter);
}

public void OnMissionModeChange(MissionMode oldMissionMode, bool atStart)
Expand Down Expand Up @@ -200,11 +201,6 @@ public void StartDialogue(Hero targetHero, Messenger messenger)
specialScene, sceneLevels);
}

#if e165
_currentMission.AddMissionBehavior(new LeaveEncounterLogic());
#else
_currentMission.AddMissionBehaviour(new LeaveEncounterLogic());
#endif
_currentMission.AddListener(this);
}

Expand Down Expand Up @@ -251,5 +247,15 @@ public static bool CanSendMessengerWithCost(Hero opposingLeader, DiplomacyCost d
var canPayCost = diplomacyCost.CanPayCost();
return canPayCost && IsTargetHeroAvailable(opposingLeader);
}

private void CleanUpSettlementEncounter(float obj)
{
PlayerEncounter.Finish();
#if e159 || e1510
CampaignEvents.RemoveListeners(this);
#else
CampaignEventDispatcher.Instance.RemoveListeners(this);
#endif
}
}
}

0 comments on commit 2060264

Please sign in to comment.