예제 #1
0
        public void SpecialPostAdd(DamageInfo?dinfo)
        {
            base.CompPostPostAdd(dinfo);

            this.parent.pawn.health.RestorePart(this.parent.Part, this.parent, false);
            for (int i = 0; i < this.parent.Part.parts.Count; i++)
            {
                if (this.parent.Part.Index == 1)
                {
                    Hediff_MissingPart hediff_MissingPart = (Hediff_MissingPart)HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, this.parent.pawn, null);
                    hediff_MissingPart.IsFresh    = true;
                    hediff_MissingPart.lastInjury = HediffDefOf.SurgicalCut;
                    hediff_MissingPart.Part       = this.parent.Part.parts[i];
                    this.parent.pawn.health.hediffSet.AddDirect(hediff_MissingPart, null, null);
                }
                else if (this.Props.generateModule)
                {
                    HediffWithComps hediff_BodyPartModule = (HediffWithComps)HediffMaker.MakeHediff(MSE_HediffDefOf.MSE_BodyPartModule, this.parent.pawn, null);
                    hediff_BodyPartModule.Part = this.parent.Part.parts[i];
                    this.parent.pawn.health.hediffSet.AddDirect(hediff_BodyPartModule, null, null);
                }
            }

            MSE_VanillaExtender.HediffApplyHediffs(this.parent, this.parent.pawn, this.parent.Part);
        }
        public override void PostAdd(DamageInfo?dinfo)
        {
            if (base.Part == null)
            {
                Log.Error("Part is null. It should be set before PostAdd for " + this.def + ".", false);
                return;
            }

            this.pawn.health.RestorePart(base.Part, this, false);
            for (int i = 0; i < base.Part.parts.Count; i++)
            {
                if (base.Part.Index == 1)
                {
                    Hediff_MissingPart hediff_MissingPart = (Hediff_MissingPart)HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, this.pawn, null);
                    hediff_MissingPart.IsFresh    = true;
                    hediff_MissingPart.lastInjury = HediffDefOf.SurgicalCut;
                    hediff_MissingPart.Part       = base.Part.parts[i];
                    this.pawn.health.hediffSet.AddDirect(hediff_MissingPart, null, null);
                }
                else
                {
                    Hediff_BodyPartModule hediff_BodyPartModule = (Hediff_BodyPartModule)HediffMaker.MakeHediff(MSE_HediffDefOf.MSE_BodyPartModule, this.pawn, null);
                    hediff_BodyPartModule.Part = base.Part.parts[i];
                    this.pawn.health.hediffSet.AddDirect(hediff_BodyPartModule, null, null);
                }
            }

            MSE_VanillaExtender.HediffApplyHediffs(this, this.pawn, base.Part);
        }
예제 #3
0
        public void SpecialPostAdd(DamageInfo?dinfo)
        {
            base.CompPostPostAdd(dinfo);

            this.parent.pawn.health.RestorePart(this.parent.Part, this.parent, false);
            for (int i = 0; i < this.parent.Part.parts.Count; i++)
            {
                HediffWithComps hediff_BodyPartModule = (HediffWithComps)HediffMaker.MakeHediff(MSE_HediffDefOf.MSE_BodyPartModule, this.parent.pawn, null);
                hediff_BodyPartModule.Part = this.parent.Part.parts[i];
                this.parent.pawn.health.hediffSet.AddDirect(hediff_BodyPartModule, null, null);
            }

            MSE_VanillaExtender.HediffApplyHediffs(this.parent, this.parent.pawn, this.parent.Part);
        }
예제 #4
0
        public override void PostAdd(DamageInfo?dinfo)
        {
            if (base.Part == null)
            {
                Log.Error("Part module is null. It should be set before PostAdd for " + this.def + ".", false);
                return;
            }

            this.pawn.health.RestorePart(base.Part, this, false);
            for (int i = 0; i < base.Part.parts.Count; i++)
            {
                Hediff_BodyPartModule hediff_BodyPartModule = (Hediff_BodyPartModule)HediffMaker.MakeHediff(MSE_HediffDefOf.MSE_BodyPartModule, this.pawn, null);
                hediff_BodyPartModule.Part = base.Part.parts[i];
                this.pawn.health.hediffSet.AddDirect(hediff_BodyPartModule, null, null);
            }

            MSE_VanillaExtender.HediffApplyHediffs(this, this.pawn, base.Part);
        }
예제 #5
0
        public override IEnumerable <Gizmo> CompGetGizmos()
        {
            Command_Toggle painstopper = new Command_Toggle
            {
                isActive     = (() => this.Painstopper),
                toggleAction = delegate()
                {
                    this.Painstopper = !this.Painstopper;
                },
                defaultLabel = this.Props.label,
                defaultDesc  = this.Props.description.CapitalizeFirst(),
                icon         = MSE_VanillaExtender.GetIcon(base.Pawn.GetUniqueLoadID() + "_" + this.parent.GetUniqueLoadID(), this.Props.uiIconPath)
            };

            if (base.Pawn.Faction != Faction.OfPlayer)
            {
                painstopper.Disable("CannotOrderNonControlled".Translate());
            }
            if (base.Pawn.Downed)
            {
                painstopper.Disable("IsIncapped".Translate(base.Pawn.LabelShort, base.Pawn));
            }
            yield return(painstopper);
        }
예제 #6
0
        public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
        {
            for (int i = 0; i < recipe.appliedOnFixedBodyParts.Count; i++)
            {
                BodyPartDef           part   = recipe.appliedOnFixedBodyParts[i];
                List <BodyPartRecord> bpList = pawn.RaceProps.body.AllParts;
                for (int j = 0; j < bpList.Count; j++)
                {
                    BodyPartRecord record = bpList[j];
                    if (record.def == part)
                    {
                        if (pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null).Contains(record))
                        {
                            var implants = pawn.health.hediffSet.hediffs
                                           .Where(d => d.Part == record && d is Hediff_Implant && d.Visible);
                            if (implants.Count() == 3 && pawn.health.hediffSet.HasDirectlyAddedPartFor(record))
                            {
                                yield break;
                            }

                            MSE_ImplantSystem implantSystem = recipe.GetModExtension <MSE_ImplantSystem>();
                            if (implantSystem != null && implantSystem.isSpecial)
                            {
                                if (pawn.health.hediffSet.HasDirectlyAddedPartFor(record) && !MSE_VanillaExtender.PartHasAdvancedImplantSystem(pawn, record))
                                {
                                    yield break;
                                }
                            }

                            if (!pawn.health.hediffSet.hediffs.Any((Hediff x) => x.Part == record && x.def == recipe.addsHediff))
                            {
                                yield return(record);
                            }
                        }
                    }
                }
            }
            yield break;
        }
예제 #7
0
 public override void CompPostPostRemoved()
 {
     base.CompPostPostRemoved();
     MSE_VanillaExtender.ClearIcon(base.Pawn.GetUniqueLoadID() + "_" + this.parent.GetUniqueLoadID());
 }