public override void CompPostPostAdd(DamageInfo?dinfo) { Pawn pawn = this.parent.pawn; if (pawn.def is RimValiRaceDef def) { colorComp colorComp = pawn.GetComp <colorComp>(); foreach (string set in colorComp.colors.Keys) { if (Props.targetsSpecifcSets == true && Props.setsToChange.Contains(set)) { if (colorComp.colors[set].dyeable) { oldColors.Add(set, new ColorSet(colorComp.colors[set].colorOne, colorComp.colors[set].colorTwo, colorComp.colors[set].colorThree, colorComp.colors[set].dyeable)); if (Props.changesFirstColor) { colorComp.colors[set].colorOne = Props.colors.firstColor.NewRandomizedColor(); } if (Props.changesSecondColor) { colorComp.colors[set].colorTwo = Props.colors.secondColor.NewRandomizedColor(); } if (Props.changesThirdColor) { colorComp.colors[set].colorThree = Props.colors.thirdColor.NewRandomizedColor(); } } } else if (Props.targetsSpecifcSets != true) { if (colorComp.colors[set].dyeable) { oldColors.Add(set, new ColorSet(colorComp.colors[set].colorOne, colorComp.colors[set].colorTwo, colorComp.colors[set].colorThree, colorComp.colors[set].dyeable)); if (Props.changesFirstColor) { colorComp.colors[set].colorOne = Props.colors.firstColor.NewRandomizedColor(); } if (Props.changesSecondColor) { colorComp.colors[set].colorTwo = Props.colors.secondColor.NewRandomizedColor(); } if (Props.changesThirdColor) { colorComp.colors[set].colorThree = Props.colors.thirdColor.NewRandomizedColor(); } } } } PawnRenderer render = new PawnRenderer(pawn); render.graphics.ResolveAllGraphics(); } }
public override void CompPostPostRemoved() { Pawn pawn = this.parent.pawn; if (pawn.def is RimValiRaceDef def) { colorComp colorComp = pawn.GetComp <colorComp>(); colorComp.colors = oldColors; } base.CompPostPostRemoved(); }
public int GetMyIndex(Pawn pawn) { if (pawn.def is RimValiRaceDef) { colorComp comp = pawn.TryGetComp <colorComp>(); foreach (string str in comp.renderableDefIndexes.Keys) { if (str == defName || (linkIndexWithDef != null && linkIndexWithDef.defName == str)) { return(comp.renderableDefIndexes[str]); } } } return(0); }