private bool DoHarvestEx() { Soil soil; Target.RemoveHarvestStateTimeoutAlarm(); StandardEntry(); BeginCommodityUpdates(); StateMachineClient stateMachine = Target.GetStateMachine(Actor, out soil); mDummyIk = soil; bool hasHarvested = true; if (Actor.IsInActiveHousehold) { hasHarvested = false; foreach (SimDescription description in Actor.Household.SimDescriptions) { Gardening skill = description.SkillManager.GetSkill <Gardening>(SkillNames.Gardening); if ((skill != null) && skill.HasHarvested()) { hasHarvested = true; break; } } } if (stateMachine != null) { stateMachine.RequestState("x", "Loop Harvest"); } Plant.StartStagesForTendableInteraction(this); while (!Actor.WaitForExitReason(Sim.kWaitForExitReasonDefaultTime, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached))) { if ((ActiveStage != null) && ActiveStage.IsComplete((InteractionInstance)this)) { Actor.AddExitReason(ExitReason.StageComplete); } } Plant.PauseTendGardenInteractionStage(Actor.CurrentInteraction); if (Actor.HasExitReason(ExitReason.StageComplete)) { HarvestPlantEx.DoHarvest(Target, Actor, hasHarvested, mBurglarSituation); } if (stateMachine != null) { stateMachine.RequestState("x", "Exit Standing"); } EndCommodityUpdates(true); StandardExit(); Plant.UpdateTendGardenTimeSpent(this, new Plant.UpdateTendGardenTimeSpentDelegate(HarvestPlant.Harvest.SetHarvestTimeSpent)); return(Actor.HasExitReason(ExitReason.StageComplete)); }
public override bool Run() { try { if (!Target.RouteSimToMeAndCheckInUse(Actor) || !HarvestPlant.HarvestTest(Target, Actor)) { return(false); } Target.RemoveHarvestStateTimeoutAlarm(); StandardEntry(); BeginCommodityUpdates(); Soil dummyIk = null; StateMachineClient client = null; bool allowChild = false; if (Actor.SimDescription.YoungAdultOrAbove) { allowChild = true; } else if ((Actor.SimDescription.Teen) && (Woohooer.Settings.mUnlockTeenActions)) { allowChild = true; } if ((!Autonomous) && (allowChild) && RandomUtil.RandomChance01(kChanceToHavePlantSimBaby)) { client = Target.CreateStateMachine(Actor, out dummyIk); mDummyIk = dummyIk; Sim newBorn = GetNewBorn(); Relationship.Get(Actor, newBorn, true).LTR.ForceChangeState(LongTermRelationshipTypes.Friend); if (newBorn.BridgeOrigin != null) { newBorn.BridgeOrigin.MakeRequest(); newBorn.BridgeOrigin = null; } if (client != null) { IGameObject actor = GlobalFunctions.CreateObjectOutOfWorld("plantSimHarvestable", ProductVersion.EP9, "Sims3.Gameplay.Core.Null", null); client.SetActor("harvestable", actor); client.SetActor("y", newBorn); client.EnterState("x", "Enter Standing"); Target.SetGrowthState(PlantGrowthState.Planted); client.RequestState("x", "HaveAPlantSimBaby"); Pregnancy.MakeBabyVisible(newBorn); client.RequestState("x", "Exit Standing"); actor.RemoveFromWorld(); actor.Destroy(); } if (Actor.IsSelectable) { OccultImaginaryFriend.DeliverDollToHousehold(new List <Sim>(new Sim[] { newBorn })); } ChildUtils.CarryChild(Actor, newBorn, true); EventTracker.SendEvent(EventTypeId.kBornFromTheSoil, newBorn); } else { client = Target.CreateStateMachine(Actor, out dummyIk); mDummyIk = dummyIk; bool hasHarvested = true; if (Actor.IsInActiveHousehold) { hasHarvested = false; foreach (SimDescription description in Actor.Household.SimDescriptions) { Gardening skill = description.SkillManager.GetSkill <Gardening>(SkillNames.Gardening); if ((skill != null) && skill.HasHarvested()) { hasHarvested = true; break; } } } IGameObject obj3 = GlobalFunctions.CreateObjectOutOfWorld("plantForbiddenFruit", ProductVersion.EP9, "Sims3.Gameplay.Core.Null", null); if (client != null) { client.SetActor("harvestable", obj3); client.EnterState("x", "Enter Standing"); client.RequestState("x", "HaveAFruit"); } Target.DoHarvest(Actor, hasHarvested, null); Target.SetGrowthState(PlantGrowthState.Planted); if (client != null) { client.RequestState("x", "Exit Standing"); } obj3.RemoveFromWorld(); obj3.Destroy(); } EndCommodityUpdates(true); StandardExit(); Target.RemoveFromWorld(); Target.Destroy(); return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }