Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Killface1980 committed Jan 11, 2017
1 parent ee2e15e commit 4ca4d39
Show file tree
Hide file tree
Showing 13 changed files with 140 additions and 146 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ModMetaData>
<name>Outfitter 0.16.0.1</name>
<name>Outfitter 0.16.0.2</name>
<author>Killface</author>
<url></url>
<targetVersion>0.16.1386</targetVersion>
Expand Down
Binary file modified Assemblies/Outfitter.dll
Binary file not shown.
Binary file modified Source/.vs/Outfitter/v14/.suo
Binary file not shown.
33 changes: 22 additions & 11 deletions Source/Outfitter/ApparelStatCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public float ApparelScoreRaw(Apparel apparel, Pawn pawn)
equippedOffsets.Add(equippedStatOffset.stat);
}
}

HashSet<StatDef> statBases = new HashSet<StatDef>();
if (apparel.def.statBases != null)
{
Expand Down Expand Up @@ -274,6 +274,8 @@ public float ApparelScoreRaw(Apparel apparel, Pawn pawn)

}

score += apparel.GetSpecialApparelScoreOffset();

score += ApparelScoreRaw_Temperature(apparel, pawn);

score += 0.05f * ApparelScoreRaw_ProtectionBaseStat(apparel);
Expand All @@ -282,10 +284,16 @@ public float ApparelScoreRaw(Apparel apparel, Pawn pawn)
if (apparel.def.useHitPoints)
{
float x = apparel.HitPoints / (float)apparel.MaxHitPoints;
score = score * 0.15f + score * 0.85f * ApparelStatsHelper.HitPointsPercentScoreFactorCurve.Evaluate(x);
score = score * 0.25f + score * 0.75f * ApparelStatsHelper.HitPointsPercentScoreFactorCurve.Evaluate(x);
}
if (apparel.WornByCorpse)
{
score -= 0.5f;
if (score > 0f)
{
score *= 0.1f;
}
}


return score;
}

Expand Down Expand Up @@ -353,7 +361,7 @@ public float ApparelScoreRaw_Temperature(Apparel apparel, Pawn pawn)
DoApparelScoreRaw_PawnStatsHandlers(_pawn, apparel, StatDefOf.ComfyTemperatureMax, ref insulationHeat);

// if this gear is currently worn, we need to make sure the contribution to the pawn's comfy temps is removed so the gear is properly scored
//if (pawn.apparel.WornApparel.Contains(apparel))
if (pawn.apparel.WornApparel.Contains(apparel))
{
List<Apparel> wornApparel = pawn.apparel.WornApparel;

Expand All @@ -376,8 +384,8 @@ public float ApparelScoreRaw_Temperature(Apparel apparel, Pawn pawn)
}
}

//minComfyTemperature -= insulationCold;
//maxComfyTemperature -= insulationHeat;
minComfyTemperature -= insulationCold;
maxComfyTemperature -= insulationHeat;
}

// now for the interesting bit.
Expand Down Expand Up @@ -530,11 +538,11 @@ public void UpdateTemperatureIfNecessary(bool force = false, bool forceweight =
pawnSave.TargetTemperatures = new FloatRange(Math.Max(temp - 7.5f, ApparelStatsHelper.MinMaxTemperatureRange.min),
Math.Min(temp + 7.5f, ApparelStatsHelper.MinMaxTemperatureRange.max));

if (pawnSave.TargetTemperatures.min >= 10)
pawnSave.TargetTemperatures.min = 10;
if (pawnSave.TargetTemperatures.min >= 12)
pawnSave.TargetTemperatures.min = 12;

if (pawnSave.TargetTemperatures.max <= 20)
pawnSave.TargetTemperatures.max = 20;
if (pawnSave.TargetTemperatures.max <= 32)
pawnSave.TargetTemperatures.max = 32;

_lastTempUpdate = Find.TickManager.TicksGame;
}
Expand Down Expand Up @@ -784,6 +792,9 @@ private bool CalculateApparelScoreGain(Apparel apparel, float score, out float c
}
}

candidateScore += apparel.GetSpecialApparelScoreOffset();


// increase score if this piece can be worn without replacing existing gear.
if (!willReplace)
{
Expand Down
Loading

0 comments on commit 4ca4d39

Please sign in to comment.