Ejemplo n.º 1
0
        public void Start()
        {
            if (Started)
            {
                Log.Error("Quest already started: " + Name);
                return;
            }

            state      = QuestState.Started;
            expireTime = Find.TickManager.TicksGame + RandomExpiryTicks();
            Find.World.GetComponent <WorldComponent_QuestTracker>().quests.Add(this);
            foreach (var part in def.questParts)
            {
                part.OnStart(this);
            }

            var slate = new Slate();

            handle                 = RimWorld.QuestUtility.GenerateQuestAndMakeAvailable(DefDatabase <QuestScriptDef> .GetNamed("CityQuest"), slate);
            handle.name            = Name;
            handle.description     = DetailText;
            handle.challengeRating = ChallengeRating;
            OnSetupHandle(handle);
            handle.Initiate();

            OnStart();
        }
Ejemplo n.º 2
0
        public void Add(Quest quest)
        {
            if (quest == null)
            {
                Log.Error("Tried to add a null quest.");
                return;
            }
            if (Contains(quest))
            {
                Log.Error("Tried to add the same quest twice: " + quest.ToStringSafe());
                return;
            }
            quests.Add(quest);
            AddToCache(quest);
            Find.SignalManager.RegisterReceiver(quest);
            List <QuestPart> partsListForReading = quest.PartsListForReading;

            for (int i = 0; i < partsListForReading.Count; i++)
            {
                partsListForReading[i].PostQuestAdded();
            }
            if (quest.initiallyAccepted)
            {
                quest.Initiate();
            }
        }