Skip to content

Commit

Permalink
fixed cargo module not working as intended
Browse files Browse the repository at this point in the history
  • Loading branch information
rheirman committed Apr 20, 2019
1 parent dc87122 commit 7badffa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Binary file modified Assemblies/WhatTheHack.dll
Binary file not shown.
5 changes: 5 additions & 0 deletions Source/WhatTheHack/Harmony/HediffStatsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public static IEnumerable<StatDrawEntry> SpecialDisplayStats(HediffStage stage,
yield return new StatDrawEntry(StatCategoryDefOf.PawnCombat, StatDefOf.MeleeWeapon_CooldownMultiplier.label, modExt.firingRateOffset.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Offset), 0);
yield return new StatDrawEntry(StatCategoryDefOf.PawnCombat, StatDefOf.AimingDelayFactor.label, modExt.firingRateOffset.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Offset), 0);
}

if(modExt.carryingCapacityOffset != 0)
{
yield return new StatDrawEntry(StatCategoryDefOf.Basics, StatDefOf.CarryingCapacity.label, modExt.carryingCapacityOffset.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Offset),0);
}
}
}
}
Expand Down
21 changes: 20 additions & 1 deletion Source/WhatTheHack/Harmony/MassUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,29 @@ static void Postfix(Pawn p, ref StringBuilder explanation, ref float __result)
bonus += p.def.GetModExtension<DefModExtension_PawnMassCapacity>().bonusMassCapacity;
}
__result += bonus;
float offset = 0;
if(explanation == null)
{
explanation = new StringBuilder();
}
if (explanation != null && bonus > 0)
{
explanation.AppendLine();
explanation.AppendLine("- " + p.def.label + ": " + bonus.ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset));
}
if (p.health != null && p.health.hediffSet != null)
{
foreach (Hediff h in p.health.hediffSet.hediffs)
{
if (h.def.GetModExtension<DefModextension_Hediff>() is DefModextension_Hediff modExt && modExt.carryingCapacityOffset != 0)
{
explanation.AppendLine();
explanation.AppendLine("- " + h.def.label + ": " + modExt.carryingCapacityOffset.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Offset));
offset += modExt.carryingCapacityOffset;
}
}
}
__result += offset * __result;

}
}
}

0 comments on commit 7badffa

Please sign in to comment.