public override bool canThisBeAttached(StardewValley.Object o)
 {
     if (o == null ||
         o.Category == StardewValley.Object.VegetableCategory ||
         o.Category == StardewValley.Object.FruitsCategory ||
         TreatsController.IsLikedTreat(o.ParentSheetIndex) ||
         TreatsController.IsLikedTreat(o.Category)
         )
     {
         return(true);
     }
     return(false);
 }
        public static bool canThisBeAttached(Tool __instance, SObject o, ref bool __result)
        {
            if (!IsFeedingBasket(__instance))
            {
                return(true);
            }

            if (o == null ||
                o.Category == SObject.VegetableCategory ||
                o.Category == SObject.FruitsCategory ||
                TreatsController.IsLikedTreat(o)
                )
            {
                __result = true;
                return(false);
            }
            __result = false;
            return(false);
        }
Exemplo n.º 3
0
        public static bool canThisBeAttached(MilkPail __instance, StardewValley.Object o, ref bool __result)
        {
            if (!IsFeedingBasket(__instance))
            {
                return(true);
            }

            if (o == null ||
                o.Category == StardewValley.Object.VegetableCategory ||
                o.Category == StardewValley.Object.FruitsCategory ||
                TreatsController.IsLikedTreat(o.ParentSheetIndex) ||
                TreatsController.IsLikedTreat(o.Category)
                )
            {
                __result = true;
                return(false);
            }
            __result = false;
            return(false);
        }
        public override bool beginUsing(GameLocation location, int x, int y, StardewValley.Farmer who)
        {
            x = (int)who.GetToolLocation(false).X;
            y = (int)who.GetToolLocation(false).Y;
            Rectangle rectangle = new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize);

            // Added this because for some wierd reason the current value appears subtracted by 5 the first time the tool is used.
            this.CurrentParentTileIndex = InitialParentTileIndex;

            if (Context.IsMainPlayer && !DataLoader.ModConfig.DisableTreats)
            {
                if (location is Farm)
                {
                    foreach (FarmAnimal farmAnimal in (location as Farm).animals.Values)
                    {
                        if (farmAnimal.GetBoundingBox().Intersects(rectangle))
                        {
                            this._animal = farmAnimal;
                            break;
                        }
                    }
                    if (this._animal == null)
                    {
                        foreach (Pet pet in location.characters.Where(i => i is Pet))
                        {
                            if (pet.GetBoundingBox().Intersects(rectangle))
                            {
                                this._pet = pet;
                                break;
                            }
                        }
                    }
                }
                else if (location is AnimalHouse)
                {
                    foreach (FarmAnimal farmAnimal in (location as AnimalHouse).animals.Values)
                    {
                        if (farmAnimal.GetBoundingBox().Intersects(rectangle))
                        {
                            this._animal = farmAnimal;
                            break;
                        }
                    }
                }
                else if (location is FarmHouse)
                {
                    foreach (Pet pet in location.characters.Where(i => i is Pet))
                    {
                        if (pet.GetBoundingBox().Intersects(rectangle))
                        {
                            this._pet = pet;
                            break;
                        }
                    }
                }
            }

            if (this._animal != null)
            {
                string dialogue = "";
                if (this.attachments[0] == null)
                {
                    Game1.showRedMessage(DataLoader.i18n.Get("Tool.FeedingBasket.Empty"));
                    this._animal = null;
                }
                else if (!TreatsController.CanReceiveTreat(this._animal))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new { itemName = this.attachments[0].DisplayName });
                }
                else if (!TreatsController.IsLikedTreat(this._animal, this.attachments[0].ParentSheetIndex) && !TreatsController.IsLikedTreat(this._animal, this.attachments[0].Category))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new  { itemName = this.attachments[0].DisplayName });
                }
                else if (this.attachments[0].Category == StardewValley.Object.MilkCategory && !this._animal.isBaby())
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.OnlyBabiesCanEatMilk");
                }
                else if (!TreatsController.IsReadyForTreat(this._animal))
                {
                    if (TreatsController.GetTreatItem(this._animal)?.MinimumDaysBetweenTreats == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.AlreadyAteTreatToday", new { animalName = this._animal.displayName });
                    }
                    else
                    {
                        int daysUntilNextTreat = TreatsController.DaysUntilNextTreat(this._animal);
                        if (daysUntilNextTreat > 1)
                        {
                            dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatInDays", new { animalName = this._animal.displayName, numberOfDays = daysUntilNextTreat });
                        }
                        else if (daysUntilNextTreat == 1)
                        {
                            dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatTomorrow", new { animalName = this._animal.displayName });
                        }
                    }
                }
                else
                {
                    this._animal.pauseTimer = 1000;
                }


                if (dialogue.Length > 0)
                {
                    DelayedAction.showDialogueAfterDelay(dialogue, 150);
                    this._animal = null;
                }
            }
            if (this._pet != null)
            {
                string dialogue = "";
                if (this.attachments[0] == null)
                {
                    Game1.showRedMessage(DataLoader.i18n.Get("Tool.FeedingBasket.Empty"));
                    this._pet = null;
                }
                else if (!TreatsController.IsLikedTreatPet(this.attachments[0].ParentSheetIndex) && !TreatsController.IsLikedTreatPet(this.attachments[0].Category))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new { itemName = this.attachments[0].DisplayName });
                }
                else if (!TreatsController.IsReadyForTreatPet())
                {
                    int daysUntilNextTreat = TreatsController.DaysUntilNextTreatPet();

                    if (DataLoader.AnimalData.Pet.MinimumDaysBetweenTreats == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.AlreadyAteTreatToday", new { animalName = this._pet.displayName });
                    }
                    else if (daysUntilNextTreat > 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatInDays", new { animalName = this._pet.displayName, numberOfDays = daysUntilNextTreat });
                    }
                    else if (daysUntilNextTreat == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatTomorrow", new { animalName = this._pet.displayName });
                    }
                }
                else
                {
                    _pet.Halt();
                    _pet.CurrentBehavior = 0;
                    _pet.OnNewBehavior();
                    _pet.Halt();
                    _pet.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>()
                    {
                        new FarmerSprite.AnimationFrame(18, 200)
                    });
                }


                if (dialogue.Length > 0)
                {
                    DelayedAction.showDialogueAfterDelay(dialogue, 150);
                    this._pet = null;
                }
            }


            who.Halt();
            int currentFrame = who.FarmerSprite.currentFrame;

            if (this._animal != null || this._pet != null)
            {
                switch (who.FacingDirection)
                {
                case 0:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(62, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 1:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(58, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 2:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(54, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 3:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(58, 900, false, true, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;
                }
            }
            else
            {
                who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                    new FarmerSprite.AnimationFrame(currentFrame, 0, false, who.FacingDirection == 3, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                });
            }
            who.FarmerSprite.oldFrame = currentFrame;
            who.UsingTool             = true;
            who.CanMove = false;

            if (this._animal != null || this._pet != null)
            {
                Rectangle boundingBox;
                if (this._animal != null)
                {
                    boundingBox = this._animal.GetBoundingBox();
                }
                else
                {
                    boundingBox = this._pet.GetBoundingBox();
                }

                double numX = boundingBox.Center.X;
                double numY = boundingBox.Center.Y;

                Vector2 vectorBasket = new Vector2((float)numX - 32, (float)numY);
                Vector2 vectorFood   = new Vector2((float)numX - 24, (float)numY - 10);
                var     foodScale    = Game1.pixelZoom * 0.75f;

                Multiplayer multiplayer = DataLoader.Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue();

                TemporaryAnimatedSprite basketSprite = new TemporaryAnimatedSprite(Game1.toolSpriteSheetName,
                                                                                   Game1.getSourceRectForStandardTileSheet(Game1.toolSpriteSheet, this.CurrentParentTileIndex, 16, 16),
                                                                                   750.0f, 1, 1, vectorBasket, false, false, ((float)boundingBox.Bottom + 0.1f) / 10000f, 0.0f,
                                                                                   Color.White, Game1.pixelZoom, 0.0f, 0.0f, 0.0f)
                {
                    delayBeforeAnimationStart = 100
                };
                multiplayer.broadcastSprites(who.currentLocation, new TemporaryAnimatedSprite[1] {
                    basketSprite
                });
                TemporaryAnimatedSprite foodSprite = new TemporaryAnimatedSprite(Game1.objectSpriteSheetName,
                                                                                 Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, this.attachments[0].ParentSheetIndex,
                                                                                                                         16, 16), 500.0f, 1, 1, vectorFood, false, false, ((float)boundingBox.Bottom + 0.2f) / 10000f, 0.0f,
                                                                                 Color.White, foodScale, 0.0f, 0.0f, 0.0f)
                {
                    delayBeforeAnimationStart = 100
                };
                multiplayer.broadcastSprites(who.currentLocation, new TemporaryAnimatedSprite[1] {
                    foodSprite
                });

                for (int index = 0; index < 8; ++index)
                {
                    Rectangle standardTileSheet = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet,
                                                                                          this.attachments[0].ParentSheetIndex, 16, 16);
                    standardTileSheet.X += 8;
                    standardTileSheet.Y += 8;

                    standardTileSheet.Width  = Game1.pixelZoom;
                    standardTileSheet.Height = Game1.pixelZoom;
                    TemporaryAnimatedSprite temporaryAnimatedSprite2 =
                        new TemporaryAnimatedSprite(Game1.objectSpriteSheetName, standardTileSheet, 400f, 1, 0,
                                                    vectorFood + new Vector2(12, 12), false, false,
                                                    ((float)boundingBox.Bottom + 0.2f) / 10000f, 0.0f, Color.White, (float)foodScale, 0.0f,
                                                    0.0f, 0.0f, false)
                    {
                        motion       = new Vector2((float)Game1.random.Next(-30, 31) / 10f, (float)Game1.random.Next(-6, -3)),
                        acceleration = new Vector2(0.0f, 0.5f),
                        delayBeforeAnimationStart = 600
                    };
                    multiplayer.broadcastSprites(who.currentLocation, new TemporaryAnimatedSprite[1] {
                        temporaryAnimatedSprite2
                    });
                }

                if (this._animal != null)
                {
                    Game1.delayedActions.Add(new DelayedAction(300, new DelayedAction.delayedBehavior(() => {
                        AnimalHusbandryModEntry.ModHelper.Reflection.GetField <NetBool>(this._animal, "isEating").GetValue().Value = true;
                        this._animal.Sprite.loop = false;
                    })));
                }
                else if (this._pet != null)
                {
                    _pet.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>()
                    {
                        new FarmerSprite.AnimationFrame(18, 300),
                        new FarmerSprite.AnimationFrame(17, 100),
                        new FarmerSprite.AnimationFrame(16, 100),
                        new FarmerSprite.AnimationFrame(0, 100),
                        new FarmerSprite.AnimationFrame(16, 100),
                        new FarmerSprite.AnimationFrame(17, 100),
                        new FarmerSprite.AnimationFrame(18, 300)
                    });
                    _pet.Sprite.loop = false;
                }
                DelayedAction.playSoundAfterDelay("eat", 600);
            }

            return(true);
        }
        public static bool beginUsing(MilkPail __instance, GameLocation location, int x, int y, StardewValley.Farmer who, ref bool __result)
        {
            if (!IsFeedingBasket(__instance))
            {
                return(true);
            }

            string feedingBasketId = __instance.modData[FeedingBasketKey];

            x = (int)who.GetToolLocation(false).X;
            y = (int)who.GetToolLocation(false).Y;
            Rectangle rectangle = new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize);

            // Added this because for some wierd reason the current value appears subtracted by 5 the first time the tool is used.
            __instance.CurrentParentTileIndex = InitialParentTileIndex;

            if (!DataLoader.ModConfig.DisableTreats)
            {
                if (location is Farm farm)
                {
                    foreach (FarmAnimal farmAnimal in farm.animals.Values)
                    {
                        if (farmAnimal.GetBoundingBox().Intersects(rectangle))
                        {
                            Animals[feedingBasketId] = farmAnimal;
                            break;
                        }
                    }
                    if (!Animals.ContainsKey(feedingBasketId) || Animals[feedingBasketId] == null)
                    {
                        foreach (Pet localPet in farm.characters.Where(i => i is Pet))
                        {
                            if (localPet.GetBoundingBox().Intersects(rectangle))
                            {
                                Pets[feedingBasketId] = localPet;
                                break;
                            }
                        }
                    }
                }
                else if (location is AnimalHouse animalHouse)
                {
                    foreach (FarmAnimal farmAnimal in animalHouse.animals.Values)
                    {
                        if (farmAnimal.GetBoundingBox().Intersects(rectangle))
                        {
                            Animals[feedingBasketId] = farmAnimal;
                            break;
                        }
                    }
                }
                else if (location is FarmHouse)
                {
                    foreach (Pet localPet in location.characters.Where(i => i is Pet))
                    {
                        if (localPet.GetBoundingBox().Intersects(rectangle))
                        {
                            Pets[feedingBasketId] = localPet;
                            break;
                        }
                    }
                }
            }

            Animals.TryGetValue(feedingBasketId, out FarmAnimal animal);
            if (animal != null)
            {
                string dialogue = "";
                if (__instance.attachments[0] == null)
                {
                    if (who != null && Game1.player.Equals(who))
                    {
                        Game1.showRedMessage(DataLoader.i18n.Get("Tool.FeedingBasket.Empty"));
                    }
                    Animals[feedingBasketId] = animal = null;
                }
                else if (!TreatsController.CanReceiveTreat(animal))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new { itemName = __instance.attachments[0].DisplayName });
                }
                else if (!TreatsController.IsLikedTreat(animal, __instance.attachments[0]))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new { itemName = __instance.attachments[0].DisplayName });
                }
                else if (__instance.attachments[0].Category == SObject.MilkCategory && !animal.isBaby())
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.OnlyBabiesCanEatMilk");
                }
                else if (!TreatsController.IsReadyForTreat(animal))
                {
                    if (TreatsController.GetTreatItem(animal)?.MinimumDaysBetweenTreats == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.AlreadyAteTreatToday", new { animalName = animal.displayName });
                    }
                    else
                    {
                        int daysUntilNextTreat = TreatsController.DaysUntilNextTreat(animal);
                        if (daysUntilNextTreat > 1)
                        {
                            dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatInDays", new { animalName = animal.displayName, numberOfDays = daysUntilNextTreat });
                        }
                        else if (daysUntilNextTreat == 1)
                        {
                            dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatTomorrow", new { animalName = animal.displayName });
                        }
                    }
                }
                else
                {
                    animal.pauseTimer = 1000;
                }


                if (dialogue.Length > 0)
                {
                    if (who != null && Game1.player.Equals(who))
                    {
                        DelayedAction.showDialogueAfterDelay(dialogue, 150);
                    }
                    Animals[feedingBasketId] = animal = null;
                }
            }
            Pets.TryGetValue(feedingBasketId, out Pet pet);
            if (pet != null)
            {
                string dialogue = "";
                if (__instance.attachments[0] == null)
                {
                    if (who != null && Game1.player.Equals(who))
                    {
                        Game1.showRedMessage(DataLoader.i18n.Get("Tool.FeedingBasket.Empty"));
                    }
                    Pets[feedingBasketId] = pet = null;
                }
                else if (!TreatsController.IsLikedTreat(pet, __instance.attachments[0]))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new { itemName = __instance.attachments[0].DisplayName });
                }
                else if (!TreatsController.IsReadyForTreat(pet))
                {
                    int daysUntilNextTreat = TreatsController.DaysUntilNextTreat(pet);

                    if (DataLoader.AnimalData.Pet.MinimumDaysBetweenTreats == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.AlreadyAteTreatToday", new { animalName = pet.displayName });
                    }
                    else if (daysUntilNextTreat > 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatInDays", new { animalName = pet.displayName, numberOfDays = daysUntilNextTreat });
                    }
                    else if (daysUntilNextTreat == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatTomorrow", new { animalName = pet.displayName });
                    }
                }
                else
                {
                    pet.Halt();
                    pet.FacingDirection = 2;
                    pet.CurrentBehavior = 2;
                    DataLoader.Helper.Reflection.GetField <int>(pet, "_currentBehavior").SetValue(2);
                    pet.Halt();
                    pet.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>()
                    {
                        new FarmerSprite.AnimationFrame(18, 200)
                    });
                    pet.Sprite.loop = true;
                }

                if (dialogue.Length > 0)
                {
                    if (who != null && Game1.player.Equals(who))
                    {
                        DelayedAction.showDialogueAfterDelay(dialogue, 150);
                    }
                    Pets[feedingBasketId] = pet = null;
                }
            }

            who.Halt();
            int currentFrame = who.FarmerSprite.currentFrame;

            if (animal != null || pet != null)
            {
                switch (who.FacingDirection)
                {
                case 0:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(62, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 1:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(58, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 2:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(54, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 3:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(58, 900, false, true, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;
                }
            }
            else
            {
                who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                    new FarmerSprite.AnimationFrame(currentFrame, 0, false, who.FacingDirection == 3, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                });
            }
            who.FarmerSprite.oldFrame = currentFrame;
            who.UsingTool             = true;
            who.CanMove = false;

            if (animal != null || pet != null)
            {
                Rectangle boundingBox;
                boundingBox = animal != null?animal.GetBoundingBox() : pet.GetBoundingBox();

                double numX = boundingBox.Center.X;
                double numY = boundingBox.Center.Y;

                Vector2 vectorBasket = new Vector2((float)numX - 32, (float)numY);
                Vector2 vectorFood   = new Vector2((float)numX - 24, (float)numY - 10);
                var     foodScale    = Game1.pixelZoom * 0.75f;

                TemporaryAnimatedSprite basketSprite = new TemporaryAnimatedSprite(Game1.toolSpriteSheetName,
                                                                                   Game1.getSourceRectForStandardTileSheet(Game1.toolSpriteSheet, __instance.CurrentParentTileIndex, 16, 16),
                                                                                   750.0f, 1, 1, vectorBasket, false, false, ((float)boundingBox.Bottom + 0.1f) / 10000f, 0.0f,
                                                                                   Color.White, Game1.pixelZoom, 0.0f, 0.0f, 0.0f)
                {
                    delayBeforeAnimationStart = 100
                };
                location.temporarySprites.Add(basketSprite);
                TemporaryAnimatedSprite foodSprite = new TemporaryAnimatedSprite(Game1.objectSpriteSheetName,
                                                                                 Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.attachments[0].ParentSheetIndex,
                                                                                                                         16, 16), 500.0f, 1, 1, vectorFood, false, false, ((float)boundingBox.Bottom + 0.2f) / 10000f, 0.0f,
                                                                                 Color.White, foodScale, 0.0f, 0.0f, 0.0f)
                {
                    delayBeforeAnimationStart = 100
                };
                location.temporarySprites.Add(foodSprite);

                for (int index = 0; index < 8; ++index)
                {
                    Rectangle standardTileSheet = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet,
                                                                                          __instance.attachments[0].ParentSheetIndex, 16, 16);
                    standardTileSheet.X += 8;
                    standardTileSheet.Y += 8;

                    standardTileSheet.Width  = Game1.pixelZoom;
                    standardTileSheet.Height = Game1.pixelZoom;
                    TemporaryAnimatedSprite temporaryAnimatedSprite2 =
                        new TemporaryAnimatedSprite(Game1.objectSpriteSheetName, standardTileSheet, 400f, 1, 0,
                                                    vectorFood + new Vector2(12, 12), false, false,
                                                    ((float)boundingBox.Bottom + 0.2f) / 10000f, 0.0f, Color.White, (float)foodScale, 0.0f,
                                                    0.0f, 0.0f, false)
                    {
                        motion       = new Vector2((float)Game1.random.Next(-30, 31) / 10f, (float)Game1.random.Next(-6, -3)),
                        acceleration = new Vector2(0.0f, 0.5f),
                        delayBeforeAnimationStart = 600
                    };
                    location.temporarySprites.Add(temporaryAnimatedSprite2);
                }

                if (animal != null)
                {
                    FarmAnimal tempAnimal = animal;
                    Game1.delayedActions.Add(new DelayedAction(300, new DelayedAction.delayedBehavior(() => {
                        if (tempAnimal.buildingTypeILiveIn.Contains("Barn"))
                        {
                            tempAnimal.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>
                            {
                                new FarmerSprite.AnimationFrame(16, 100),
                                new FarmerSprite.AnimationFrame(17, 100),
                                new FarmerSprite.AnimationFrame(18, 100),
                                new FarmerSprite.AnimationFrame(19, 100),
                                new FarmerSprite.AnimationFrame(19, 100, secondaryArm: false, flip: false, (f) =>
                                {
                                    tempAnimal.doEmote(20, true);
                                    tempAnimal.Sprite.CurrentAnimation = null;
                                    tempAnimal.Sprite.loop             = true;
                                    tempAnimal.Sprite.currentFrame     = 0;
                                    tempAnimal.faceDirection(2);
                                })
                            });
                        }
                        else
                        {
                            tempAnimal.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>
                            {
                                new FarmerSprite.AnimationFrame(24, 100),
                                new FarmerSprite.AnimationFrame(25, 100),
                                new FarmerSprite.AnimationFrame(26, 100),
                                new FarmerSprite.AnimationFrame(27, 100),
                                new FarmerSprite.AnimationFrame(27, 100, secondaryArm: false, flip: false, (f) =>
                                {
                                    tempAnimal.doEmote(20, true);
                                    tempAnimal.Sprite.CurrentAnimation = null;
                                    tempAnimal.Sprite.loop             = true;
                                    tempAnimal.Sprite.currentFrame     = 0;
                                    tempAnimal.faceDirection(2);
                                })
                            });
                        }
                        tempAnimal.Sprite.loop = false;
                    })));
                }
                else if (pet != null)
                {
                    pet.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>()
                    {
                        new FarmerSprite.AnimationFrame(18, 300),
                        new FarmerSprite.AnimationFrame(17, 100),
                        new FarmerSprite.AnimationFrame(16, 100),
                        new FarmerSprite.AnimationFrame(0, 100),
                        new FarmerSprite.AnimationFrame(16, 100),
                        new FarmerSprite.AnimationFrame(17, 100, secondaryArm: false, flip: false, (f) => pet.doEmote(20, true), true),
                        new FarmerSprite.AnimationFrame(18, 300, false, false, pet.hold, true)
                    });
                    pet.Sprite.loop = false;
                }
                if (who != null && Game1.player.Equals(who))
                {
                    DelayedAction.playSoundAfterDelay("eat", 600, location);
                }
            }
            __result = true;
            return(false);
        }