コード例 #1
0
ファイル: NanoBed.cs プロジェクト: cmdprompt/NanoRepairTech
        //===============================================================================\\

        public override void ExposeData()
        {
            base.ExposeData();

            if (Scribe.mode == LoadSaveMode.Saving && this.Spawned)
            {
                List <int> possibleIDs = new List <int>();
                foreach (Pawn p in new List <Pawn>(this.AssignedPawns).Where(x => x != null))
                {
                    if (p.apparel != null)
                    {
                        foreach (Apparel a in new List <Apparel>(p.apparel.WornApparel).Where(x => x != null))
                        {
                            possibleIDs.Add(a.thingIDNumber);
                        }
                    }

                    if (p.equipment != null)
                    {
                        foreach (Thing w in new List <Thing>(p.equipment.GetDirectlyHeldThings()).Where(x => x != null))
                        {
                            possibleIDs.Add(w.thingIDNumber);
                        }
                    }
                }

                _nano.CleanUpTickTracker(possibleIDs);
            }
            _nano.Persist();
        }
コード例 #2
0
        //===============================================================================\\

        public override void ExposeData()
        {
            base.ExposeData();

            // this appears to take a huge shit on itself
            // if offered as a quest reward, presumably because
            // the same code paths are not followed? when
            // checking to see if it's spawned first seems to fix it
            if (Scribe.mode == LoadSaveMode.Saving && this.Spawned)
            {
                SlotGroup group = this.GetSlotGroup();
                if (group != null && group.HeldThings != null)
                {
                    _nano.CleanUpTickTracker(new List <Thing>(group.HeldThings)
                                             .Where(x => x != null)
                                             .Select(x => x.thingIDNumber)
                                             );
                }
            }
            _nano.Persist();
        }