Пример #1
0
        public static void CalculatedCostAtPostfix(IntVec3 c, bool perceivedStatic, IntVec3 prevCell, ref int __result)
        {
            Map map = Find.CurrentMap;

            if (map != null)
            {
                List <Thing> list = map.thingGrid.ThingsListAt(c);
                for (int j = 0; j < 9; j++)
                {
                    IntVec3 b  = GenAdj.AdjacentCellsAndInside[j];
                    IntVec3 c2 = c + b;
                    if (c2.InBounds(map) && perceivedStatic)
                    {
                        Filth_AddAcidDamage acid = null;
                        list = map.thingGrid.ThingsListAtFast(c2);
                        if (list.Any(x => x.def == XenomorphDefOf.RRY_FilthBloodXenomorph_Active))
                        {
                            list = list.FindAll(x => x.def == XenomorphDefOf.RRY_FilthBloodXenomorph_Active);
                            for (int k = 0; k < list.Count; k++)
                            {
                                acid = (list[k] as Filth_AddAcidDamage);
                                if (acid != null)
                                {
                                    if (acid.active)
                                    {
                                        if (__result < 9000)
                                        {
                                            //    Log.Message(string.Format("acid is active: {0} = {1}", acid.active, __result));
                                            if (b.x == 0 && b.z == 0)
                                            {
                                                __result += 1000;
                                                //    Log.Message(string.Format("acid @: {0}, active: {1}, PathCost: {2}", c, acid.active, __result));
                                            }
                                            else
                                            {
                                                __result += 500;
                                                //    Log.Message(string.Format("acid adjacent to: {0} @: {1}, active: {2}, PathCost: {3}", c, c2, acid.active, __result));
                                            }
                                        }
                                    }
                                    else
                                    {
                                        //    Log.Message(string.Format("acid @: {0}, active: {1}, PathCost: {2}", c, acid.active, __result));
                                    }
                                }
                                else
                                {
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #2
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);
        }