Ejemplo n.º 1
0
        public IntVec3 ResolvedNeighborPos()
        {
            this.resolvingCurrently = true;
            IntVec3 intVec = this.NextValidPlacementSpot;
            bool    flag   = !GenGrid.Walkable(intVec, base.MapHeld);

            if (flag)
            {
                this.nextValidPlacementSpot = default(IntVec3);
                intVec = this.NextValidPlacementSpot;
                for (int i = 0; i < 9; i++)
                {
                    bool flag2 = GridsUtility.GetThingList(intVec, base.Map).FirstOrDefault((Thing x) => x is Building_XenomorphCocoon) != null;
                    if (!flag2)
                    {
                        break;
                    }
                    this.nextValidPlacementSpot = default(IntVec3);
                    intVec = this.NextValidPlacementSpot;
                    bool flag3 = !GenConstruct.CanPlaceBlueprintAt(this.def, intVec, Rot4.North, base.Map, false, null).Accepted;
                    if (!flag3)
                    {
                        break;
                    }
                    this.nextValidPlacementSpot = default(IntVec3);
                    intVec = this.NextValidPlacementSpot;
                }
            }
            this.resolvingCurrently = false;
            return(intVec);
        }
Ejemplo n.º 2
0
 private void CheckAutoRebuild(Map map)
 {
     if (autoRearm && CanSetAutoRearm && map != null && GenConstruct.CanPlaceBlueprintAt(def, base.Position, base.Rotation, map).Accepted)
     {
         GenConstruct.PlaceBlueprintForBuild(def, base.Position, map, base.Rotation, Faction.OfPlayer, base.Stuff);
     }
 }
Ejemplo n.º 3
0
 public override AcceptanceReport CanDesignateCell(IntVec3 c)
 {
     if (!c.InBounds(base.Map))
     {
         return(false);
     }
     if (!(MiniToInstallOrBuildingToReinstall is MinifiedThing) && c.GetThingList(base.Map).Find((Thing x) => x.Position == c && x.Rotation == placingRot && x.def == PlacingDef) != null)
     {
         return(new AcceptanceReport("IdenticalThingExists".Translate()));
     }
     return(GenConstruct.CanPlaceBlueprintAt(PlacingDef, c, placingRot, base.Map, godMode: false, MiniToInstallOrBuildingToReinstall, ThingToInstall));
 }
Ejemplo n.º 4
0
 public override bool IsSpawningBlocked(IntVec3 at, Map map, Thing thingToIgnore = null, bool wipeIfCollides = false)
 {
     if (IsSpawningBlockedPermanently(at, map, thingToIgnore, wipeIfCollides))
     {
         return(true);
     }
     if (!GenAdj.OccupiedRect(at, Rot4.North, def.Size).InBounds(map))
     {
         return(true);
     }
     if (!GenConstruct.CanPlaceBlueprintAt(def, at, Rot4.North, map, wipeIfCollides, thingToIgnore).Accepted)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 5
0
 public override bool IsSpawningBlocked(IntVec3 at, Map map, Thing thingToIgnore = null, bool wipeIfCollides = false)
 {
     if (IsSpawningBlockedPermanently(at, map, thingToIgnore, wipeIfCollides))
     {
         return(true);
     }
     if (!at.InBounds(map))
     {
         return(true);
     }
     if (!GenConstruct.CanPlaceBlueprintAt(def, at, rot, map, wipeIfCollides, thingToIgnore, null, stuff ?? GenStuff.DefaultStuffFor(def)).Accepted)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 6
0
        public override AcceptanceReport CanDesignateCell(IntVec3 c)
        {
            if (!c.InBounds(base.Map))
            {
                return(false);
            }
            if (!(this.MiniToInstallOrBuildingToReinstall is MinifiedThing) && c.GetThingList(base.Map).Find((Thing x) => x.Position == c && x.Rotation == this.placingRot && x.def == this.PlacingDef) != null)
            {
                return(new AcceptanceReport("IdenticalThingExists".Translate()));
            }
            BuildableDef placingDef = this.PlacingDef;
            IntVec3      c2         = c;
            Rot4         placingRot = this.placingRot;
            Map          map        = base.Map;
            Thing        miniToInstallOrBuildingToReinstall = this.MiniToInstallOrBuildingToReinstall;

            return(GenConstruct.CanPlaceBlueprintAt(placingDef, c2, placingRot, map, false, miniToInstallOrBuildingToReinstall));
        }
Ejemplo n.º 7
0
 private static bool CanPlaceBlueprintAt(IntVec3 root, Rot4 rot, ThingDef buildingDef, Map map)
 {
     return(GenConstruct.CanPlaceBlueprintAt(buildingDef, root, rot, map, false, null).Accepted);
 }
Ejemplo n.º 8
0
 public override AcceptanceReport CanDesignateCell(IntVec3 c)
 {
     return(GenConstruct.CanPlaceBlueprintAt(entDef, c, placingRot, base.Map, DebugSettings.godMode, null, null, stuffDef));
 }