Skip to content

Commit

Permalink
Merge pull request #554 from CWolfs/develop
Browse files Browse the repository at this point in the history
v1.5.1
  • Loading branch information
CWolfs authored Oct 24, 2022
2 parents 99de1f2 + 9e1588d commit 646e438
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "Mission Control",
"Enabled": true,
"Version": "1.5.0",
"Version": "1.5.1",
"Description": "A HBS BattleTech mod that adds custom contract types and varies the encounter specifics such as encounter boundary size, spawn locations, lance numbers and objectives",
"Author": "CWolf",
"Contact": "[email protected]",
Expand Down
72 changes: 37 additions & 35 deletions src/Core/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -569,50 +569,52 @@ public void ResetBetweenContracts() {
}

public void BackupContractOverriddeData() {
Main.Logger.Log($"[MissionControl] Backing up original ContractOverride data for: " + MissionControl.Instance.CurrentContract.Name);
if (Main.Settings.Misc.ContractOverrideDataCleanupMethod == "RestoreFromCopy") {
Main.Logger.Log($"[MissionControl] Backing up original ContractOverride data for: " + MissionControl.Instance.CurrentContract.Name);

// Lance Overrides
ContractOverrideLanceOverrideBackup = new Dictionary<string, List<LanceOverride>>();
// Lance Overrides
ContractOverrideLanceOverrideBackup = new Dictionary<string, List<LanceOverride>>();

ContractOverrideLanceOverrideBackup.Add("Player1", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.player1Team.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["Player1"].Add(lanceOverride.Copy());
}
ContractOverrideLanceOverrideBackup.Add("Player1", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.player1Team.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["Player1"].Add(lanceOverride.Copy());
}

ContractOverrideLanceOverrideBackup.Add("Employer", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.employerTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["Employer"].Add(lanceOverride.Copy());
}
ContractOverrideLanceOverrideBackup.Add("Employer", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.employerTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["Employer"].Add(lanceOverride.Copy());
}

ContractOverrideLanceOverrideBackup.Add("EmployerAlly", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.employersAllyTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["EmployerAlly"].Add(lanceOverride.Copy());
}
ContractOverrideLanceOverrideBackup.Add("EmployerAlly", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.employersAllyTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["EmployerAlly"].Add(lanceOverride.Copy());
}

ContractOverrideLanceOverrideBackup.Add("Target", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.targetTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["Target"].Add(lanceOverride.Copy());
}
ContractOverrideLanceOverrideBackup.Add("Target", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.targetTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["Target"].Add(lanceOverride.Copy());
}

ContractOverrideLanceOverrideBackup.Add("TargetAlly", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.targetsAllyTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["TargetAlly"].Add(lanceOverride.Copy());
}
ContractOverrideLanceOverrideBackup.Add("TargetAlly", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.targetsAllyTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["TargetAlly"].Add(lanceOverride.Copy());
}

ContractOverrideLanceOverrideBackup.Add("NeutralToAll", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.neutralToAllTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["NeutralToAll"].Add(lanceOverride.Copy());
}
ContractOverrideLanceOverrideBackup.Add("NeutralToAll", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.neutralToAllTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["NeutralToAll"].Add(lanceOverride.Copy());
}

ContractOverrideLanceOverrideBackup.Add("HostileToAll", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.hostileToAllTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["HostileToAll"].Add(lanceOverride.Copy());
}
ContractOverrideLanceOverrideBackup.Add("HostileToAll", new List<LanceOverride>());
foreach (LanceOverride lanceOverride in MissionControl.Instance.CurrentContract.Override.hostileToAllTeam.lanceOverrideList) {
ContractOverrideLanceOverrideBackup["HostileToAll"].Add(lanceOverride.Copy());
}

// Objective Overrides
ContractOverrideObjectiveOverrideBackup = new List<ObjectiveOverride>();
foreach (ObjectiveOverride objectiveOverride in MissionControl.Instance.CurrentContract.Override.objectiveList) {
ContractOverrideObjectiveOverrideBackup.Add(objectiveOverride.Copy());
// Objective Overrides
ContractOverrideObjectiveOverrideBackup = new List<ObjectiveOverride>();
foreach (ObjectiveOverride objectiveOverride in MissionControl.Instance.CurrentContract.Override.objectiveList) {
ContractOverrideObjectiveOverrideBackup.Add(objectiveOverride.Copy());
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/Core/MissionControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ public void SetContract(Contract contract) {
Main.Logger.Log($"[MissionControl] Setting contract '{contract.Name}' for contract type '{contract.ContractTypeValue.Name}'");
CurrentContract = contract;
Metrics = new Metrics();
DataManager.Instance.BackupContractOverriddeData();

if (AllowMissionControl()) {
Main.Logger.Log($"[MissionControl] Mission Control IS allowed to run. ");
Expand All @@ -213,8 +214,6 @@ public void SetContract(Contract contract) {

IsMCLoadingFinished = false;

DataManager.Instance.BackupContractOverriddeData();

SetActiveAdditionalLances(contract);
Main.Logger.Log($"[MissionControl] Contract map is '{contract.mapName}'");
ContractMapName = contract.mapName;
Expand Down
2 changes: 1 addition & 1 deletion src/MissionControl.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.5.0</Version>
<Version>1.5.1</Version>
<OutputType>Library</OutputType>
<TargetFramework>net471</TargetFramework>
</PropertyGroup>
Expand Down

0 comments on commit 646e438

Please sign in to comment.