Example #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 StorageSettings GetParentStoreSettings()
        {
            StorageSettings foobar = def.building.fixedStorageSettings;

            // Remove non-fleshy corpses from filter if Humanoid Alien Races mod is active
            if (ModCompatibility.AlienRacesIsActive)
            {
                foobar.filter.allowedDefs.RemoveWhere(def => ModCompatibility.AlienCorpseHasOrganicFlesh(def));
            }

            return(foobar);
        }
Example #3
0
        public StorageSettings GetParentStoreSettings()
        {
            StorageSettings foobar = def.building.fixedStorageSettings;

            // Remove Hologram corpses from filter if Save Our Ship 2 mod is active
            if (ModCompatibility.SaveOurShip2IsActive)
            {
                foobar.filter.allowedDefs.RemoveWhere(def => def == ThingDef.Named("Corpse_SoSHologramRace"));
            }

            // Remove non-fleshy corpses from filter if Humanoid Alien Races mod is active
            if (ModCompatibility.AlienRacesIsActive)
            {
                foobar.filter.allowedDefs.RemoveWhere(def => !ModCompatibility.AlienCorpseHasOrganicFlesh(def));
            }

            return(foobar);
        }