Example #1
0
        public bool SharedNearDistanceBehavior(float routingDistance, float loopTime)
        {
            EWWait.Definition waitDefinition = new EWWait.Definition();
            EWWait            waitInstance   = waitDefinition.CreateInstance(mMedicineCat, mMedicineCat,
                                                                             new InteractionPriority(InteractionPriorityLevel.UserDirected), false,
                                                                             CancellableByPlayer) as EWWait;

            waitInstance.SetInteractionName("Treat " + Actor.Name);
            mMedicineCat.InteractionQueue.AddNext(waitInstance);

            if (!Actor.RouteToObjectRadius(Target, routingDistance))
            {
                waitInstance.waitComplete = true;
                return(false);
            }
            EnterStateMachine("eatofffloor", "Enter", "x");
            SetParameter("isFish", false);
            BeginCommodityUpdates();
            AnimateSim("EatOffFloorLoop");
            bool flag = DoTimedLoop(loopTime, ExitReason.Default);

            EndCommodityUpdates(flag);
            mDestroyPrey = true;
            AnimateSim("Exit");
            waitInstance.waitComplete = true;

            if (mSuccess)
            {
                Actor.ShowTNSIfSelectable("EWLocalize - Successful treatment",
                                          NotificationStyle.kGameMessagePositive);
                Actor.BuffManager.RemoveElement(mBuffID);
                if (Actor.GetDistanceToObjectSquared(mMedicineCat) <= kMaxDistanceForSimToReact
                    * kMaxDistanceForSimToReact)
                {
                    // Say thank you
                    SocialInteractionA.Definition definition2 = new SocialInteractionA.Definition("Nuzzle Auto Accept",
                                                                                                  new string[0], null, initialGreet: false);
                    InteractionInstance nuzzleInteraction = definition2.CreateInstance(mMedicineCat, Actor,
                                                                                       new InteractionPriority(InteractionPriorityLevel.UserDirected), false,
                                                                                       true);
                    Actor.InteractionQueue.TryPushAsContinuation(this, nuzzleInteraction);
                }
                DoLtrAdjustment(goodReaction: true);
            }
            else
            {
                Actor.ShowTNSIfSelectable("EWLocalize - Failed treatment",
                                          NotificationStyle.kGameMessagePositive);
                DoLtrAdjustment(goodReaction: false);
            }
            treatmentComplete = true;
            return(flag);
        }
Example #2
0
		public override bool Run()
		{
			if (mSimToPresent == null)
			{
				mSimToPresent = (GetSelectedObject() as Sim);
				if (mSimToPresent == null)
				{
					return false;
				}
				if (!PetCarrySystem.PickUp(Actor, Target))
				{
					return false;
				}
				Target.UpdateVisualState(CatHuntingModelState.Carried);
			}

			if (mSimToPresent != null && !mSimToPresent.HasBeenDestroyed)
			{
				mSimToPresent.InteractionQueue.CancelAllInteractions();
				EWWait.Definition waitDefinition = new EWWait.Definition();
				EWWait waitInstance = waitDefinition.CreateInstance(mSimToPresent, mSimToPresent,
					new InteractionPriority(InteractionPriorityLevel.UserDirected), false,
					CancellableByPlayer) as EWWait;
				waitInstance.SetInteractionName("Wait for Medicine");
				mSimToPresent.InteractionQueue.AddNext(waitInstance);

				Route val = Actor.CreateRoute();
				val.DoRouteFail = true;
				val.SetOption(RouteOption.MakeDynamicObjectAdjustments, true);
				val.PlanToPointRadialRange(mSimToPresent, mSimToPresent.Position, kDistanceFromSimToPresent,
					kDistanceFromSimToPresent, Vector3.UnitZ, 360f, RouteDistancePreference.PreferNearestToRouteDestination,
					RouteOrientationPreference.TowardsObject, mSimToPresent.LotCurrent.LotId,
					new int[1]
					{
						mSimToPresent.RoomId
					});
				if (Actor.DoRoute(val))
				{
					val.SetOption(RouteOption.MakeDynamicObjectAdjustments, false);
					val.PlanToPointRadialRange(mSimToPresent, mSimToPresent.Position,
						kDistanceFromSimToPresent, kDistanceFromSimToPresent, Vector3.UnitZ, 360f,
						RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject,
						mSimToPresent.LotCurrent.LotId, new int[1]
						{
							mSimToPresent.RoomId
						});
					Actor.DoRoute(val);
				}
				waitInstance.waitComplete = true;
			}
			PetCarrySystem.PutDownOnFloor(Actor);
			Target.UpdateVisualState(CatHuntingModelState.InWorld);
			Target.CatHuntingComponent.mHasBeenPresented = true;
			if (Actor.HasExitReason())
			{
				return false;
			}
			BeginCommodityUpdates();

			EWPetBeTreated.Definition treatDefinition = new EWPetBeTreated.Definition();
			EWPetBeTreated treatInstance = treatDefinition.CreateInstance(Target, mSimToPresent,
				new InteractionPriority(InteractionPriorityLevel.UserDirected), false,
				CancellableByPlayer) as EWPetBeTreated;
			treatInstance.SetParams(isSuccessfulTreatment(mSimToPresent), BuffNames.GotFleasPet,
				Actor, true);
			mSimToPresent.InteractionQueue.AddNext(treatInstance);

			EndCommodityUpdates(succeeded: true);

			return true;
		}
Example #3
0
        public override bool Run()
        {
            if (mSimToPresent == null)
            {
                mSimToPresent = (GetSelectedObject() as Sim);
                if (mSimToPresent == null)
                {
                    return(false);
                }
            }

            Fish fish = Target as Fish;

            //fish.UpdateVisualState(Sims3.Gameplay.ObjectComponents.CatHuntingComponent.CatHuntingModelState.InInventory);
            if (!EWPetPickUpPlantable.PickUpFromSimInventory(Actor, Target, fish.MedatorName, true))
            {
                return(false);
            }

            if (mSimToPresent != null && !mSimToPresent.HasBeenDestroyed)
            {
                mSimToPresent.InteractionQueue.CancelAllInteractions();
                EWWait.Definition waitDefinition = new EWWait.Definition();
                EWWait            waitInstance   = waitDefinition.CreateInstance(mSimToPresent, mSimToPresent,
                                                                                 new InteractionPriority(InteractionPriorityLevel.UserDirected), false,
                                                                                 CancellableByPlayer) as EWWait;
                waitInstance.SetInteractionName("Wait for Fish");
                mSimToPresent.InteractionQueue.AddNext(waitInstance);

                Route val = Actor.CreateRoute();
                val.DoRouteFail = true;
                val.SetOption(RouteOption.MakeDynamicObjectAdjustments, true);
                val.PlanToPointRadialRange(mSimToPresent, mSimToPresent.Position, kDistanceFromSimToPresent,
                                           kDistanceFromSimToPresent, Vector3.UnitZ, 360f, RouteDistancePreference.PreferNearestToRouteDestination,
                                           RouteOrientationPreference.TowardsObject, mSimToPresent.LotCurrent.LotId,
                                           new int[1]
                {
                    mSimToPresent.RoomId
                });
                if (Actor.DoRoute(val))
                {
                    val.SetOption(RouteOption.MakeDynamicObjectAdjustments, false);
                    val.PlanToPointRadialRange(mSimToPresent, mSimToPresent.Position,
                                               kDistanceFromSimToPresent, kDistanceFromSimToPresent, Vector3.UnitZ, 360f,
                                               RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject,
                                               mSimToPresent.LotCurrent.LotId, new int[1]
                    {
                        mSimToPresent.RoomId
                    });
                    Actor.DoRoute(val);
                }
                waitInstance.waitComplete = true;
            }

            EWPetPickUpPlantable.PutDownOnFloor(Actor);
            if (Actor.HasExitReason())
            {
                return(false);
            }

            return(true);
        }