コード例 #1
0
 // spawn rjw stuff
 public static void SpawnThingsFromHediffs(Pawn pawn, BodyPartRecord part, IntVec3 pos, Map map)
 {
     if (!pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined).Contains(part))
     {
         return;
     }
     if (pawn.Dead)
     {
         return;
     }
     IEnumerable<Hediff> enumerable = from x in pawn.health.hediffSet.hediffs
                                      where x.Part == part
                                      select x;
     //RJW parts and other implants?
     foreach (Hediff current in enumerable)
     {
         if (current.def.spawnThingOnRemoved != null)
         {
             //rjw implants/parts
             Thing thing = GenSpawn.Spawn(current.def.spawnThingOnRemoved, pos, map);
             //Log.Message("SpawnThingsFromHediffs test 1 " + current);
             //current.ExposeData();
             //thing.ExposeData();
             //Log.Message("SpawnThingsFromHediffs test 2 " + current);
             //Scribe_Values.Look<float>(ref part.Size, "size", 1);
             //Log.Message("SpawnThingsFromHediffs test 3 " + current);
         }
     }
     //spawn sub parts? not sure why would it call itself but w/e
     for (int i = 0; i < part.parts.Count; i++)
     {
         MedicalRecipesUtility.SpawnThingsFromHediffs(pawn, part.parts[i], pos, map);
     }
 }
コード例 #2
0
        /// <summary>
        /// spawn rjw parts after operation
        /// </summary>
        /// <param name="pawn"></param>
        /// <param name="part"></param>
        /// <param name="pos"></param>
        /// <param name="map"></param>
        public static void SpawnThingsFromHediffs(Pawn pawn, BodyPartRecord part, IntVec3 pos, Map map)
        {
            if (!pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined).Contains(part))
            {
                return;
            }
            if (pawn.Dead)
            {
                return;
            }
            IEnumerable <Hediff> enumerable = from x in pawn.health.hediffSet.hediffs
                                              where x.Part == part
                                              select x;

            //RJW parts and other implants?
            foreach (Hediff current in enumerable)
            {
                if (current.def.spawnThingOnRemoved != null)
                {
                    //Thing thing = GenSpawn.Spawn(current.def.spawnThingOnRemoved, pos, map);

                    //spawn thing
                    GenSpawn.Spawn(SexPartAdder.recipePartRemover(current), pos, map);
                }
            }
            //spawn sub parts? not sure why would it call itself but w/e
            for (int i = 0; i < part.parts.Count; i++)
            {
                MedicalRecipesUtility.SpawnThingsFromHediffs(pawn, part.parts[i], pos, map);
            }
        }
コード例 #3
0
        public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
        {
            bool flag  = MedicalRecipesUtility.IsClean(pawn, part);
            bool flag2 = MedicalRecipesUtility.IsViolationOnPawn(pawn, part, Faction.OfPlayer);

            if (billDoer != null)
            {
                if (base.CheckSurgeryFail(billDoer, pawn, ingredients, part, bill))
                {
                    return;
                }
                TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[]
                {
                    billDoer,
                    pawn
                });
                MedicalRecipesUtility.SpawnNaturalPartIfClean(pawn, part, billDoer.Position, billDoer.Map);
                MedicalRecipesUtility.SpawnThingsFromHediffs(pawn, part, billDoer.Position, billDoer.Map);
            }
            DamageDef surgicalCut      = DamageDefOf.SurgicalCut;
            float     amount           = 99999f;
            float     armorPenetration = 999f;

            pawn.TakeDamage(new DamageInfo(surgicalCut, amount, armorPenetration, -1f, null, part, null, DamageInfo.SourceCategory.ThingOrUnknown, null));
            if (flag)
            {
                if (pawn.Dead)
                {
                    ThoughtUtility.GiveThoughtsForPawnExecuted(pawn, PawnExecutionKind.OrganHarvesting);
                }
                ThoughtUtility.GiveThoughtsForPawnOrganHarvested(pawn);
            }
            if (flag2 && pawn.Faction != null && billDoer != null && billDoer.Faction != null)
            {
                Faction          faction    = pawn.Faction;
                Faction          faction2   = billDoer.Faction;
                string           reason     = "GoodwillChangedReason_RemovedBodyPart".Translate(part.LabelShort);
                GlobalTargetInfo?lookTarget = pawn;
                faction.TryAffectGoodwillWith(faction2, ViolationGoodwillImpact, true, true, reason, lookTarget);
            }
        }
コード例 #4
0
ファイル: CORE_EXPOSED.cs プロジェクト: deanec64/RJW
        public static void SpawnThingsFromHediffs(Pawn pawn, BodyPartRecord part, IntVec3 pos, Map map)
        {
            if (!pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined).Contains(part))
            {
                return;
            }
            IEnumerable <Hediff> enumerable = from x in pawn.health.hediffSet.hediffs
                                              where x.Part == part
                                              select x;

            foreach (Hediff current in enumerable)
            {
                if (current.def.spawnThingOnRemoved != null)
                {
                    GenSpawn.Spawn(current.def.spawnThingOnRemoved, pos, map);
                }
            }
            for (int i = 0; i < part.parts.Count; i++)
            {
                MedicalRecipesUtility.SpawnThingsFromHediffs(pawn, part.parts[i], pos, map);
            }
        }
コード例 #5
0
ファイル: CORE_EXPOSED.cs プロジェクト: deanec64/RJW
        public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
        {
            bool flag  = MedicalRecipesUtility.IsClean(pawn, part);
            bool flag2 = this.IsViolationOnPawn(pawn, part, Faction.OfPlayer);

            if (billDoer != null)
            {
                if (base.CheckSurgeryFail(billDoer, pawn, ingredients, part, bill))
                {
                    return;
                }
                TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[]
                {
                    billDoer,
                    pawn
                });
                MedicalRecipesUtility.SpawnNaturalPartIfClean(pawn, part, billDoer.Position, billDoer.Map);
                MedicalRecipesUtility.SpawnThingsFromHediffs(pawn, part, billDoer.Position, billDoer.Map);
            }
            pawn.TakeDamage(new DamageInfo(DamageDefOf.SurgicalCut, 99999, -1f, null, part, null));
            if (flag)
            {
                if (pawn.Dead)
                {
                    ThoughtUtility.GiveThoughtsForPawnExecuted(pawn, PawnExecutionKind.OrganHarvesting);
                }
                else
                {
                    ThoughtUtility.GiveThoughtsForPawnOrganHarvested(pawn);
                }
            }
            if (flag2)
            {
                pawn.Faction.AffectGoodwillWith(billDoer.Faction, -20f);
            }
        }