Beispiel #1
0
        /*
         * public void BodyCheck(HediffSet hediffSet)
         * {
         *  //var list = hediffSet.hediffs.FindAll(x => x.Part != null && x.Part.IsInGroup(racomp.torsoDef.linkedBodyGroup));
         *  var list = hediffSet.hediffs.FindAll(x => x.Part == null && racomp.torsoDef.linkedBodyGroup == null || x.Part != null && x.Part.IsInGroup(racomp.torsoDef.linkedBodyGroup));
         *  if (racomp.torsoDef.bodyPath.customs.FindAll(x => list.Any(y => y.def == x.hediffDef)) is var list2 && list2.Count > 0)
         *  {
         *      list2.Sort((x, y) => y.priority - x.priority);
         *      if (list2[0].hediffDef != lastBodyHediffDef)
         *      {
         *          ResolveAllGraphics.RenewalBodyGraphic(pawn.Drawer.renderer.graphics, list2[0].path, racomp.torsoDef.shaderType.Shader, racomp, (pawn.def as RaceAddonThingDef).raceAddonSettings.graphicSetting.rottingColor);
         *          lastBodyHediffDef = list2[0].hediffDef;
         *      }
         *  }
         * }
         *
         * public void HeadCheck(HediffSet hediffSet)
         * {
         *  //var list = hediffSet.hediffs.FindAll(x => x.Part != null && x.Part.IsInGroup(racomp.torsoDef.linkedHeadGroup));
         *  var list = hediffSet.hediffs.FindAll(x => x.Part == null && racomp.torsoDef.linkedHeadGroup == null || x.Part != null && x.Part.IsInGroup(racomp.torsoDef.linkedHeadGroup));
         *  if (racomp.torsoDef.headPath.customs.FindAll(x => list.Any(y => y.def == x.hediffDef)) is var list2 && list2.Count > 0)
         *  {
         *      list2.Sort((x, y) => y.priority - x.priority);
         *      if (list2[0].hediffDef != lastHeadHediffDef)
         *      {
         *          ResolveAllGraphics.RenewalHeadGraphic(pawn.Drawer.renderer.graphics, list2[0].path, racomp.torsoDef.shaderType.Shader, racomp, (pawn.def as RaceAddonThingDef).raceAddonSettings.graphicSetting.rottingColor);
         *          lastHeadHediffDef = list2[0].hediffDef;
         *      }
         *  }
         * }
         */
        public void TorsoCheck(HediffSet hediffSet)
        {
            if (racomp.torsoDef.headPath.customs.FindAll(x => hediffSet.HasHediff(x.hediffDef, null)) is var headList && headList.Count > 0)
            {
                headList.Sort((x, y) => y.priority - x.priority);
                if (headList[0].hediffDef != lastHeadHediffDef)
                {
                    ResolveAllGraphics.RenewalHeadGraphic(pawn.Drawer.renderer.graphics, headList[0].path, racomp.torsoDef.shaderType.Shader, racomp, (pawn.def as RaceAddonThingDef).raceAddonSettings.graphicSetting.rottingColor);
                    lastHeadHediffDef = headList[0].hediffDef;
                }
            }
            if (racomp.torsoDef.bodyPath.customs.FindAll(x => hediffSet.HasHediff(x.hediffDef, null)) is var bodyList && bodyList.Count > 0)
            {
                bodyList.Sort((x, y) => y.priority - x.priority);
                if (bodyList[0].hediffDef != lastBodyHediffDef)
                {
                    ResolveAllGraphics.RenewalHeadGraphic(pawn.Drawer.renderer.graphics, bodyList[0].path, racomp.torsoDef.shaderType.Shader, racomp, (pawn.def as RaceAddonThingDef).raceAddonSettings.graphicSetting.rottingColor);
                    lastBodyHediffDef = bodyList[0].hediffDef;
                }
            }
            var injuredParts = hediffSet.GetInjuredParts();

            bodyDamaged = injuredParts.Any(x => x.IsInGroup(racomp.torsoDef.linkedBodyGroup));
            headDamaged = injuredParts.Any(x => x.IsInGroup(racomp.torsoDef.linkedHeadGroup));
        }
Beispiel #2
0
 public void Check(HediffSet hediffSet)
 {
     if (!hediffSet.HasHediff(custom.First?.hediffDef, linkedBodyPart))
     {
         custom        = new Pair <CustomPath, Graphic>();
         customRotting = new Pair <CustomPath, Graphic>();
         Update(hediffSet);
     }
     if (partDamaged && linkedBodyPart != null)
     {
         partDamaged = hediffSet.GetInjuredParts().Contains(linkedBodyPart);
     }
 }
Beispiel #3
0
 public void Update(HediffSet hediffSet)
 {
     foreach (var custom in data.addonDef.addonPath.customs)
     {
         if (hediffSet.HasHediff(custom.hediffDef, linkedBodyPart) && (this.custom.First == null || custom.priority > this.custom.First.priority))
         {
             this.custom   = new Pair <CustomPath, Graphic>(custom, custom.path.GetGraphic(normal.Shader, normal.Color, normal.ColorTwo));
             customRotting = new Pair <CustomPath, Graphic>(custom, custom.path.GetGraphic(normalRotting.Shader, normalRotting.Color, normalRotting.ColorTwo));
             break;
         }
     }
     if (linkedBodyPart != null)
     {
         partDamaged = hediffSet.GetInjuredParts().Contains(linkedBodyPart);
     }
 }