Beispiel #1
0
        public override void Entry()
        {
            this.ai = new AI_StateMachine(this.StateMachine.Companion, this.StateMachine.CompanionManager.Farmer, this.Events, this.StateMachine.Monitor);

            this.StateMachine.Companion.faceTowardFarmerTimer = 0;
            this.StateMachine.Companion.movementPause         = 0;
            this.StateMachine.Companion.followSchedule        = false;
            this.StateMachine.Companion.Schedule            = null;
            this.StateMachine.Companion.controller          = null;
            this.StateMachine.Companion.temporaryController = null;
            this.StateMachine.Companion.eventActor          = true;
            this.StateMachine.Companion.farmerPassesThrough = true;

            this.Events.GameLoop.UpdateTicked += this.GameLoop_UpdateTicked;
            this.Events.GameLoop.TimeChanged  += this.GameLoop_TimeChanged;
            this.Events.Player.Warped         += this.Player_Warped;

            if (this.BuffManager.HasAssignableBuffs())
            {
                this.BuffManager.AssignBuffs();
            }
            else
            {
                this.StateMachine.Monitor.Log($"Companion {this.StateMachine.Name} has no buffs defined!", LogLevel.Alert);
            }

            if (DialogueHelper.GetVariousDialogueString(this.StateMachine.Companion, "companionRecruited", out string dialogueText))
            {
                this.StateMachine.Companion.setNewDialogue(dialogueText);
            }
            this.CanCreateDialogue = true;

            this.ai.Setup();
        }
Beispiel #2
0
        public override void Entry()
        {
            this.ai = new AI_StateMachine(this.StateMachine, this.StateMachine.CompanionManager.Hud, this.Events, this.monitor);

            if (this.StateMachine.Companion.doingEndOfRouteAnimation.Value)
            {
                this.FinishScheduleAnimation();
            }

            this.StateMachine.Companion.faceTowardFarmerTimer = 0;
            this.StateMachine.Companion.movementPause         = 0;
            this.StateMachine.Companion.followSchedule        = false;
            this.StateMachine.Companion.Schedule            = null;
            this.StateMachine.Companion.controller          = null;
            this.StateMachine.Companion.temporaryController = null;
            this.StateMachine.Companion.eventActor          = true;
            this.StateMachine.Companion.farmerPassesThrough = true;

            if (this.StateMachine.Companion.isMarried() && Patches.SpouseReturnHomePatch.recruitedSpouses.IndexOf(this.StateMachine.Companion.Name) < 0)
            {
                // Avoid returning recruited wife/husband to FarmHouse when is on Farm and it's after 1pm
                Patches.SpouseReturnHomePatch.recruitedSpouses.Add(this.StateMachine.Companion.Name);
            }

            this.Events.GameLoop.UpdateTicked   += this.GameLoop_UpdateTicked;
            this.Events.GameLoop.TimeChanged    += this.GameLoop_TimeChanged;
            this.Events.Player.Warped           += this.Player_Warped;
            this.SpecialEvents.RenderedLocation += this.SpecialEvents_RenderedLocation;

            if (DialogueHelper.GetVariousDialogueString(this.StateMachine.Companion, "companionRecruited", out string dialogueText))
            {
                this.StateMachine.Companion.setNewDialogue(dialogueText);
            }
            this.CanCreateDialogue = true;

            foreach (string skill in this.StateMachine.Metadata.PersonalSkills)
            {
                string text = this.StateMachine.ContentLoader.LoadString($"Strings/Strings:skill.{skill}", this.StateMachine.Companion.displayName)
                              + Environment.NewLine
                              + this.StateMachine.ContentLoader.LoadString($"Strings/Strings:skillDescription.{skill}").Replace("#", Environment.NewLine);
                this.StateMachine.CompanionManager.Hud.AddSkill(skill, text);
            }

            this.StateMachine.CompanionManager.Hud.AssignCompanion(this.StateMachine.Companion);
            this.BuffManager.AssignBuffs();
            this.ai.Setup();
        }