Ejemplo n.º 1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOn(delegate
            {
                return(pawn == Victim);
            });
            this.FailOnAggroMentalState(TargetIndex.A);
            foreach (Toil t in JobDriver_Feed.MakeFeedToils(job.def, this, GetActor(), TargetA, null, null, workLeft, DoEffect, ShouldContinueFeeding, true, false))
            {
                yield return(t);
            }
            yield return(new Toil()
            {
                initAction = delegate()
                {
                    Pawn p = (Pawn)TargetA;
                    if (!p.Dead)
                    {
                        p.Kill(null);
                    }
                    ;
                    job.SetTarget(TargetIndex.A, p.Corpse);
                    pawn.Reserve(TargetA, job);
                }
            });

            yield return(Toils_Misc.ThrowColonistAttackingMote(TargetIndex.A));

            yield return(Toils_General.WaitWith(TargetIndex.A, 600, true));

            yield return(new Toil()
            {
                initAction = delegate()
                {
                    VampireCorpse vampCorpse = (VampireCorpse)TargetA.Thing;
                    vampCorpse.Diableried = true;
                    Pawn p = vampCorpse.InnerPawn;
                    pawn.VampComp().Notify_Diablerie(p.VampComp());
                }
            });
        }
Ejemplo n.º 2
0
        // Verse.Pawn
        public static bool Vamp_MakeCorpse(Pawn __instance, Building_Grave assignedGrave, bool inBed, float bedRotation,
                                           ref Corpse __result)
        {
            if (__instance.IsVampire())
            {
                if (__instance.holdingOwner != null)
                {
                    Log.Warning(
                        "We can't make corpse because the pawn is in a ThingOwner. Remove him from the container first. This should have been already handled before calling this method. holder=" +
                        __instance.ParentHolder);
                    __result = null;
                    return(false);
                }

                VampireCorpse corpse = (VampireCorpse)ThingMaker.MakeThing(ThingDef.Named("ROMV_VampCorpse"));
                corpse.InnerPawn   = __instance;
                corpse.BloodPoints = __instance.BloodNeed().CurBloodPoints;
                if (__instance.health.hediffSet.GetHediffs <Hediff_Injury>()
                    ?.Where(x => x.def == HediffDefOf.Burn && !x.IsTended())?.Count() > 3)
                {
                    corpse.BurnedToAshes = true;
                }

                if (assignedGrave != null)
                {
                    corpse.InnerPawn.ownership.ClaimGrave(assignedGrave);
                }

                if (inBed)
                {
                    corpse.InnerPawn.Drawer.renderer.wiggler.SetToCustomRotation(bedRotation + 180f);
                }

                __result = corpse as Corpse;
                return(false);
            }

            return(true);
        }