コード例 #1
0
        public override void Arrived(Caravan caravan)
        {
            var          comp      = ((DoomsdaySite)mapParent).GetComponent <DoomsdayUltimatumComp>();
            int          remaining = 50000 - comp.FactionSilver;
            List <Thing> list      = CaravanInventoryUtility.TakeThings(caravan, (Thing thing) =>
            {
                if (thing.def == ThingDefOf.Silver)
                {
                    int num    = Mathf.Min(remaining, thing.stackCount);
                    remaining -= num;
                    return(num);
                }

                return(0);
            });

            for (int i = 0; i < list.Count; i++)
            {
                list[i].Destroy();
            }

            Find.LetterStack.ReceiveLetter("RansomCompleteTitle".Translate(), "RansomComplete".Translate(), LetterDefOf.PositiveEvent);

            Find.WorldObjects.Remove(mapParent);
        }
コード例 #2
0
        public override void Arrived(Caravan caravan)
        {
            List <Thing> list = CaravanInventoryUtility.TakeThings(caravan, (Thing thing) =>
            {
                if (quest.RequestItems.ContainsKey(thing.def))
                {
                    int remaining = quest.RequestItems[thing.def];

                    int num    = Mathf.Min(remaining, thing.stackCount);
                    remaining -= num;
                    quest.RequestItems[thing.def] = remaining;

                    return(num);
                }

                return(0);
            });

            for (int i = 0; i < list.Count; i++)
            {
                list[i].Destroy();
            }

            QuestSite site = (QuestSite)mapParent;

            site.EndQuest(caravan, EndCondition.Success);
        }