public override void Tick(Quest caller) { base.Tick(caller); // Auto-assign NPC to home Place if available and player enters // This only happens for very specific NPC types // Equivalent to calling "place anNPC at aPlace" from script // Will not be called again as assignment is permanent for duration of quest if (homePlaceSymbol != null && !assignedToHome) { Place home = ParentQuest.GetPlace(homePlaceSymbol); if (home == null) { return; } if (home.IsPlayerHere()) { // Create SiteLink if not already present if (!QuestMachine.HasSiteLink(ParentQuest, homePlaceSymbol)) { QuestMachine.CreateSiteLink(ParentQuest, homePlaceSymbol); } // Hot-place NPC at this location home.AssignQuestResource(Symbol); assignedToHome = true; } } }
/// <summary> /// Places NPC to home. This can happen automatically when player enters building or when /// quest script uses "create npc" action to automatically assign Person to home. /// </summary> public bool PlaceAtHome() { // Does not attempt to place a questor as they should be statically place or moved manually Place homePlace = ParentQuest.GetPlace(homePlaceSymbol); if (homePlace == null || isQuestor) { return(false); } // Create SiteLink if not already present if (!QuestMachine.HasSiteLink(ParentQuest, homePlaceSymbol)) { QuestMachine.CreateSiteLink(ParentQuest, homePlaceSymbol); } // Assign to home place homePlace.AssignQuestResource(Symbol); SetAssignedPlaceSymbol(homePlace.Symbol); assignedToHome = true; return(true); }
/// <summary> /// Places NPC to home. This can happen automatically when player enters building or when /// quest script uses "create npc" action to automatically assign Person to home. /// </summary> public bool PlaceAtHome() { // Does not attempt to place a questor as they should be statically placed or moved manually // Individual NPCs are also excluded as they are either automatically at home or moved elsewhere by quest Place homePlace = ParentQuest.GetPlace(homePlaceSymbol); if (homePlace == null || isQuestor || isIndividualNPC) { return(false); } // Create SiteLink if not already present if (!QuestMachine.HasSiteLink(ParentQuest, homePlaceSymbol)) { QuestMachine.CreateSiteLink(ParentQuest, homePlaceSymbol); } // Assign to home place homePlace.AssignQuestResource(Symbol); SetAssignedPlaceSymbol(homePlace.Symbol); assignedToHome = true; return(true); }