コード例 #1
0
ファイル: SAV_STADIUM.cs プロジェクト: ShadyRelapse-PP/PKHeX
    public virtual SlotGroup[] GetRegisteredTeams()
    {
        var result = new SlotGroup[TeamCount];

        for (int i = 0; i < result.Length; i++)
        {
            result[i] = GetTeam(i);
        }
        return(result);
    }
コード例 #2
0
    void Swap(Slottable targetSlottable)
    {
        SlotGroup targetSG = targetSlottable.m_OrigSG;

        targetSG.RemoveItemFromData(targetSlottable, targetSlottable.m_Quantity);
        this.m_OrigSG.RemoveItemFromData(this, this.m_PickAmount);

        targetSG.AddItemToData(this, this.m_PickAmount);
        this.m_OrigSG.AddItemToData(targetSlottable, targetSlottable.m_Quantity);
    }
コード例 #3
0
 public override void DeSpawn()
 {
     //Log.Message( string.Format( "{0}.DeSpawn()", this.ThingID ) );
     if( slotGroup != null )
     {
         slotGroup.Notify_ParentDestroying();
         slotGroup = null;
     }
     base.DeSpawn();
 }
コード例 #4
0
 public Zone_PresetStockpile(PresetZoneType preset, ZoneManager zoneManager) : base(Static.GetEnumDescription(preset), zoneManager)
 {
     zoneType          = preset;
     cells             = AllSlotCells().ToList();
     settings          = new StorageSettings(this);
     settings.filter   = SetFilterFromPreset(preset);
     settings.Priority = StoragePriority.Important;
     slotGroup         = new SlotGroup(this);
     color             = NextZoneColor;
 }
コード例 #5
0
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Deep.Look(ref settings, "settings", new object[] { this });
     if (Scribe.mode == LoadSaveMode.PostLoadInit)
     {
         slotGroup = new SlotGroup(this);
     }
     Scribe_Values.Look(ref zoneType, "zoneType", PresetZoneType.None);
 }
コード例 #6
0
        public static HashSet<Thing> TopThingInDeepStorage = new HashSet<Thing>(); // for display

        public static bool HasDeepStorageComp(SlotGroup slotGroup, out CompDeepStorage compDeepStorage) {
            if (slotGroup?.parent is ThingWithComps thingWithComps
                && (compDeepStorage = thingWithComps.TryGetComp<CompDeepStorage>()) != null)
            {
                return true;
            }

            compDeepStorage = null;
            return false;
        }
コード例 #7
0
        private void DefragStockpileCells()
        {
            CompRTQuantumStockpile sourceStockpile = compStockpiles[qsSourceIndex];
            CompRTQuantumStockpile targetStockpile = compStockpiles[qsTargetIndex];

            foreach (IntVec3 sourceCell in sourceStockpile.parent.OccupiedRect().Cells)
            {
                if (sparklesEnabled)
                {
                    sourceCell.ThrowSparkle(parent.Map);
                }
                List <Thing> sourceThingsWithChunks = sourceCell.GetItemList(parent.Map, true);
                foreach (Thing thing in sourceThingsWithChunks)
                {
                    if (thing.IsChunk())
                    {
                        QueueThing(thing);
                        return;
                    }
                }
                foreach (IntVec3 targetCell in targetStockpile.parent.OccupiedRect().Cells)
                {
                    List <Thing> targetThings = targetCell.GetItemList(parent.Map);
                    List <Thing> sourceThings = sourceCell.GetItemList(parent.Map);
                    Thing        targetThing  = (targetThings.Count == 0) ? (null) : (targetThings[0]);
                    Thing        sourceThing  = (sourceThings.Count == 0) ? (null) : (sourceThings[0]);
                    if (sourceThing != null && targetThings.Count < sourceThings.Count - 1 &&
                        targetCell.AllowedToAccept(parent.Map, sourceThing) &&
                        sourceThing.stackCount > 0)
                    {
                        sourceCell.ThrowDustPuff(parent.Map);
                        Thing thing = GenSpawn.Spawn(sourceThing.SplitOff(sourceThing.stackCount), targetCell, parent.Map);
                        targetCell.DropSound(parent.Map, thing.def);
                        SlotGroup slotGroup = targetCell.GetSlotGroup(parent.Map);
                        if (slotGroup != null && slotGroup.parent != null)
                        {
                            slotGroup.parent.Notify_ReceivedThing(thing);
                        }
                    }
                    else if (targetThing != null && sourceThings.Count < targetThings.Count - 1 &&
                             sourceCell.AllowedToAccept(parent.Map, targetThing) &&
                             targetThing.stackCount > 0)
                    {
                        targetCell.ThrowDustPuff(parent.Map);
                        Thing thing = GenSpawn.Spawn(targetThing.SplitOff(targetThing.stackCount), sourceCell, parent.Map);
                        sourceCell.DropSound(parent.Map, thing.def);
                        SlotGroup slotGroup = sourceCell.GetSlotGroup(parent.Map);
                        if (slotGroup != null && slotGroup.parent != null)
                        {
                            slotGroup.parent.Notify_ReceivedThing(thing);
                        }
                    }
                }
            }
        }
コード例 #8
0
        public static bool HasStackLimit(SlotGroup slotgroup)
        {
            if (slotgroup == null)
            {
                return(false);
            }

            var setting = slotgroup.Settings;

            return(HasLimit(setting));
        }
コード例 #9
0
        public static bool TryGetLimit(SlotGroup slotgroup, out int limit)
        {
            var  setting = slotgroup.Settings;
            bool result  = limits.TryGetValue(setting, out limit);

            if (!result)
            {
                limit = -1;
            }
            return(result);
        }
コード例 #10
0
        static void Postfix(SlotGroup sg, ListerHaulables __instance)
        {
            Map map = MapFieldInfo.GetValue(__instance) as Map;

            if (map == null)
            {
                throw new Exception($"Could not get map to change {sg.parent.SlotYielderLabel()} on...");
            }

            map.listerStackables().Update(sg);
        }
コード例 #11
0
        public static bool IsCachedDeepStorage(this SlotGroup slotGroup, out CompCachedDeepStorage comp)
        {
            if (slotGroup?.parent is Building_Storage building)
            {
                comp = building.TryGetComp <CompCachedDeepStorage>();
                return(comp != null);
            }

            comp = null;
            return(false);
        }
コード例 #12
0
        // duplicated to make changes
        public bool IsValidStorageFor(IntVec3 c, Thing storable)
        {
            // call duplicated to make changes
            if (!WorkGiver_HaulGeneral.NoStorageBlockersIn(c, storable))
            {
                return(false);
            }
            SlotGroup slotGroup = c.GetSlotGroup();

            return(slotGroup != null && slotGroup.Settings.AllowedToAccept(storable));
        }
コード例 #13
0
        internal static IEnumerable <Thing> GetStackables(SlotGroup storage)
        {
            // garbage in, slightly better garbage out
            if (storage?.HeldThings == null)
            {
                return(new List <Thing>());
            }

            return(storage.HeldThings.Where(thing => TheoreticallyStackable(thing) &&
                                            storage.HeldThings.Any(other => CanBeStackTarget(other, thing))));
        }
コード例 #14
0
 public bool ReceiveThing(Thing thingToReceive)
 {
     if (thingToReceive != null && !thingToReceive.IsChunk())
     {
         if (compWarehouse != null)
         {
             compWarehouse.buffer.RemoveAll(x => x == thingToReceive);
         }
         foreach (IntVec3 cellReceiving in parent.OccupiedRect().Cells)
         {
             if (cellReceiving.AllowedToAccept(parent.Map, thingToReceive) &&
                 cellReceiving.Priority(parent.Map) >= thingToReceive.Position.Priority(parent.Map))
             {
                 IntVec3      thingToReceiveCell = thingToReceive.Position;
                 List <Thing> thingsReceiving    = cellReceiving.GetItemList(parent.Map);
                 if (thingsReceiving.Count < maxStacks &&
                     thingToReceive.stackCount > 0)
                 {
                     thingToReceiveCell.ThrowDustPuff(parent.Map);
                     Thing thing = GenSpawn.Spawn(thingToReceive.SplitOff(thingToReceive.stackCount), cellReceiving, parent.Map);
                     cellReceiving.DropSound(parent.Map, thing.def);
                     SlotGroup slotGroup = cellReceiving.GetSlotGroup(parent.Map);
                     if (slotGroup != null && slotGroup.parent != null)
                     {
                         slotGroup.parent.Notify_ReceivedThing(thing);
                     }
                     return(true);
                 }
                 else
                 {
                     foreach (Thing thingReceiving in thingsReceiving)
                     {
                         if (thingReceiving.CanAbsorb(thingToReceive))
                         {
                             int thingReceivingStackCount = thingReceiving.stackCount;
                             if (thingReceiving.TryAbsorbStack(thingToReceive, true))
                             {
                                 thingToReceiveCell.ThrowDustPuff(parent.Map);
                             }
                             if (thingReceivingStackCount != thingReceiving.stackCount)
                             {
                                 ForbidUtility.SetForbidden(thingReceiving, false, false);
                                 cellReceiving.DropSound(parent.Map, thingReceiving.def);
                             }
                             return(true);
                         }
                     }
                 }
             }
         }
     }
     return(false);
 }
コード例 #15
0
        public static int TotalPrecalculatedItemsStack(this SlotGroup slotGroup, bool usePending = true)
        {
            if (slotGroup == null)
            {
                return(0);
            }

            int pending     = usePending ? PendingHaulJobsTracker.GetPendingStack(slotGroup) : 0;
            int inSlotGroup = HeldItemsCounter.GetTotalItemsStack(slotGroup);

            return(pending + inSlotGroup);
        }
コード例 #16
0
        public static int CalculateStackLimit(SlotGroup slotgroup)
        {
            if (slotgroup == null)
            {
                return(99999);
            }

            var setting = slotgroup.Settings;
            var limit   = GetLimit(setting);

            return(limit > 0 ? limit : 99999);
        }
コード例 #17
0
        public static Job HaulToCellStorageJob(Pawn p, Thing t, IntVec3 storeCell, bool fitInStoreCell)
        {
            Job       job       = new Job(JobDefOf.HaulToCell, t, storeCell);
            SlotGroup slotGroup = p.Map.haulDestinationManager.SlotGroupAt(storeCell);

            if (slotGroup != null)
            {
                Thing thing = p.Map.thingGrid.ThingAt(storeCell, t.def);
                if (thing != null)
                {
                    job.count = t.def.stackLimit;
                    if (fitInStoreCell)
                    {
                        job.count -= thing.stackCount;
                    }
                }
                else
                {
                    job.count = 99999;
                }
                int            num       = 0;
                float          statValue = p.GetStatValue(StatDefOf.CarryingCapacity, true);
                List <IntVec3> cellsList = slotGroup.CellsList;
                for (int i = 0; i < cellsList.Count; i++)
                {
                    if (StoreUtility.IsGoodStoreCell(cellsList[i], p.Map, t, p, p.Faction))
                    {
                        Thing thing2 = p.Map.thingGrid.ThingAt(cellsList[i], t.def);
                        if (thing2 != null && thing2 != t)
                        {
                            num += Mathf.Max(t.def.stackLimit - thing2.stackCount, 0);
                        }
                        else
                        {
                            num += t.def.stackLimit;
                        }
                        if (num >= job.count || (float)num >= statValue)
                        {
                            break;
                        }
                    }
                }
                job.count = Mathf.Min(job.count, num);
            }
            else
            {
                job.count = 99999;
            }
            job.haulOpportunisticDuplicates = true;
            job.haulMode = HaulMode.ToCellStorage;
            return(job);
        }
コード例 #18
0
        public void Notify_ComponentDeSpawned(Comp_CoordinatedAbstract component)
        {
            Type type = component.GetType();

            if (typeof(Comp_StorageInput).IsAssignableFrom(type))
            {
                Comp_StorageInput comp      = (Comp_StorageInput)component;
                SlotGroup         slotGroup = comp.GetSlotGroup();
                List <IntVec3>    cells;
                if (slotGroup != null && map_slotGroup_inputCells.TryGetValue(slotGroup, out cells))
                {
                    foreach (var cell in comp.specificCells)
                    {
                        cells.Remove(cell);
                    }
                    if (cells.Count == 0)
                    {
                        map_slotGroup_inputCells.Remove(slotGroup);
                    }
                }
                inputs.Remove(comp);
                unconnectedInputs.Remove(comp);
                map.slotGroupManager.Notify_GroupChangedPriority();
            }
            else if (typeof(Comp_StorageOutput).IsAssignableFrom(type))
            {
                outputs.Remove((Comp_StorageOutput)component);
                previousRootCell = IntVec3.Invalid;
            }
            else if (typeof(Comp_StorageAbstract).IsAssignableFrom(type))
            {
                Comp_StorageAbstract comp = (Comp_StorageAbstract)component;
                storages.Remove(comp);
                foreach (var reservation in reservations.ToList())
                {
                    if (reservation.storage == comp)
                    {
                        reservations.Remove(reservation);
                    }
                }
            }
            foreach (var cell in component.specificCells)
            {
                List <Comp_CoordinatedAbstract> compsInCell;
                map_cell_comps.TryGetValue(cell, out compsInCell);
                compsInCell.Remove(component);
                if (compsInCell.Count == 0)
                {
                    map_cell_comps.Remove(cell);
                }
            }
        }
コード例 #19
0
        // This gets checked a lot.  Sometimes the test is done in-place (if will
        //   need to use the slotGroup later, for example), but when using Harmony
        //   Transpiler, tests are easier via function call
        // Most of the bulk here is debugging stuff
        public static bool CanStoreMoreThanOneThingAt(Map map, IntVec3 loc)
        {
            SlotGroup slotGroup = loc.GetSlotGroup(map);

            if (slotGroup == null || !(slotGroup?.parent is ThingWithComps) ||
                (slotGroup.parent as ThingWithComps).TryGetComp <CompDeepStorage>() == null)
            {
                return(false);

                #pragma warning disable CS0162 // Unreachable code detected
                Log.Warning("CanStoreMoreThanOneThingAt: " + loc + "? false");
                return(false);

                if (slotGroup == null)
                {
                    Log.Warning("  null slotGroup");
                }
                else if (slotGroup.parent == null)
                {
                    Log.Warning("  null slotGroup.parent");
                }
                else if (!(slotGroup.parent is ThingWithComps))
                {
                    Log.Warning("  slotGroup.parent is not ThingWithComps");
                }
                else
                {
                    Log.Warning("  no CompDeepStorage");
                }
                Log.Warning("Just for the record, " + (Scribe.mode == LoadSaveMode.LoadingVars) +
                            (Scribe.mode == LoadSaveMode.PostLoadInit) +
                            Scribe.mode);
                List <Thing> l = map.thingGrid.ThingsListAt(loc);
                foreach (Thing t in l)
                {
                    Log.Error("Did find a " + t.ToString() + " here at " + loc.ToString());
                }
                return(false);
            }
            //            Log.Warning("CanStoreMoreThanOneThingAt: " + loc.ToString() + "? true");
            return(true);

            Log.Warning("CanStoreMoreThanOneThingAt: " + loc.ToString() + "? true!");
            List <Thing> lx = map.thingGrid.ThingsListAt(loc);
            foreach (Thing t in lx)
            {
                Log.Error("Did find a " + t.ToString() + " here at " + loc.ToString());
            }
            return(true);

            #pragma warning restore CS0162 // Unreachable code detected
        }
コード例 #20
0
 public static bool CanPlaceThingInSlotGroup(Thing t, SlotGroup slotGroup, Map map)
 {
     foreach (var c in slotGroup.CellsList)
     {
         if (CallNoStorageBlockersIn(c, map, t))
         {
             return(true);
         }
     }
     Debug.Message(Debug.Flag.PlaceThing, "There were StorageBlockersIn every cell of "
                   + slotGroup.parent + " - can not place" + t);
     return(false);
 }
コード例 #21
0
        public static Toil DropTheCarriedInCell(TargetIndex StoreCellInd, ThingPlaceMode placeMode, TargetIndex CarrierInd)
        {
            Toil toil = new Toil();

            toil.initAction = () =>
            {
                Pawn         actor   = toil.actor;
                Job          curJob  = actor.jobs.curJob;
                Vehicle_Cart carrier = actor.jobs.curJob.GetTarget(CarrierInd).Thing as Vehicle_Cart;
                if (carrier.storage.Count <= 0)
                {
                    return;
                }
                toil.actor.jobs.curJob.SetTarget(TargetIndex.A, carrier.storage.First());
                Thing   dropThing = toil.actor.jobs.curJob.targetA.Thing;
                IntVec3 destLoc   = actor.jobs.curJob.GetTarget(StoreCellInd).Cell;
                Thing   dummy;

                SlotGroup slotGroup = Find.SlotGroupManager.SlotGroupAt(destLoc);
                //    if (destLoc.GetStorable() == null)
                if (slotGroup != null && slotGroup.Settings.AllowedToAccept(dropThing))
                {
                    Find.DesignationManager.RemoveAllDesignationsOn(dropThing);
                    carrier.storage.TryDrop(dropThing, destLoc, placeMode, out dummy);
                }

                //Check cell queue is adjacent
                List <TargetInfo> cells = curJob.GetTargetQueue(StoreCellInd);
                for (int i = 0; i < cells.Count && i < carrier.storage.Count; i++)
                {
                    if (destLoc.AdjacentTo8Way(cells[i].Cell) && cells[i].Cell.GetStorable() == null)
                    {
                        Find.DesignationManager.RemoveAllDesignationsOn(carrier.storage[i]);
                        carrier.storage.TryDrop(carrier.storage[i], cells[i].Cell, ThingPlaceMode.Direct, out dummy);
                        cells.RemoveAt(i);
                        i--;
                    }
                }
                //Check item queue is valid storage for adjacent cell
                foreach (IntVec3 adjCell in GenAdj.CellsAdjacent8Way(destLoc))
                {
                    if (carrier.storage.Count > 0 && adjCell.GetStorable() == null && adjCell.IsValidStorageFor(carrier.storage.First()))
                    {
                        Find.DesignationManager.RemoveAllDesignationsOn(carrier.storage.First());
                        carrier.storage.TryDrop(carrier.storage.First(), adjCell, ThingPlaceMode.Direct, out dummy);
                    }
                }
            };
            toil.FailOnDestroyedOrNull(CarrierInd);
            return(toil);
        }
コード例 #22
0
        internal void Update(SlotGroup slotgroup)
        {
            // get list of current stackables
            var currentStackables = GetStackables(slotgroup);

            // add things in current not in the list
            foreach (Thing stackable in currentStackables)
            {
                if (!stackables.Contains(stackable))
                {
                    stackables.Add(stackable);
                }
            }
        }
コード例 #23
0
        public static StoragePriority StoragePriorityAtFor(IntVec3 c, Thing t)
        {
            if (!t.Spawned)
            {
                return(StoragePriority.Unstored);
            }
            SlotGroup slotGroup = t.Map.slotGroupManager.SlotGroupAt(c);

            if (slotGroup != null && slotGroup.Settings.AllowedToAccept(t))
            {
                return(slotGroup.Settings.Priority);
            }
            return(StoragePriority.Unstored);
        }
コード例 #24
0
 public static void Postfix(SaveReason reason, SlotGroup __result)
 {
     if (ModSettings.AutosaveMapping.ContainsKey(reason))
     {
         if (ModSettings.AutosaveMapping[reason] != __result)
         {
             Logger.InfoLine(MethodBase.GetCurrentMethod());
             Logger.Minimal("Reason: " + reason);
             Logger.Minimal("SlotGroup expected: " + ModSettings.AutosaveMapping[reason]);
             Logger.Minimal("SlotGroup Actual: " + __result);
             Logger.EndLine();
         }
     }
 }
コード例 #25
0
        public int GetMeatInCorpses()
        {
            // get current count + corpses in storage that is not a grave + designated count
            // current count in storage
            var count = 0;

            // try get cached value
            if (_corpseCachedValue.TryGetValue(out count))
            {
                return(count);
            }

            // corpses not buried / forbidden
            foreach (Thing current in Corpses)
            {
                // make sure it's a real corpse. (I dunno, poke it?)
                // and that it's not forbidden (anymore) and can be reached.
                var corpse = current as Corpse;
                if (corpse != null &&
                    !corpse.IsForbidden(Faction.OfPlayer) &&
                    manager.map.reachability.CanReachColony(corpse.Position))
                {
                    // check to see if it's buried.
                    var       buried           = false;
                    SlotGroup slotGroup        = manager.map.haulDestinationManager.SlotGroupAt(corpse.Position);
                    var       building_Storage = slotGroup?.parent as Building_Storage;

                    // Sarcophagus inherits grave
                    if (building_Storage != null &&
                        building_Storage.def == ThingDefOf.Grave)
                    {
                        buried = true;
                    }

                    // get the rottable comp and check how far gone it is.
                    var rottable = corpse.TryGetComp <CompRottable>();

                    if (!buried && rottable?.Stage == RotStage.Fresh)
                    {
                        count += corpse.EstimatedMeatCount();
                    }
                }
            }

            // set cache
            _corpseCachedValue.Update(count);

            return(count);
        }
コード例 #26
0
 private void DrawContainer()
 {
     // Dispose of old information.
     container?.Dispose();
     container = new SlotGroup(new RenderedSlot[selectedWinow.slotCount], SlotGroupType.chest, selectedWinow);
     // Draw grid.
     for (int y = 0; y < selectedWinow.slotCount / 9; y++)
     {
         for (int x = 0; x < 9; x++)
         {
             yoff = Y_OFFSET + y * SIZE;
             container.Add(CreateSlot(x * SIZE, yoff, (byte)(y * 9 + x)));
         }
     }
 }
コード例 #27
0
        static public List <Thing> ThingListToDisplay(Map map, IntVec3 loc)
        {
            CompDeepStorage cds;
            ThingWithComps  building;
            SlotGroup       slotGroup = loc.GetSlotGroup(map);

            if (slotGroup == null || (building = (slotGroup.parent as ThingWithComps)) == null ||
                (cds = (slotGroup.parent as ThingWithComps).TryGetComp <CompDeepStorage>()) == null ||
                cds.showContents)
            {
                return(map.thingGrid.ThingsListAt(loc));
            }
            // only return non-storable things to be drawn:
            return(map.thingGrid.ThingsListAt(loc).FindAll(t => !t.def.EverStorable(false)));
        }
コード例 #28
0
        static List <IntVec3> PresortCells(List <IntVec3> cells, Map map, SlotGroup slotGroup)
        {
            List <IntVec3> extraCells = slotGroup.GetStorageInputCells();

            if (extraCells != null)
            {
                List <IntVec3> copyCells = new List <IntVec3>(cells);
                foreach (var cell in extraCells)
                {
                    copyCells.Insert(0, cell);
                }
                return(copyCells);
            }
            return(cells);
        }
コード例 #29
0
        // checks all existing stacks at c and if one needs refilled numDesired is exactly how many
        // return false on error or if no matching stacks
        // returns true on success and sets numDesired (even if it is 0)
        public static bool TryGetStackRefillThresholdDesired(this IntVec3 cell, SlotGroup slotGroup, Map map, Thing thing, int srt, out int numDesired)
        {
            numDesired = 0;
            Thing lowestQtyThing = null;

            List <Thing> things = map.thingGrid.ThingsListAt(cell);

            for (int i = 0; i < things.Count; i++)
            {
                Thing t = things[i];
                if (!t.def.EverStorable(false))
                {
                    continue;                             // skip non-storable things as they aren't actually *in* the stockpile
                }
                if (!t.CanStackWith(thing))
                {
                    continue;                         // skip it if it cannot stack with thing to haul
                }
                // at this point we have a similar stack so save it here and search the rest of things
                // and only work on the similar stack that has the lowest count (in case there are say 3x stacks in one cell)
                // which will refill the lowest stacks first then continue to the highest stacks in the cell
                if (lowestQtyThing == null)
                {
                    lowestQtyThing = t;
                }
                else if (t.stackCount < lowestQtyThing.stackCount)
                {
                    lowestQtyThing = t;
                }
            }

            // didn't find anything with similar stacks
            if (lowestQtyThing == null)
            {
                return(false);
            }

            // we have at least one similar stack, so figure out if it wants anything or not
            if (lowestQtyThing.stackCount > (lowestQtyThing.def.stackLimit * srt / 100f))
            {
                numDesired = 0;
            }
            else
            {
                numDesired = (lowestQtyThing.def.stackLimit - lowestQtyThing.stackCount);
            }
            return(true);
        }
コード例 #30
0
        public static bool Prefix(Pawn pawn, Thing thing, ref Job __result)
        {
            StoragePriority currentPriority = StoreUtility.CurrentStoragePriorityOf(thing);

            if (StoreUtility.TryFindBestBetterStoreCellFor(thing, pawn, pawn.Map, currentPriority, pawn.Faction, out IntVec3 storeCell, true))
            {
                SlotGroup slotGroup = StoreUtility.GetSlotGroup(storeCell, thing.Map);
                if (Limits.HasLimit(slotGroup.Settings))
                {
                    __result = HaulAIUtility.HaulToStorageJob(pawn, thing);
                    return(false);
                }
            }

            return(true);
        }
コード例 #31
0
        public static void UpdateSlotGroup(Map map, SlotGroup slotGroup)
        {
            Dictionary <SlotGroup, int> dk = null;

            if (!heldItems.ContainsKey(map))
            {
                dk             = new Dictionary <SlotGroup, int>();
                heldItems[map] = dk;
            }
            else
            {
                dk = heldItems[map];
            }

            dk[slotGroup] = slotGroup.TotalHeldItemsStack();
        }
コード例 #32
0
ファイル: Building_Storage.cs プロジェクト: raimis001/raWorld
    public override void SpawnSetup()
    {
        base.SpawnSetup();
        slotGroup = new SlotGroup(this);

        cachedOccupiedSquares = AllSlotSquares().ToList();
    }
コード例 #33
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     slotGroup = new SlotGroup((ISlotGroupParent) this);
     cachedOccupiedCells = this.OccupiedRect().Cells;
 }
コード例 #34
0
        public DataCollection<CommonSearchClass> GetTargetVonBis
            (SlotGroup TargetSlot, DateTime? From = null, DateTime? To = null, int MaxNumber = 10)
            {
			Data.DbServer3.WPMediaAddOnData.LoadAll_IfHasNotBeenLoaded();
			Data.DbServer3.MultiMedia.LoadAll_IfHasNotBeenLoaded();
			String SpecificWhereAddOn = String.Empty;
			List<String> TableNames = new List<string>();
			List<Guid> MMUnitTypenIds = new List<Guid>();
	        if (TargetSlot == SlotGroup.NoInformation)
		        {
		        SpecificWhereAddOn = $" TypID = '{DataDependencyEnums.FDDIDsForNichtDefiniert.TypNichtDefiniert}' ";

		        }
			else
	            {
				foreach (TableDefinition tableDefinition in Data.DbServer3.WPMediaAddOnData.TableDefinitions
					.Where(sel => sel.SlotGroup == TargetSlot.ToString()))
					{
					TableNames.Add(tableDefinition.TableName);
					MMUnitTypenIds.Add(tableDefinition.Id);
					}

				SpecificWhereAddOn = " ID in "
							+ "(select InformationenID from InformationenAddOn where Tabelle = 'ProcessConnector' and ID in "
							+ "(select InformationenAddOnID from ProcessConnector "
							+ "where (not TableID is NULL and not TableID = '00000000-0000-0000-0000-000000000000') "
							+ "and (TableName = '" + String.Join("' or TableName = '", TableNames) + "')))";

				}
			DataCollection<CommonSearchClass> Result = DataModell.CommonSearchClassCacheInstance.GetVonBisAllAdvanced
                (DateTime.Now.AddDays(-2).Date, DateTime.Now.AddMonths(3).Date, null, null, SpecificWhereAddOn);
			List<Guid> InformationenGuids = new List<Guid>();
			foreach (CommonSearchClass commonSearchClass in Result)
		        {
				InformationenGuids.Add(commonSearchClass.InformationenConnectedEntry.ID);
				}
	        if (InformationenGuids.Count > 0)
		        {
				DbEntities.dbserver3.alterlaainfo.rows.Timing[] AssoziatedTimings = Data.DbServer3.AltErlaaInfo.Timings
								.Load_via_ConnectedIds(InformationenGuids);
				foreach (CommonSearchClass commonSearchClass in Result)
					{
					foreach (DbEntities.dbserver3.alterlaainfo.rows.Timing timing in AssoziatedTimings
						.Where(sel => sel.ConnectedId == commonSearchClass.InformationenConnectedEntry.ID))
						{
						commonSearchClass.InformationenTimings.Add(timing);
						}
					}
				}
			DataCollection<CommonSearchClass> ResultWithoutInformation = new DataCollection<CommonSearchClass>();
			List<Guid> MMUnitGuids = new List<Guid>();
			foreach (MMUnit mMUnit in Data.DbServer3.MultiMedia.MMUnits
		        .GetMMUnitsWithoutInformation(DateTime.Now.AddDays(-2).Date, DateTime.Now.AddMonths(3).Date,
					new List<string>( ) { "EventVonBis", "AktivVonBis", "AnzVonBis", "VonBis" }, TableNames))
				{
				ResultWithoutInformation.Add(new CommonSearchClass(mMUnit));
				MMUnitGuids.Add(mMUnit.Id);
				}
	        foreach (CommonSearchClass commonSearchClass in ResultWithoutInformation)
		        {
		        foreach (MMUnitTiming mmUnitTiming in Data.DbServer3.MultiMedia.MMUnitTimings
						.Where(sel => sel.MMUnitId == commonSearchClass.MMUnitConnectedEntry.Id))
			        {
			        commonSearchClass.MmUnitTimings.Add(mmUnitTiming);

			        }
		        }
			Result.AddRange(ResultWithoutInformation);

			return new DataCollection<CommonSearchClass>(Result.OrderBy(ord => ord.TimeA).ToList());

			}
コード例 #35
0
 public override void SpawnSetup()
 {
     //Log.Message( string.Format( "{0}.SpawnSetup()", this.ThingID ) );
     base.SpawnSetup();
     cachedOccupiedCells = this.OccupiedRect().Cells;
     slotGroup = new SlotGroup( (ISlotGroupParent) this );
 }