(02db081a3) Fixed treatment suggestions not working correctly for some items because they were using incorrect affliction identifiers (there's no affliction with the identifier "damage"). Now the treatments can be defined using either the identifier or type of the affliction.
This commit is contained in:
@@ -60,8 +60,8 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
divingGearObjective = null;
|
||||
// Reduce the timer so that we get a safe hull target faster.
|
||||
searchHullTimer = Math.Min(1, searchHullTimer);
|
||||
// Reset the timer so that we get a safe hull target.
|
||||
searchHullTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -615,10 +615,25 @@ namespace Barotrauma
|
||||
|
||||
string treatmentIdentifier = subElement.GetAttributeString("identifier", "").ToLowerInvariant();
|
||||
|
||||
var matchingAffliction = AfflictionPrefab.List.Find(a => a.Identifier == treatmentIdentifier);
|
||||
if (matchingAffliction != null)
|
||||
List<AfflictionPrefab> matchingAfflictions = AfflictionPrefab.List.FindAll(a => a.Identifier == treatmentIdentifier || a.AfflictionType == treatmentIdentifier);
|
||||
if (matchingAfflictions.Count == 0)
|
||||
{
|
||||
matchingAffliction.TreatmentSuitability.Add(identifier, subElement.GetAttributeFloat("suitability", 0.0f));
|
||||
DebugConsole.ThrowError("Error in item prefab \"" + Name + "\" - couldn't define as a treatment, no treatments with the identifier or type \"" + treatmentIdentifier + "\" were found.");
|
||||
continue;
|
||||
}
|
||||
|
||||
float suitability = subElement.GetAttributeFloat("suitability", 0.0f);
|
||||
foreach (AfflictionPrefab matchingAffliction in matchingAfflictions)
|
||||
{
|
||||
if (matchingAffliction.TreatmentSuitability.ContainsKey(identifier))
|
||||
{
|
||||
matchingAffliction.TreatmentSuitability[identifier] =
|
||||
Math.Max(matchingAffliction.TreatmentSuitability[identifier], suitability);
|
||||
}
|
||||
else
|
||||
{
|
||||
matchingAffliction.TreatmentSuitability.Add(identifier, suitability);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user