public override bool Run() { try { if (!Target.RouteToWorkbench(Actor)) { return(false); } mMakeFemale = Target.mIsMakingFemaleFrankensim; mInventSkill = Actor.SkillManager.AddElement(SkillNames.Inventing) as InventingSkill; bool flag = Target.mInventionProgress > 0f; if (!flag) { Definition interactionDefinition = InteractionDefinition as Definition; mMakeFemale = interactionDefinition.MakeFemale; Target.mIsMakingFemaleFrankensim = mMakeFemale; ConsumeIngredients(); } StandardEntry(); Target.mIsMakingFrankensim = true; Target.mFrankenSimInventorSimId = Actor.SimDescription.SimDescriptionId; StartStages(); mTimeUntilModelSwap = GetTimeForNextModelChange(); EnterStateMachine("WorkbenchInvention", "Enter", "x", "workstation"); SetParameter("shouldSwipe", !flag); SetParameter("skillLevel", InventionWorkbench.GetSkillLevelParam(mInventSkill)); if (!flag) { AddSynchronousOneShotScriptEventHandler(0x67, OnAnimationEvent); } mTotalTime = GetTimeToCompletion(); AnimateSim("Loop Invent"); BeginCommodityUpdates(); if (Actor.SimDescription.TeenOrAbove) { Actor.SkillManager.StartGainWithoutSkillMeter(SkillNames.Handiness, InventionWorkbench.kHandinessSkillGainRateDuringMake, true); } bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), MakeLoopCallback, mCurrentStateMachine); if (Actor.SimDescription.TeenOrAbove) { Actor.SkillManager.StopSkillGain(SkillNames.Handiness); } EndCommodityUpdates(succeeded); AnimateSim("Exit"); if (!mRecipeKnown && !Actor.OpportunityManager.HasOpportunity(OpportunityNames.EP2_SkillInventing_Frankensim4)) { Target.ScrapCurrentInvention(); } if (Target.mInventionProgress >= 1f) { Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.Gameplay.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Gameplay); RouteAwayFromTable(); Target.mDummyModel.UnParent(); Target.mDummyModel.Destroy(); Target.mDummyModel = null; Target.mInventionProgress = 0f; Target.mIsMakingFrankensim = false; Target.mFrankenSimInventorSimId = 0x0L; Target.mIsMakingFemaleFrankensim = false; Target.mWasFinishedByGnome = false; Target.mIsMakingCheapToy = false; CASAgeGenderFlags gender = mMakeFemale ? CASAgeGenderFlags.Female : CASAgeGenderFlags.Male; mFrankensim = OccultFrankenstein.CreateFrankenStein(Actor, gender); mFrankensim.FadeOut(false, false, 0f); mFrankensim.GreetSimOnLot(Target.LotCurrent); mFrankensim.SetPosition(Target, Slot.RoutingSlot_1); mFrankensim.SetForward((Vector3)(Slots.GetForwardOfSlot(Target.ObjectId, Slot.RoutingSlot_1) * -1f)); mFrankensim.AddToWorld(); InventingSkill skill = Actor.SkillManager.GetSkill <InventingSkill>(SkillNames.Inventing); if (!skill.OppKnowFrankensimRecipeCompleted) { EventTracker.SendEvent(EventTypeId.kDiscoveredNewInvention, Actor, mFrankensim); } mCurrentStateMachine = StateMachineClient.Acquire(mFrankensim, "WorkbenchFrankensim", AnimationPriority.kAPDefault); SetActor("workstation", Target); SetActor("x", mFrankensim); SetActor("y", Actor); AddSynchronousOneShotScriptEventHandler(0x65, OnAnimationEvent); EnterState("x", "Enter"); AnimateSim("Exit"); AdoptFrankenSim(Actor, mFrankensim); skill.KnowsFrankensimRecipe = true; skill.TestForNewLifetimeOpp(); EventTracker.SendEvent(EventTypeId.kFrankensimLearned, Actor); } StandardExit(); return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }