public AddedBodyPartPropsStats(AddedBodyPartProps p) { this.partEfficiency = p.partEfficiency; this.solid = p.solid; this.isGoodWeapon = p.isGoodWeapon; this.betterThanNatural = p.betterThanNatural; }
private static void CheckPart(List <BodyPartRecord> body, Hediff hediff, [CanBeNull] CompFace face, [CanBeNull] CompBodyAnimator anim, bool missing) { if (body.NullOrEmpty() || hediff.def == null) { Log.Message("Body list or hediff.def is null or empty"); return; } if (!hediff.Visible) { return; } BodyPartRecord leftEye = body.Find(x => x.def == BodyPartDefOf.Eye && x.customLabel.Contains("left")); BodyPartRecord rightEye = body.Find(x => x.def == BodyPartDefOf.Eye && x.customLabel.Contains("right")); BodyPartRecord jaw = body.Find(x => x.def == BodyPartDefOf.Jaw); //BodyPartRecord leftArm = body.Find(x => x.def == BodyPartDefOf.LeftArm); //BodyPartRecord rightArm = body.Find(x => x.def == DefDatabase<BodyPartDef>.GetNamed("RightShoulder")); BodyPartRecord leftHand = body.Find(x => x.def == BodyPartDefOf.Hand && x.customLabel.Contains("left")); BodyPartRecord rightHand = body.Find(x => x.def == BodyPartDefOf.Hand && x.customLabel.Contains("right")); BodyPartRecord leftFoot = body.Find(x => x.def == DefDatabase <BodyPartDef> .GetNamed("Foot") && x.customLabel.Contains("left")); BodyPartRecord rightFoot = body.Find(x => x.def == DefDatabase <BodyPartDef> .GetNamed("Foot") && x.customLabel.Contains("right")); if (missing) { CheckMissingParts(new BodyProps(hediff, face, anim, leftEye, rightEye, leftHand, rightHand, leftFoot, rightFoot)); return; } // Missing parts first, hands and feet can be replaced by arms/legs // Log.Message("Checking missing parts."); AddedBodyPartProps addedPartProps = hediff.def?.addedPartProps; if (addedPartProps == null) { // Log.Message("No added parts found."); return; } if (hediff.def?.defName == null) { return; } // Log.Message("Checking face for added parts."); if (anim != null && anim.Pawn.RaceProps.Humanlike && face != null) { CheckFaceForAddedParts(hediff, face, leftEye, rightEye, jaw); } // Log.Message("Checking body for added parts."); CheckBodyForAddedParts(hediff, anim, leftHand, rightHand, leftFoot, rightFoot); }
public AddedBodyPartPropsWidget(AddedBodyPartProps addedBodyPartProps) { this.inputWidgets = new List <IInputWidget>() { new FloatInputWidget <AddedBodyPartProps>(addedBodyPartProps, "Part Efficiency", p => p.partEfficiency, (p, v) => p.partEfficiency = v), new BoolInputWidget <AddedBodyPartProps>(addedBodyPartProps, "Solid", p => p.solid, (p, v) => p.solid = v), new BoolInputWidget <AddedBodyPartProps>(addedBodyPartProps, "Is Good Weapon", p => p.isGoodWeapon, (p, v) => p.isGoodWeapon = v), new BoolInputWidget <AddedBodyPartProps>(addedBodyPartProps, "Better Than Natural", p => p.betterThanNatural, (p, v) => p.betterThanNatural = v), }; }
protected override ThoughtState CurrentStateInternal(Pawn p) { List <Hediff> hediffs = p.health.hediffSet.hediffs; for (int i = 0; i < hediffs.Count; i++) { AddedBodyPartProps addedPartProps = hediffs[i].def.addedPartProps; if (addedPartProps != null && addedPartProps.isBionic) { return(true); } } return(false); }
private static void CheckPart(List <BodyPartRecord> body, Hediff hediff, [CanBeNull] CompFace face, [CanBeNull] CompBodyAnimator anim) { if (body.NullOrEmpty() || hediff.def == null) { return; } if (!hediff.Visible) { return; } BodyPartRecord leftEye = body.Find(x => x.def == BodyPartDefOf.LeftEye); BodyPartRecord rightEye = body.Find(x => x.def == BodyPartDefOf.RightEye); BodyPartRecord jaw = body.Find(x => x.def == BodyPartDefOf.Jaw); BodyPartRecord leftArm = body.Find(x => x.def == BodyPartDefOf.LeftArm); BodyPartRecord rightArm = body.Find(x => x.def == DefDatabase <BodyPartDef> .GetNamed("RightShoulder")); BodyPartRecord leftHand = body.Find(x => x.def == DefDatabase <BodyPartDef> .GetNamed("LeftShoulder")); BodyPartRecord rightHand = body.Find(x => x.def == BodyPartDefOf.RightHand); BodyPartRecord leftLeg = body.Find(x => x.def == BodyPartDefOf.LeftLeg); BodyPartRecord rightLeg = body.Find(x => x.def == BodyPartDefOf.RightLeg); BodyPartRecord leftFoot = body.Find(x => x.def == DefDatabase <BodyPartDef> .GetNamed("LeftFoot")); BodyPartRecord rightFoot = body.Find(x => x.def == DefDatabase <BodyPartDef> .GetNamed("RightFoot")); // Missing parts first, hands and feet can be replaced by arms/legs CheckMissingParts(hediff, face, anim, leftEye, rightEye, leftHand, rightHand, leftFoot, rightFoot); AddedBodyPartProps addedPartProps = hediff.def?.addedPartProps; if (addedPartProps == null) { return; } if (hediff.def?.defName == null || hediff.Part.parts.NullOrEmpty()) { return; } CheckFace(hediff, face, leftEye, rightEye, jaw); CheckBody(hediff, anim, leftHand, rightHand, leftFoot, rightFoot); }