Пример #1
0
        // Before an orbital trade
        static void Postfix(ref IEnumerable <Thing> __result, Pawn playerNegotiator)
        {
            if (!Settings.ActAsBeacon)
            {
                return;
            }

            List <Thing> things = null;

            Log.Message(playerNegotiator.Name.ToStringFull);
            if (playerNegotiator != null && playerNegotiator.Map != null)
            {
                foreach (var thing in FridgeCache.GetBuildingsForMap(playerNegotiator.Map.Index))
                {
                    foreach (IntVec3 cell in thing.AllSlotCells())
                    {
                        foreach (Thing refrigeratedItem in playerNegotiator.Map.thingGrid.ThingsAt(cell))
                        {
                            if (thing.settings.AllowedToAccept(refrigeratedItem))
                            {
                                if (things == null)
                                {
                                    if (__result?.Count() == 0)
                                    {
                                        things = new List <Thing>();
                                    }
                                    else
                                    {
                                        things = new List <Thing>(__result);
                                    }
                                }

                                things.Add(refrigeratedItem);
                                break;
                            }
                        }
                    }
                }
            }

            if (things != null)
            {
                __result = things;
            }
        }