public static void Postfix(ref bool __result, TerrainDef terrainDef, ThingDef filthDef,
                            FilthSourceFlags additionalFlags = FilthSourceFlags.None)
 {
     if (!__result && terrainDef.AffectsFertility && Globals.IsUSFilth(filthDef))
     {
         __result = true;
     }
 }
示例#2
0
        public static bool TerrainAcceptsFilth(TerrainDef terrainDef, ThingDef filthDef, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
        {
            if (terrainDef.filthAcceptanceMask == FilthSourceFlags.None)
            {
                return(false);
            }
            FilthSourceFlags filthSourceFlags = filthDef.filth.placementMask | additionalFlags;

            return((terrainDef.filthAcceptanceMask & filthSourceFlags) == filthSourceFlags);
        }
        public static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, IEnumerable <string> sources, Color color, bool shouldPropagate, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
        {
            Filth_Colored filth = (Filth_Colored)(from t in c.GetThingList(map)
                                                  where t.def == filthDef
                                                  select t).FirstOrDefault <Thing>();

            if (!c.Walkable(map) || (filth != null && !filth.CanBeThickened))
            {
                if (shouldPropagate)
                {
                    List <IntVec3> list = GenAdj.AdjacentCells8WayRandomized();
                    for (int i = 0; i < 8; i++)
                    {
                        IntVec3 c2 = c + list[i];
                        if (c2.InBounds(map) && TryMakeFilth(c2, map, filthDef, sources, color, false, FilthSourceFlags.None))
                        {
                            return(true);
                        }
                    }
                }
                if (filth != null)
                {
                    filth.AddSources(sources);
                }
                return(false);
            }
            if (filth != null)
            {
                filth.ThickenFilth();
                filth.AddSources(sources);
            }
            else
            {
                if (!FilthMaker.CanMakeFilth(c, map, filthDef, additionalFlags))
                {
                    return(false);
                }
                Filth_Colored filth2 = (Filth_Colored)ThingMaker.MakeThing(filthDef, null);
                filth2.DrawColor = color;
                filth2.AddSources(sources);
                GenSpawn.Spawn(filth2, c, map, WipeMode.Vanish);
            }
            //FilthMonitor.Notify_FilthSpawned();
            return(true);
        }
示例#4
0
        public static bool TryMakeFilth(ref bool __result, IntVec3 c, Map map, ThingDef filthDef, IEnumerable <string> sources, bool shouldPropagate, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
        {
            Filth        filth     = null;
            List <Thing> thingList = c.GetThingList(map);

            for (int i = 0; i < thingList.Count; i++)
            {
                Thing thing;
                try
                {
                    thing = thingList[i];
                } catch (ArgumentOutOfRangeException)
                {
                    break;
                }
                if (thing != null && thing.def == filthDef)
                {
                    filth = (Filth)thing;
                    break;
                }
            }
            if (filth == null)
            {
                filth = (Filth)default(Thing);
            }

            if (!c.Walkable(map) || (filth != null && !filth.CanBeThickened))
            {
                if (shouldPropagate)
                {
                    List <IntVec3> list = GenAdj.AdjacentCells8WayRandomized();
                    for (int i = 0; i < 8; i++)
                    {
                        IntVec3 c2 = c + list[i];
                        //if (c2.InBounds(map) && TryMakeFilth(c2, map, filthDef, sources, shouldPropagate: false))
                        if (c2.InBounds(map))
                        {
                            bool tryMakeFilthResult = false;
                            TryMakeFilth(ref tryMakeFilthResult, c2, map, filthDef, sources, shouldPropagate: false);
                            if (tryMakeFilthResult)
                            {
                                __result = true;
                                return(false);
                            }
                        }
                    }
                }

                filth?.AddSources(sources);
                __result = false;
                return(false);
            }

            if (filth != null)
            {
                filth.ThickenFilth();
                filth.AddSources(sources);
            }
            else
            {
                if (!FilthMaker.CanMakeFilth(c, map, filthDef, additionalFlags))
                {
                    __result = false;
                    return(false);
                }

                Filth obj = (Filth)ThingMaker.MakeThing(filthDef);
                obj.AddSources(sources);
                GenSpawn.Spawn(obj, c, map);
            }

            FilthMonitor2.Notify_FilthSpawned();
            __result = true;
            return(false);
        }
示例#5
0
 public bool CanDropAt(IntVec3 c, Map map, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
 {
     return(FilthMaker.CanMakeFilth(c, map, def, additionalFlags));
 }
示例#6
0
        private static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, IEnumerable <string> sources, bool shouldPropagate, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
        {
            Filth filth = (Filth)(from t in c.GetThingList(map)
                                  where t.def == filthDef
                                  select t).FirstOrDefault();

            if (!c.Walkable(map) || (filth != null && !filth.CanBeThickened))
            {
                if (shouldPropagate)
                {
                    List <IntVec3> list = GenAdj.AdjacentCells8WayRandomized();
                    for (int i = 0; i < 8; i++)
                    {
                        IntVec3 c2 = c + list[i];
                        if (c2.InBounds(map) && TryMakeFilth(c2, map, filthDef, sources, shouldPropagate: false))
                        {
                            return(true);
                        }
                    }
                }
                filth?.AddSources(sources);
                return(false);
            }
            if (filth != null)
            {
                filth.ThickenFilth();
                filth.AddSources(sources);
            }
            else
            {
                if (!CanMakeFilth(c, map, filthDef, additionalFlags))
                {
                    return(false);
                }
                Filth obj = (Filth)ThingMaker.MakeThing(filthDef);
                obj.AddSources(sources);
                GenSpawn.Spawn(obj, c, map);
            }
            FilthMonitor.Notify_FilthSpawned();
            return(true);
        }
示例#7
0
 public static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, IEnumerable <string> sources, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
 {
     return(TryMakeFilth(c, map, filthDef, sources, shouldPropagate: true, additionalFlags));
 }
示例#8
0
        public static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, string source, int count = 1, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
        {
            bool flag = false;

            for (int i = 0; i < count; i++)
            {
                flag |= TryMakeFilth(c, map, filthDef, Gen.YieldSingle(source), shouldPropagate: true, additionalFlags);
            }
            return(flag);
        }
示例#9
0
 public static bool CanMakeFilth(IntVec3 c, Map map, ThingDef filthDef, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
 {
     return(TerrainAcceptsFilth(c.GetTerrain(map), filthDef, additionalFlags));
 }
示例#10
0
        // Token: 0x06004C58 RID: 19544 RVA: 0x001987D8 File Offset: 0x001969D8
        private static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, IEnumerable <string> sources, bool shouldPropagate, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
        {
            Filth filth = (Filth)(from t in c.GetThingList(map)
                                  where t.def == filthDef
                                  select t).FirstOrDefault <Thing>();

            if (!c.Walkable(map) || (filth != null && !filth.CanBeThickened))
            {
                if (shouldPropagate)
                {
                    List <IntVec3> list = GenAdj.AdjacentCells8WayRandomized();
                    for (int i = 0; i < 8; i++)
                    {
                        IntVec3 c2 = c + list[i];
                        if (c2.InBounds(map) && AvP_Pawn_HealthTracker_DropBloodFilth_Xenoblood_Patch.TryMakeFilth(c2, map, filthDef, sources, false, FilthSourceFlags.None))
                        {
                            return(true);
                        }
                    }
                }
                if (filth != null)
                {
                    filth.AddSources(sources);
                }
                return(false);
            }
            if (filth != null)
            {
                filth.ThickenFilth();
                filth.AddSources(sources);
            }
            else
            {
                if (!FilthMaker.CanMakeFilth(c, map, filthDef, additionalFlags))
                {
                    return(false);
                }
                Filth filth2 = (Filth)ThingMaker.MakeThing(filthDef, null);
                filth2.AddSources(sources);
                Filth_AddAcidDamage filth_ = filth2 as Filth_AddAcidDamage;
                filth_.destroyTick = 600;
                GenSpawn.Spawn(filth2, c, map, WipeMode.Vanish);
            }
            //	FilthMonitor.Notify_FilthSpawned();
            return(true);
        }
示例#11
0
        // Token: 0x06004C56 RID: 19542 RVA: 0x00198798 File Offset: 0x00196998
        public static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, string source, int count = 1, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
        {
            bool flag = false;

            for (int i = 0; i < count; i++)
            {
                flag |= AvP_Pawn_HealthTracker_DropBloodFilth_Xenoblood_Patch.TryMakeFilth(c, map, filthDef, Gen.YieldSingle <string>(source), true, additionalFlags);
            }
            return(flag);
        }
示例#12
0
 public static bool TryMakeFilth(ref bool __result, IntVec3 c, Map map, ThingDef filthDef, IEnumerable <string> sources, bool shouldPropagate, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
 {
     __result = false;
     if (map == null)
     {
         return(false);
     }
     return(true);
 }