예제 #1
0
		public bool RunCommon()
		{
			if (mObjectsToPlant == null || mObjectsToPlant.Count == 0)
			{
				return false;
			}
			EWHerbLoreSkill skill = EWHerbLoreSkill.StartSkillGain(Actor);
			if (skill != null)
			{
				while (mObjectsToPlant.Count > 0)
				{
					PlantableObjectData data = mObjectsToPlant[0];
					CurrentTarget = data.PlantableObject;
					CurrentSoil = data.Soil;
					if (Plant.DoPlantRoute(Actor, CurrentSoil))
					{
						UnreservePlantablePlantingSucceeded();
						Plant plant = CreatePlantFromSeed(CurrentTarget, CurrentSoil, Actor);
						plant.UpdateHealth();
						plant.AddToUseList(Actor);
						AcquireStateMachine("eatharvestablepet");
						mCurrentStateMachine.SetActor("x", Actor);
						mCurrentStateMachine.EnterState("x", "Enter");
						SetParameter("IsEatingOnGround", paramValue: true);
						// Parrotting the dummyIK code from the plantMedium state machine
						mDummyIk = Soil.Create(isDummyIk: true);
						//mDummyIk.SetHiddenFlags(-1);
						mDummyIk.SetPosition(plant.GetSoil().Position);
						Vector3 forward = plant.GetSoil().Position - Actor.Position;
						mDummyIk.SetForward(forward);
						mDummyIk.AddToWorld();
						BeginCommodityUpdates();
						AddOneShotScriptEventHandler(201u, new SacsEventHandler(ScriptHandlerOnSimAboutToPlant));
						AnimateSim("EatHarvestable");
						skill.Planted(plant);
						AnimateSim("Exit");
						EndCommodityUpdates(succeeded: true);
						plant.RemoveFromUseList(Actor);
						CurrentSoil.RemoveFromUseList(Actor);
						if (mDummyIk != null)
						{
							mDummyIk.Destroy();
							mDummyIk = null;
						}
						EventTracker.SendEvent(EventTypeId.kGardened, Actor);
						if (PlantHelper.IsSeed(CurrentTarget))
						{
							EventTracker.SendEvent(EventTypeId.kEventSeedPlanted, Actor, CurrentTarget);
						}
						EventTracker.SendEvent(EventTypeId.kPlantedObject, Actor, plant);
					}
					else
					{
						CleanupPlantInstances(data, Actor, PlantInteractionType);
						mObjectsToPlant.RemoveAt(0);
					}
				}
				skill.StopSkillGain();
				skill.AddSkillPointsLevelClamped(200, 10); // Bonus, Planting takes animal thinking
				return true;
			}
			return false;
		}