예제 #1
0
        public override bool Run()
        {
            EWHerbLoreSkill skill = EWHerbLoreSkill.StartSkillGain(Actor);

            if (skill != null)
            {
                // Unable to use PetCarrySystem because plantable not recognized as IPetCarryable
                // Not clear on how this interface works.
                // Fortunately the CarryUtils methods used by both carry systems are less picky.
                if (Actor.RouteToObjectRadius(Target, 0.3f))
                {
                    if (Target.Plantable.PlantDef.GetModelName(out string modelname))
                    {
                        CarryUtils.Acquire(Actor, Target);
                        Actor.CarryStateMachine.SetParameter("Height", SurfaceHeight.Floor);
                        Enter(Actor, Target, modelname);
                        CarryUtils.Request(Actor, "PickUp");
                        CarryUtils.Request(Actor, "Carry");
                        AnimateIntoSimInventory(Actor);
                        //CarryUtils.VerifyAnimationParent(Target, Actor);
                        // Note: PutInSimInventory includes ExitCarry. This means the
                        // state machine has exited and can't be used again without Acquire
                        bool success = CarryUtils.PutInSimInventory(Actor);
                        skill.StopSkillGain();
                        skill.AddPoints(200);                          // This takes some know-how for a pet
                        return(success);
                    }
                }
            }
            return(false);
        }
예제 #2
0
        public override bool Run()
        {
            bool  result       = false;
            IPond nearestWater = GetNearestWater(Actor.Position, float.MaxValue);

            if (nearestWater == null)
            {
                return(false);
            }
            ulong notUsed = 10u;             // Not used by the method. I don't know what it was supposed to be.

            if (!DrinkFromPondHelper.RouteToDrinkLocation(nearestWater.RepresentativePondPosition(), Actor,
                                                          GameObjectHitType.WaterPond, notUsed))
            {
                return(false);
            }
            mossBall = GlobalFunctions.CreateObjectOutOfWorld("petToyBallFoil", ProductVersion.EP5);
            //bool isChaining = Actor.CurrentInteraction is ITendGarden;
            mossBall.SetColorTint(74, 93, 35, 0);              // RGB value for Dark Moss Green
            mossBall.AddToWorld();
            mossBall.SetPosition(Actor.Position);
            CarryUtils.Acquire(Actor, mossBall);
            EnterCarry(Actor, mossBall);
            CarryUtils.Request(Actor, "PickUp");
            CarryUtils.Request(Actor, "Carry");
            //if (!PetCarrySystem.PickUpWithoutRouting(Actor, mossBall as IPetCarryable))
            //         {
            //	return false;
            //         }
            EnterStateMachine("DrinkFromPond", "Enter", "x");
            AnimateSim("Loop");
            AnimateSim("Loop");
            AnimateSim("Exit");

            if (Target.RouteSimToMeAndCheckInUse(Actor) && WaterTestDisregardGardeningSkill(Target, Actor))
            {
                ConfigureInteraction();
                //TryConfigureTendGardenInteraction(Actor.CurrentInteraction);
                result = DoWater();
            }
            CarryUtils.Request(Actor, "PutDown");
            CarryUtils.ExitCarry(Actor);
            mossBall.Destroy();
            //if (IsChainingPermitted(flag))
            //{
            //	IgnorePlants.Add(Target);
            //	if (flag2)
            //	{
            //		PushNextInteractionInChain(Singleton, WaterTest, Target.LotCurrent);
            //	}
            //	else
            //	{
            //		PushNextInteractionInChain(Singleton, WaterTestDisregardGardeningSkill, Target.LotCurrent);
            //	}
            //}
            return(result);
        }
예제 #3
0
 public static bool PickUpFromSimInventory(Sim a, GameObject target, string modelname, bool removeFromInventory)
 {
     if (removeFromInventory && !a.Inventory.TryToRemove(target))
     {
         return(false);
     }
     target.AddToWorld();
     CarryUtils.Acquire(a, target);
     a.CarryStateMachine.SetParameter("Height", SurfaceHeight.Floor);
     Enter(a, target, modelname);
     CarryUtils.Request(a, "PickUp");
     target.SetHiddenFlags(HiddenFlags.Nothing);
     CarryUtils.Request(a, "Carry");
     return(true);
 }
예제 #4
0
        public static bool PutDownOnFloor(Sim actor)
        {
            GameObject objectInMouth = actor.GetObjectInMouth();
            GameObject gameObject    = GlobalFunctions.CreateJigFromObject(objectInMouth) as GameObject;

            actor.CarryStateMachine.SetParameter("model", "prey", ProductVersion.EP5);
            actor.CarryStateMachine.SetParameter("Height", SurfaceHeight.Floor);
            Vector3 position2 = actor.Position;
            Vector3 forward2  = actor.ForwardVector;

            GlobalFunctions.FindGoodLocationNearby(gameObject, ref position2, ref forward2, 0.7f,
                                                   GlobalFunctions.FindGoodLocationStrategies.All, (FindGoodLocationBooleans)20);
            CarryUtils.Request(actor, "PutDown");
            CarryUtils.ExitCarry(actor);
            gameObject.SetPosition(World.SnapToFloor(position2));
            gameObject.SetForward(forward2);
            CarryUtils.VerifyAnimationUnParent(objectInMouth, actor, gameObject);
            return(true);
        }