Describe the problem
The end-of-mission salvage screen only has seven slots for priority salvage, and thus if a contract rewards eight or more pieces of priority salvage, the player is unable to continue past this screen and is forced into reloading a save from before contract was negotiated. A picture of this situation occurring is here.
Using the default values from SimGameConstants.json -- "MaxSalvagePotential": 32 and "PrioritySalvageModifier": 0.25, this could potentially affect the vanilla game (i.e .25 * 32 = 8), though I've never seen a contract reward more than 6 pieces of priority salvage. Modding these values or more importantly the contracts themselves easily makes this number very achievable.
There are two approaches to fixing this issue:
Prevent contracts from rewarding more than 7 pieces of priority salvage
Add additional slots for priority salvage (perhaps by adding a scrollbar)
Since without the Unity project or perhaps an in-depth knowledge of how to affect UI at runtime, I will work through the first solution.
Provide an example of the code where the problem occurs
Salvage appears to be calculated in several spots. The one that controls the actual salvage generated on mission end is the property Contract.FinalPrioritySalvageCount set in Contract.GenerateSalvage.
There are several places in the UI where it is also calculated.
On contract display in SGContractsListItem.Init
On contract negotiation in SGContractsWidget.PopulateContract and SGContractsWidget.UpdateCurrentValues
Displayed in Briefing.SetContractInfo and LanceContractDetailsWidget.PopulateContract
Interestingly enough, all of the UI calculations do not use the correct value PrioritySalvageModifier, they all instead incorrectly divide by 4 instead, leading to the wrong salvage results displayed if PrioritySalvageModifier is changed.
This is SGContractsListItem.Init's handling of salvage calculation, which is representative of the other UI calculations:
int num = contract.SalvagePotential + this.simState.Constants.Finances.ContractFloorSalvageBonus;
int num2 = Mathf.FloorToInt((float)num / 4f);
this.setFieldText(this.contractMaxSalvage, string.Format("{0} / {1}", num2, num));
int num3 = Mathf.FloorToInt(contract.Override.negotiatedSalvage * (float)contract.SalvagePotential) + this.simState.Constants.Finances.ContractFloorSalvageBonus;
int num4 = Mathf.FloorToInt((float)num3 / 4f);
this.setFieldText(this.contractSalvage, string.Format("{0} / {1}", num4, num3));
Provide an example of your proposed solution
Modify Contract.FinalPrioritySalvageCount set in Contract.GenerateSalvage to:
Modify all UI references to match, example of new SGContractsListItem.Init:
int num = contract.SalvagePotential + this.simState.Constants.Finances.ContractFloorSalvageBonus;
int num2 = Math.Min(7, Mathf.FloorToInt((float)num * sim.Constants.Salvage.PrioritySalvageModifier));
this.setFieldText(this.contractMaxSalvage, string.Format("{0} / {1}", num2, num));
int num3 = Mathf.FloorToInt(contract.Override.negotiatedSalvage * (float)contract.SalvagePotential) + this.simState.Constants.Finances.ContractFloorSalvageBonus;
int num4 = Math.Min(7, Mathf.FloorToInt((float)num3 * sim.Constants.Salvage.PrioritySalvageModifier));
this.setFieldText(this.contractSalvage, string.Format("{0} / {1}", num4, num3));
Leave any additional comments here
Obviously, the proposed solution is a stopgap to provide for a UI problem, though in doing so, a problem with UI calculations of salvage was revealed. Fixing the UI to allow for arbitrary numbers of priority salvage might also not be feasible as well, in which this solution would work.
Describe the problem The end-of-mission salvage screen only has seven slots for priority salvage, and thus if a contract rewards eight or more pieces of priority salvage, the player is unable to continue past this screen and is forced into reloading a save from before contract was negotiated. A picture of this situation occurring is here.
Using the default values from
SimGameConstants.json
--"MaxSalvagePotential": 32
and"PrioritySalvageModifier": 0.25
, this could potentially affect the vanilla game (i.e.25 * 32 = 8
), though I've never seen a contract reward more than 6 pieces of priority salvage. Modding these values or more importantly the contracts themselves easily makes this number very achievable.There are two approaches to fixing this issue:
Since without the Unity project or perhaps an in-depth knowledge of how to affect UI at runtime, I will work through the first solution.
Provide an example of the code where the problem occurs Salvage appears to be calculated in several spots. The one that controls the actual salvage generated on mission end is the property
Contract.FinalPrioritySalvageCount
set inContract.GenerateSalvage
.There are several places in the UI where it is also calculated.
SGContractsListItem.Init
SGContractsWidget.PopulateContract
andSGContractsWidget.UpdateCurrentValues
Briefing.SetContractInfo
andLanceContractDetailsWidget.PopulateContract
Interestingly enough, all of the UI calculations do not use the correct value
PrioritySalvageModifier
, they all instead incorrectly divide by 4 instead, leading to the wrong salvage results displayed ifPrioritySalvageModifier
is changed.This is
SGContractsListItem.Init
's handling of salvage calculation, which is representative of the other UI calculations:Provide an example of your proposed solution Modify
Contract.FinalPrioritySalvageCount
set inContract.GenerateSalvage
to:Modify all UI references to match, example of new
SGContractsListItem.Init
:Leave any additional comments here Obviously, the proposed solution is a stopgap to provide for a UI problem, though in doing so, a problem with UI calculations of salvage was revealed. Fixing the UI to allow for arbitrary numbers of priority salvage might also not be feasible as well, in which this solution would work.