コード例 #1
0
        public static bool ShouldTrashBuilding(Pawn pawn, Building b, bool attackAllInert = false)
        {
            bool result;

            if (!b.def.useHitPoints)
            {
                result = false;
            }
            else if (pawn.mindState.spawnedByInfestationThingComp && b.GetComp <CompCreatesInfestations>() != null)
            {
                result = false;
            }
            else
            {
                if ((b.def.building.isInert && !attackAllInert) || b.def.building.isTrap)
                {
                    int num         = GenLocalDate.HourOfDay(pawn) / 3;
                    int specialSeed = b.GetHashCode() * 612361 ^ pawn.GetHashCode() * 391 ^ num * 73427324;
                    if (!Rand.ChanceSeeded(0.008f, specialSeed))
                    {
                        return(false);
                    }
                }
                result = ((!b.def.building.isTrap || !((Building_Trap)b).Armed) && TrashUtility.CanTrash(pawn, b) && pawn.HostileTo(b));
            }
            return(result);
        }
コード例 #2
0
        public static bool ShouldTrashBuilding(Pawn pawn, Building b, bool attackAllInert = false)
        {
            if (!b.def.useHitPoints)
            {
                return(false);
            }
            if (b.def.building.isInert && !attackAllInert)
            {
                goto IL_0042;
            }
            if (b.def.building.isTrap)
            {
                goto IL_0042;
            }
            goto IL_007f;
IL_0042:
            int num = GenLocalDate.HourOfDay(pawn) / 3;
            int specialSeed = b.GetHashCode() * 612361 ^ pawn.GetHashCode() * 391 ^ num * 734273247;

            if (!Rand.ChanceSeeded(0.008f, specialSeed))
            {
                return(false);
            }
            goto IL_007f;
IL_007f:
            if (b.def.building.isTrap && ((Building_Trap)b).Armed)
            {
                return(false);
            }
            if (TrashUtility.CanTrash(pawn, b) && pawn.HostileTo(b))
            {
                return(true);
            }
            return(false);
        }
コード例 #3
0
ファイル: TrashUtility.cs プロジェクト: ehtnnd/RW-Decompile
 public static bool ShouldTrashPlant(Pawn pawn, Plant p)
 {
     if (!p.sown || p.def.plant.IsTree || !p.FlammableNow || !TrashUtility.CanTrash(pawn, p))
     {
         return(false);
     }
     CellRect.CellRectIterator iterator = CellRect.CenteredOn(p.Position, 2).ClipInsideMap(p.Map).GetIterator();
     while (!iterator.Done())
     {
         IntVec3 current = iterator.Current;
         if (current.InBounds(p.Map) && current.ContainsStaticFire(p.Map))
         {
             return(false);
         }
         iterator.MoveNext();
     }
     return(p.Position.Roofed(p.Map) || p.Map.weatherManager.RainRate <= 0.25f);
 }