public static void Postfix(Building_Storage __instance, ref IEnumerable <Gizmo> __result)
        {
            // ShelfRenamer.Instance.Log("Gizmoing " + __instance.def.thingClass.Name);

            // RimFridge already has its own renamer.
            if (__instance.def.thingClass.Name == "Building_Refrigerator")
            {
                return;
            }

            // If it has a user-accessible storage tab, then allow renaming.
            if (!__instance.StorageTabVisible)
            {
                return;
            }

            var tempList = __result.ToList();

            // Add our own rename button, since none appears to exist already.
            tempList.Add(new Command_Action
            {
                icon          = ContentFinder <Texture2D> .Get("UI/Icons/ShelfRenamer"),
                defaultDesc   = "Rename".Translate(),
                defaultLabel  = "Rename".Translate(),
                activateSound = SoundDef.Named("Click"),
                action        = delegate { Find.WindowStack.Add(new Dialog_Rename(__instance)); }
            });
            __result = tempList;
        }
 private void TransferHopperItems(Building_PocketDimensionEntranceBase otherSide)
 {
     for (int i = 0; i < AdjCellsCardinalInBounds.Count; i++)
     {
         Building_Storage hopper    = null;
         List <Thing>     thingList = AdjCellsCardinalInBounds[i].GetThingList(base.Map);
         for (int j = 0; j < thingList.Count; j++)
         {
             Thing thing = thingList[j];
             if ((thing.def == ThingDefOf.Hopper || thing.def == PocketDimensionDefOf.CM_PocketDimensionHopper) && thing as MinifiedThing == null)
             {
                 hopper = thing as Building_Storage;
                 SlotGroup slotGroup = hopper.GetSlotGroup();
                 if (slotGroup != null && slotGroup.HeldThings != null)
                 {
                     foreach (Thing thing2 in slotGroup.HeldThings)
                     {
                         if (hopper.Accepts(thing2))
                         {
                             thing2.DeSpawn(DestroyMode.Vanish);
                             GenSpawn.Spawn(thing2, otherSide.InteractionCell, otherSide.Map, WipeMode.Vanish);
                         }
                     }
                 }
                 break;
             }
         }
     }
 }
Esempio n. 3
0
        static bool Prefix(ref float __result, IntVec3 c, Map map, List <Thing> countedThings = null)
        {
            SlotGroup slotgroup = c.GetSlotGroup(map);

            if (slotgroup == null)
            {
                return(true);
            }
            if (!(slotgroup.parent is Building_Storage))
            {
                return(true);
            }
            if (!slotgroup.parent.IgnoreStoredThingsBeauty)
            {
                return(true);
            }
            Building_Storage storage = slotgroup.parent as Building_Storage;

            if (countedThings != null)
            {
                // Ignoring all the other things here because that's best:
                // What if a pretty rug were here, but also a shelf?  Suddenly,
                // no beauty from the rug, but also no counting its beauty
                // elsewhere in the room!
                if (countedThings.Contains(storage))
                {
                    __result = map.terrainGrid.TerrainAt(c).GetStatValueAbstract(StatDefOf.Beauty, null);
                    return(false);
                }
                countedThings.Add(storage);
            }
            __result = storage.GetStatValue(StatDefOf.Beauty, true) +
                       map.terrainGrid.TerrainAt(c).GetStatValueAbstract(StatDefOf.Beauty, null);
            return(false);
        }
Esempio n. 4
0
        static void AddPawnReservationsHeader(Building_Storage storage)
        {
            List <Pawn> pwns = storage.Map.mapPawns.SpawnedPawnsInFaction(Faction.OfPlayer);

            if (pwns.Count > 0)
            {
                listOfReservingPawns.Clear();
                foreach (IntVec3 c in storage.AllSlotCells())
                {
                    Pawn p = storage.Map.reservationManager.FirstRespectedReserver(c, pwns[0]);
                    if (p != null)
                    {
                        // (p can possibly be animals)
                        listOfReservingPawns.Add(p.LabelShort);
                    }
                }
                if (listOfReservingPawns.Count > 0)
                {
                    headerStringB.Append('\n');
                    if (listOfReservingPawns.Count == 1)
                    {
                        headerStringB.Append("LWM.ContentsHeaderPawnUsing".Translate(listOfReservingPawns[0]));
                    }
                    else
                    {
                        headerStringB.Append("LWM.ContentsHeaderPawnsUsing".Translate(
                                                 String.Join(", ", listOfReservingPawns.ToArray())));
                    }
                }
            }
        } // end checking pawn reservations
Esempio n. 5
0
        public static void GenerateSmallRoomWeaponRoom(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 origin        = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);

            OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, smallRoomWallOffset).RotatedBy(rotation), Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, rotation, TerrainDefOf.Concrete, TerrainDef.Named("MetalTile"), ref outpostData);

            // Spawn weapon racks, weapons and lamps.
            Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;

            TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 4, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 2, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData);
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData);
            // Spawn vertical alley and door.
            for (int zOffset = smallRoomWallOffset; zOffset <= Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset - 1).RotatedBy(rotation), ref outpostData);
        }
Esempio n. 6
0
        public static List <Thing> genericContentsHeader(Building_Storage storage, out string header, out string tooltip)
        {
            headerStringB.Length = 0;
            listOfStoredItems.Clear();
            tooltip = null;
            bool  flagUseStackInsteadOfItem = false; // "3/4 Items" vs "3/4 Stacks"
            float itemsTotalMass            = 0;     // not Bulk here
            int   numCells = 0;

            foreach (IntVec3 storageCell in storage.AllSlotCells())
            {
                foreach (Thing t in storage.Map.thingGrid.ThingsListAt(storageCell))
                {
                    if (t.Spawned && t.def.EverStorable(false))
                    {
                        listOfStoredItems.Add(t);
                        itemsTotalMass += t.GetStatValue(StatDefOf.Mass, true) * (float)t.stackCount;
                        if (t.def.stackLimit > 1)
                        {
                            flagUseStackInsteadOfItem = true;
                        }
                    }
                }
                numCells++;
            }
            // 4/8 stacks with total mass of 12kg (as above)
            headerStringB.Append("LWM.ContentsHeaderMax"
                                 .Translate(listOfStoredItems.Count,
                                            // 3 stacks or 3 items:
                                            (flagUseStackInsteadOfItem?"LWM.XStacks":"LWM.XItems").Translate(numCells),
                                            StatDefOf.Mass, itemsTotalMass.ToString("0.##")));
            AddPawnReservationsHeader(storage);
            header = headerStringB.ToString();
            return(listOfStoredItems);
        }
 public static void Postfix(Building_Storage __instance, Thing newItem)
 {
     if (__instance.TryGetComp <CompCachedDeepStorage>() is CompCachedDeepStorage comp)
     {
         Utils.Mess(Utils.DBF.Cache, $"Place {newItem.LabelCap} in {__instance.LabelCapNoCount}");
         comp.CellStorages.Add(newItem);
     }
 }
Esempio n. 8
0
        public static bool IsRetaining(this Building_Storage bs)
        {
            if (RetainingLWM.RetainingForcedForAll)
            {
                return(true);
            }

            return(bs.GetComp <RetainingLWMComp>()?.IsRetaining ?? false);
        }
 static bool Prefix(Building_Storage __instance, ref bool __result, Thing t)
 {
     if (__instance is Building_InfiniteStorage s)
     {
         __result = s.DoesAccept(t);
         return(false);
     }
     return(true);
 }
Esempio n. 10
0
        public static void TrySpawnWeaponOnRack(Thing rack)
        {
            Building_Storage storage      = rack as Building_Storage;
            QualityRange     qualityRange = new QualityRange(QualityCategory.Good, QualityCategory.Legendary);

            storage.settings.filter.AllowedQualityLevels = qualityRange;
            FloatRange hitPointsRange = new FloatRange(0.8f, 1f);

            storage.settings.filter.AllowedHitPointsPercents = hitPointsRange;
            foreach (IntVec3 cell in rack.OccupiedRect())
            {
                if (Rand.Value < 0.33f)
                {
                    float       weaponSelector = Rand.Value;
                    ThingDef    thingDef       = ThingDefOf.Gun_Pistol;
                    const float weaponsRatio   = 1f / 7f;
                    if (weaponSelector < weaponsRatio * 1f)
                    {
                        thingDef = ThingDef.Named("Gun_PumpShotgun");
                    }
                    else if (weaponSelector < weaponsRatio * 2f)
                    {
                        thingDef = ThingDef.Named("Gun_AssaultRifle");
                    }
                    else if (weaponSelector < weaponsRatio * 3f)
                    {
                        thingDef = ThingDef.Named("Gun_SniperRifle");
                    }
                    else if (weaponSelector < weaponsRatio * 4f)
                    {
                        thingDef = ThingDef.Named("Gun_IncendiaryLauncher");
                    }
                    else if (weaponSelector < weaponsRatio * 5f)
                    {
                        thingDef = ThingDef.Named("Gun_LMG");
                    }
                    else if (weaponSelector < weaponsRatio * 6f)
                    {
                        thingDef = ThingDef.Named("Gun_ChargeRifle");
                    }
                    else
                    {
                        thingDef = ThingDefOf.Gun_Pistol;
                    }

                    Thing       weapon      = ThingMaker.MakeThing(thingDef);
                    CompQuality qualityComp = weapon.TryGetComp <CompQuality>();
                    if (qualityComp != null)
                    {
                        QualityCategory quality = (QualityCategory)Rand.RangeInclusive((int)QualityCategory.Normal, (int)QualityCategory.Excellent);
                        qualityComp.SetQuality(quality, ArtGenerationContext.Outsider);
                    }
                    GenSpawn.Spawn(weapon, cell);
                }
            }
        }
 static void Postfix(Building_Storage __instance
                     #if DEBUG
                     , Thing newItem // might be null?
                     #endif
                     )
 {
     #if DEBUG
     Log.Message("" + __instance + " lost thing " + newItem);
     #endif
     __instance.GetComp <CompRestrictedStorage>()?.CheckForIncorrectItems();
 }
Esempio n. 12
0
        public Cell_Storage_Collection(Building_Storage storage, CompCachedDeepStorage comp)
        {
            _comp     = comp;
            _parent   = storage;
            _settings = storage.settings;

            if (storage.Spawned)
            {
                this.Init(storage.AllSlotCellsList(), storage.Map);
            }
        }
 static bool Prefix(Building_Storage __instance, Thing t, out bool __result)
 {
     __result = false;
     if ((__instance as IForbidPawnInputItem)?.ForbidPawnInput ?? false)
     {
         if (!__instance.slotGroup.HeldThings.Contains(t))
         {
             return(false);
         }
     }
     return(true);
 }
 static bool Prefix(Building_Storage __instance, Thing t, out bool __result)
 {
     __result = false;
     if (PatchStorageUtil.Get <IForbidPawnInputItem>(__instance.Map, __instance.Position)?.ForbidPawnInput ?? false)
     {
         if (!__instance.slotGroup.HeldThings.Contains(t))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 15
0
        public static void Postfix(Building_Storage __instance, Thing newItem)
        {
            CompDeepStorage cds;

            if ((cds = __instance.TryGetComp <CompDeepStorage>()) == null)
            {
                return;
            }

            /****************** Put DSU at top of list *******************/
            /*  This is important for selecting next objects?  I think?  */
            List <Thing> list = newItem.Map.thingGrid.ThingsListAt(newItem.Position);

            list.Remove(__instance);
            list.Add(__instance);

            /****************** Set display for items correctly *******************/
            /*** Clean up old "what was on top" ***/
            foreach (Thing t in list)
            {
                Utils.TopThingInDeepStorage.Remove(t);
            }

            /*** Complex meshes have a few rules for DeepStorage ***/
            if (newItem.def.drawerType != DrawerType.MapMeshOnly)
            {
                //  If they are on top, they should be drawn on top:
                if (cds.showContents)
                {
                    Utils.TopThingInDeepStorage.Add(newItem);
                }
                else // If we are not showing contents, don't draw them:
                {
                    __instance.Map.dynamicDrawManager.DeRegisterDrawable(newItem);
                }
            }

            /*** Gui overlay - remove if the DSU draws it, or if the item is invisible ***/
            if (cds.cdsProps.overlayType != GuiOverlayType.Normal || !cds.showContents)
            {
                // Remove gui overlay - this includes number of stackabe item, quality, etc
                __instance.Map.listerThings.ThingsInGroup(ThingRequestGroup.HasGUIOverlay).Remove(newItem);
            }

            if (!cds.showContents)
            {
                return;                    // anything after is for invisible items
            }
            /*** tool tip, dirt mesh, etc ***/
            __instance.Map.tooltipGiverList.Notify_ThingDespawned(newItem); // should this go with guioverlays?
            newItem.DirtyMapMesh(newItem.Map);                              // for items with a map mesh; probably unnecessary?
            // Note: not removing linker here b/c I don't think it's applicable to DS?
        }
Esempio n. 16
0
        public static void GenerateMediumRoomWeaponRoom(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 origin        = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);

            OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), 9, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData);

            // Spawn weapon racks, weapons and lamps.
            Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;

            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(2, 0, 5).RotatedBy(rotation), Color.red, ref outpostData);
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(8, 0, 5).RotatedBy(rotation), Color.red, ref outpostData);

            // Spawn vertical alley and doors.
            for (int zOffset = 0; zOffset <= 10; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData);
        }
Esempio n. 17
0
        public static bool AllowedToAccept(this IntVec3 cell, Thing thing)
        {
            if (cell.GetZone() != null && cell.GetZone().GetType().ToString().Equals("RimWorld.Zone_Stockpile"))
            {
                return(((Zone_Stockpile)cell.GetZone()).GetStoreSettings().AllowedToAccept(thing));
            }
            Building_Storage buildingStorage = (Building_Storage)cell.GetThingList().Find(x => x.GetType().ToString().Equals("RimWorld.Building_Storage"));

            if (buildingStorage != null)
            {
                return(buildingStorage.GetStoreSettings().AllowedToAccept(thing));
            }
            return(false);
        }
Esempio n. 18
0
        public static StoragePriority Priority(this IntVec3 cell)
        {
            if (cell.GetZone() != null && cell.GetZone().GetType().ToString().Equals("RimWorld.Zone_Stockpile"))
            {
                return(((Zone_Stockpile)cell.GetZone()).GetStoreSettings().Priority);
            }
            Building_Storage buildingStorage = (Building_Storage)cell.GetThingList().Find(x => x.GetType().ToString().Equals("RimWorld.Building_Storage"));

            if (buildingStorage != null)
            {
                return(buildingStorage.GetStoreSettings().Priority);
            }
            return(StoragePriority.Unstored);
        }
        public static void Postfix(Building_Storage __instance, Map map)
        {
            CompDeepStorage cds;

            if ((cds = __instance.GetComp <CompDeepStorage>()) == null)
            {
                return;
            }

            foreach (var cell in __instance.AllSlotCells())
            {
                var list = map.thingGrid.ThingsListAt(cell);
                var alreadyFoundItemOnTop = false;
                for (var i = list.Count - 1; i >= 0; i--)
                {
                    var thing = list[i];
                    if (!thing.Spawned || !thing.def.EverStorable(false))
                    {
                        continue;                                                               // don't make people walking past be invisible...
                    }
                    if (cds.cdsProps.overlayType != GuiOverlayType.Normal || !cds.showContents) // Remove gui overlay - this includes number of stackabe item, quality, etc
                    {
                        map.listerThings.ThingsInGroup(ThingRequestGroup.HasGUIOverlay).Remove(thing);
                    }
                    if (thing.def.drawerType != DrawerType.MapMeshOnly)
                    {
                        if (!alreadyFoundItemOnTop)
                        {
                            Utils.TopThingInDeepStorage.Add(thing);
                        }
                        if (!cds.showContents)
                        {
                            map.dynamicDrawManager.DeRegisterDrawable(thing);
                        }
                    }

                    alreadyFoundItemOnTop = true; // it's true now, one way or another!

                    if (!cds.showContents)
                    {
                        map.tooltipGiverList.Notify_ThingDespawned(thing);                    // should this go with guioverlays?
                    }
                    // Don't need to thing.DirtyMapMesh(map); because of course it's dirty on spawn setup ;p
                } // end cell

                // Now put the DSU at the top of the ThingsList here:
                list.Remove(__instance);
                list.Add(__instance);
            }
        }
            public static void Postfix(Building_Storage __instance)
            {
                StorageSettings s = __instance.Map.GetComponent <StorageSettingManager>().Find(__instance.Position);

                if (s == null)
                {
#if DEBUG
                    Log.Message(DebugLog.GetMethodName(2) + "@" + MethodBase.GetCurrentMethod().Name + ": settings is not found at Pos=" + __instance.Position.ToString());
#endif
                    return;
                }
                __instance.settings.CopyFrom(s);
                __instance.Map.GetComponent <StorageSettingManager>().Remove(__instance.Position);
            }
            public static void Postfix(Building_Storage __instance, ref IEnumerable <Gizmo> __result)
            {
                List <Gizmo> list = new List <Gizmo>();

                foreach (var x in __result)
                {
                    list.Add(x);
                }
                if (__instance.Faction == Faction.OfPlayer && __instance.def.blueprintClass == typeof(Blueprint_Build))
                {
                    Command com = BetterCopyCommand.GetBetterCopyCommand(__instance.def, __instance.Stuff, __instance.GetStoreSettings());
                    BetterCopyCommand.BuildingIconCopy(list, com);
                    list.Add(com);
                }
                __result = list;
            }
Esempio n. 22
0
        public void EstablishFarcasterLink()
        {
            mapHome = this.Map;
            Messages.Message("GU_FarcasterActivated".Translate(), MessageTypeDefOf.PositiveEvent);
            FarcasterDestination worldObjectFarcaster = (FarcasterDestination)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed("GU_FarcasterDestinationSigmaAlcyon", true));

            mapParent      = (MapParent)worldObjectFarcaster;
            mapParent.Tile = TileFinder.RandomStartingTile();
            mapParent.SetFaction(Faction.OfPlayer);
            worldObjectFarcaster.mapHome = mapHome;
            worldObjectFarcaster.mapGen  = DefDatabase <MapGeneratorDef> .GetNamed("GU_FarcasterMapSigmaAlcyon", true);

            Find.WorldObjects.Add(mapParent);
            myMap = new Map();

            LongEventHandler.QueueLongEvent(delegate
            {
                myMap = GetOrGenerateMapUtility.GetOrGenerateMap(mapParent.Tile, Find.World.info.initialMapSize, null);
            }, "GU_LinkingWithFarcasters", true, new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap));
            LongEventHandler.QueueLongEvent(delegate
            {
                originalBiome        = myMap.TileInfo.biome;
                originalTile         = mapParent.Tile;
                myMap.TileInfo.biome = DefDatabase <BiomeDef> .GetNamed("GU_SigmaAlcyonIIb", true);
                mapParent.Tile       = base.Tile;

                mapFarcast = myMap;

                //Remote Farcaster portal spawning

                Building_AncientFarcaster building_AncientFarcaster = (Building_AncientFarcaster)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("GU_AncientFarcasterPortal", true));
                building_AncientFarcaster.mapHome      = mapHome;
                building_AncientFarcaster.locationHome = this.Position;
                building_AncientFarcaster.SetFaction(Faction.OfPlayer);
                GenSpawn.Spawn(building_AncientFarcaster, myMap.Center, myMap);
                locationFarcast = building_AncientFarcaster.Position;

                //An auxiliary pad too

                Building_Storage building_AncientPad = (Building_Storage)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("GU_AncientFarcasterPad", true));
                building_AncientPad.SetFaction(Faction.OfPlayer);
                GenSpawn.Spawn(building_AncientPad, myMap.Center - GenAdj.CardinalDirections[0] * 4, myMap);

                //Farcaster portal spawning ends here
            }, "GU_LinkingWithFarcasters", true, new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap));
        }
Esempio n. 23
0
            public static void Postfix(Building_Storage __instance, ref IEnumerable <Gizmo> __result)
            {
#if DEBUG
                Log.Message(Debug.GetMethodName(2) + "@" + MethodBase.GetCurrentMethod().Name);
#endif
                List <Gizmo> list = new List <Gizmo>();
                foreach (var x in __result)
                {
                    list.Add(x);
                }
                if (__instance.Faction == Faction.OfPlayer && __instance.def.blueprintClass == typeof(Blueprint_Build))
                {
                    Command com = BetterCopyCommand.GetBetterCopyCommand(__instance.def, __instance.Stuff, __instance.GetStoreSettings());
                    BetterCopyCommand.BuildingIconCopy(list, com);
                    list.Add(com);
                }
                __result = list;
            }
        static void Postfix_I_Would_Like_To_Use(Building_Storage __instance, Thing newItem)
        {
            Utils.TopThingInDeepStorage.Remove(newItem);
            if (__instance.TryGetComp <CompDeepStorage>() == null)
            {
                return;
            }
            List <Thing> list = newItem.Map.thingGrid.ThingsListAt(newItem.Position);

            for (int i = list.Count - 1; i > 0; i--)
            {
                if (!list[i].def.EverStorable(false))
                {
                    continue;
                }
                Utils.TopThingInDeepStorage.Add(list[i]);
                return;
            }
        }
Esempio n. 25
0
            public static void Postfix(Building_Storage __instance)
            {
#if DEBUG
                Log.Message(Debug.GetMethodName(2) + ": Postfix");
#endif
                StorageSettings s = __instance.Map.GetComponent <StorageSettingManager>().Find(__instance.Position);
                if (s == null)
                {
#if DEBUG
                    Log.Message(Debug.GetMethodName(2) + "@" + MethodBase.GetCurrentMethod().Name + ": settings is not found at Pos=" + __instance.Position.ToString());
#endif
                    return;
                }
                __instance.settings.CopyFrom(s);
                __instance.Map.GetComponent <StorageSettingManager>().Remove(__instance.Position);
#if DEBUG
                Log.Message("allowed:" + s.filter.AllowedDefCount + "  hitpoint:" + s.filter.allowedHitPointsConfigurable + " quality:"
                            + s.filter.allowedQualitiesConfigurable);
                Log.Message(Debug.GetMethodName(2) + "@" + MethodBase.GetCurrentMethod().Name + ": copy is completed");
#endif
            }
Esempio n. 26
0
        public static void GenerateBigRoomLivingRoom(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 origin        = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);

            OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, null, ref outpostData);

            // Spawn table and stools.
            OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            // Spawn NPD, hoppers and lamp.
            OG_Common.TrySpawnThingAt(ThingDefOf.NutrientPasteDispenser, null, rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(2, 0, 6).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            Building_Storage hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;

            hopper.GetStoreSettings().Priority = StoragePriority.Critical;
            hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            hopper.GetStoreSettings().Priority = StoragePriority.Critical;
            hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            hopper.GetStoreSettings().Priority = StoragePriority.Critical;
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), Color.white, ref outpostData);
            // Spawn TV and dining chairs.
            OG_Common.TrySpawnThingAt(ThingDef.Named("TubeTelevision"), null, rotatedOrigin + new IntVec3(8, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            // Spawn lamp and temperature control.
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(6, 0, 4).RotatedBy(rotation), Color.white, ref outpostData);
            OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 3).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 1).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);

            OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin);
        }
        public override void PostSpawnSetup()
        {
            base.PostSpawnSetup();
            okToProcess = false;

            // Get this building
            thisBuilding = (parent as Building_Storage);
            if( thisBuilding == null ) {
                Log.Message( "Community Core Library :: CompRefrigerated :: Unable to cast '" + parent.def.defName + "' to Building" );
                return;
            }

            // Get the power comp
            compPower = parent.GetComp<CompPowerTrader>();
            if( compPower == null )
            {
                Log.Message( "Community Core Library :: CompRefrigerated :: '" + parent.def.defName + "' needs compPowerTrader!" );
                return;
            }

            // Everything seems ok
            okToProcess = true;
        }
        // LWM rewrote most of this method to meet their implementation of CompDeepStorage
        private void DisplayHeaderInfo(ref float curY, float width, Building_Storage cabinet,
                                       int numCells, List <Thing> itemsList)
        {
            CompDeepStorage cds = cabinet.GetComp <CompDeepStorage>();

            if (cds == null)
            {
                return;              // what are we even doing here, mmm?
            }
            Rect rect = new Rect(0f, curY, width, 22f);

            if (itemsList.Count < 1)
            {
                Widgets.Label(rect, "NoItemsAreStoredHere".Translate());
                curY += 22;
                return;
            }
            float itemsTotalMass = 0; // or Bulk for CE ;p

            for (int i = 0; i < itemsList.Count; i++)
            {
                itemsTotalMass += itemsList[i].GetStatValue(cds.stat, true) * (float)itemsList[i].stackCount;
            }
            if (cds.limitingTotalFactorForCell > 0f)
            {
                Widgets.Label(rect, "LWM.ContentHeaderOneOf".Translate(itemsList.Count.ToString(),
                                                                       cds.stat.ToString(), itemsTotalMass.ToString("0.##"),
                                                                       (cds.limitingTotalFactorForCell * numCells).ToString("0.##")));
            }
            else
            {
                Widgets.Label(rect, "LWM.ContentHeaderOne".Translate(itemsList.Count.ToString(),
                                                                     cds.stat.ToString(), itemsTotalMass.ToString("0.##")));
            }
            curY += 22f;
        }
Esempio n. 29
0
        public static void GenerateBigRoomRefectory(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 origin        = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);

            OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, TerrainDef.Named("CarpetDark"), ref outpostData);

            // Spawn doors.
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 10).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(10, 0, 5).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(0, 0, 5).RotatedBy(rotation), ref outpostData);

            // Spawn table and dining chairs.
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);

            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);

            // Spawn NPD, hoppers and lamp.
            OG_Common.TrySpawnThingAt(ThingDefOf.NutrientPasteDispenser, null, rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            Building_Storage hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;

            hopper.GetStoreSettings().Priority = StoragePriority.Critical;
            OG_Common.SpawnResourceAt(ThingDefOf.RawPotatoes, ThingDefOf.RawPotatoes.stackLimit, rotatedOrigin + new IntVec3(4, 0, 9).RotatedBy(rotation), true);
            hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            hopper.GetStoreSettings().Priority = StoragePriority.Critical;
            OG_Common.SpawnResourceAt(ThingDef.Named("RawCorn"), ThingDef.Named("RawCorn").stackLimit, rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), true);
            hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            hopper.GetStoreSettings().Priority = StoragePriority.Critical;
            OG_Common.SpawnResourceAt(ThingDef.Named("RawBerries"), ThingDef.Named("RawBerries").stackLimit, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true);
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(4, 0, 6).RotatedBy(rotation), Color.white, ref outpostData);
            for (int xOffset = 1; xOffset <= 4; xOffset++)
            {
                for (int zOffset = 6; zOffset <= 9; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("SterileTile"));
                }
            }

            // Generate food racks.
            for (int xOffset = 6; xOffset <= 9; xOffset++)
            {
                for (int zOffset = 6; zOffset <= 9; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("SterileTile"));
                }
            }
            OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            for (int xOffset = 6; xOffset <= 7; xOffset++)
            {
                for (int zOffset = 6; zOffset <= 9; zOffset++)
                {
                    IntVec3 cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation);
                    OG_Common.SpawnResourceAt(ThingDefOf.MealSurvivalPack, ThingDefOf.MealSurvivalPack.stackLimit, cell, true);
                }
            }
            for (int zOffset = 6; zOffset <= 9; zOffset++)
            {
                IntVec3 cell = rotatedOrigin + new IntVec3(9, 0, zOffset).RotatedBy(rotation);
                OG_Common.SpawnResourceAt(ThingDefOf.Beer, ThingDefOf.Beer.stackLimit, cell, true);
            }

            // Spawn lamp and temperature control.
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(6, 0, 4).RotatedBy(rotation), Color.white, ref outpostData);
            OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 2).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 1).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 2).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);

            OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin);
        }
Esempio n. 30
0
 public Dialog_Rename(Building_Storage building) : base()
 {
     this.building = building;
     this.curName  = building.Label;
 }
 public static void InsertUrgentRefillGizmos(IEnumerable <Gizmo> __result, Building_Storage __instance)
 {
     SlotGroup_GetGizmos_Patch.InsertUrgentRefillGizmos(__result, __instance.Map, __instance);
 }