/// <summary> /// Set parameter targInf to thing's CompInfusion's infusions. Set targInf to null when there is no CompInfusion, or the comp is not infused. /// </summary> /// <param name="thing"></param> /// <param name="targInf"></param> /// <returns></returns> public static bool TryGetInfusions(this Thing thing, out InfusionSet targInf) { var comp = thing.TryGetComp <CompInfusion>(); if (comp == null) { targInf = InfusionSet.Empty; return(false); } targInf = comp.Infusions; return(comp.Infused); }
private string WriteExplanation(Thing thing, InfusionSet infusions) { var result = new StringBuilder(); if (infusions.prefix != null) { result.Append(WriteExplanationDetail(thing, infusions.prefix.defName)); } if (infusions.suffix != null) { result.Append(WriteExplanationDetail(thing, infusions.suffix.defName)); } return(result.ToString()); }
private void TransformValue(InfusionSet inf, ref float val) { StatMod mod; var prefix = inf.prefix; var suffix = inf.suffix; if (prefix != null && prefix.TryGetStatValue(parentStat, out mod)) { val += mod.offset; val *= mod.multiplier; } if (suffix != null && suffix.TryGetStatValue(parentStat, out mod)) { val += mod.offset; val *= mod.multiplier; } }