Esempio n. 1
0
        private Corpse FindHumanlikeCorpse(Pawn pawn, Building_ReplimatCorpseRecycler corpseRecycler)
        {
            // Only allow corpses that are:
            // - Humanlike
            // - Have organic flesh
            // - Is NOT dessicated
            // - Is NOT forbidden
            // - Is allowed by the current corpse recycler's storage settings
            // - Can be reserved by current pawn
            Predicate <Thing> validator = delegate(Thing t)
            {
                Corpse corpse = t as Corpse;

                bool IsOrganicFlesh;

                // If the Humanoid Alien Race mod is active, allow only humanoid alien corpses that have organic flesh
                // (using <compatibility><isFlesh>false</isFlesh></compatibility> for ThingDef_AlienRace )
                if (ModCompatibility.AlienRacesIsActive)
                {
                    IsOrganicFlesh = ModCompatibility.AlienRaceHasOrganicFlesh(corpse.InnerPawn);
                }
                // Otherwise, assume it is a vanilla RimWorld human, which should only have normal flesh
                else
                {
                    IsOrganicFlesh = (corpse.InnerPawn.RaceProps.FleshType == FleshTypeDefOf.Normal);
                }

                return(corpse.InnerPawn.RaceProps.Humanlike && IsOrganicFlesh && (corpse.GetRotStage() != RotStage.Dessicated) && !corpse.IsForbidden(pawn) && corpseRecycler.allowedCorpseFilterSettings.AllowedToAccept(corpse) && pawn.CanReserve(corpse));
            };

            return((Corpse)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Corpse), PathEndMode.ClosestTouch, TraverseParms.For(pawn), 9999f, validator));
        }
        public override void Resolve(ResolveParams rp)
        {
            Map map = BaseGen.globalSettings.map;

            corpseRecyclers.Clear();
            foreach (IntVec3 item in rp.rect)
            {
                List <Thing> thingList = item.GetThingList(map);
                for (int i = 0; i < thingList.Count; i++)
                {
                    Building_ReplimatCorpseRecycler building_ReplimatCorpseRecycler = thingList[i] as Building_ReplimatCorpseRecycler;
                    if (building_ReplimatCorpseRecycler != null && !corpseRecyclers.Contains(building_ReplimatCorpseRecycler))
                    {
                        corpseRecyclers.Add(building_ReplimatCorpseRecycler);
                    }
                }
            }

            for (int j = 0; j < corpseRecyclers.Count; j++)
            {
                /**if (!corpseRecyclers[j].CorpseFinishedProcessing)
                 * {
                 *  Log.Warning("Replimat :: SymbolResolver_LoadCorpseIntoReplimatCorpseRecycler - Do something here for " + corpseRecyclers[j].ToString() + " that has not yet finished processing?" );
                 * }*/
            }

            corpseRecyclers.Clear();
        }
Esempio n. 3
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Building_ReplimatCorpseRecycler corpseRecycler = (Building_ReplimatCorpseRecycler)t;
            Thing t2 = FindHumanlikeCorpse(pawn, corpseRecycler);

            return(JobMaker.MakeJob(ReplimatDef.LoadReplimatCorpseRecycler, t, t2));
        }