/// <summary> Search for water tiles. </summary> private static bool WaterEndPointFunction( PathNode currentPoint, Point endPoint, GameLocation location, Character c) { if (!ModEntry.Instance.Config.AnimalsCanOnlyDrinkFromWaterBodies) { return(location.CanRefillWateringCanOnTile(currentPoint.x - 1, currentPoint.y) || location.CanRefillWateringCanOnTile(currentPoint.x, currentPoint.y - 1) || location.CanRefillWateringCanOnTile(currentPoint.x, currentPoint.y + 1) || location.CanRefillWateringCanOnTile(currentPoint.x + 1, currentPoint.y)); } return(location.isOpenWater(currentPoint.x - 1, currentPoint.y) || location.isOpenWater(currentPoint.x, currentPoint.y - 1) || location.isOpenWater(currentPoint.x, currentPoint.y + 1) || location.isOpenWater(currentPoint.x + 1, currentPoint.y)); }
public virtual bool beginUsing(GameLocation location, int x, int y, Farmer who) { lastUser = who; if (!instantUse) { who.Halt(); Update(who.FacingDirection, 0, who); if ((!(this is FishingRod) && (int)upgradeLevel <= 0 && !(this is MeleeWeapon)) || this is Pickaxe) { who.EndUsingTool(); return(true); } } if (Name.Equals("Wand")) { if (((Wand)this).charged) { Game1.toolAnimationDone(who); who.canReleaseTool = false; if (!who.IsLocalPlayer || !Game1.fadeToBlack) { who.CanMove = true; who.UsingTool = false; } } else { if (who.IsLocalPlayer) { Game1.drawObjectDialogue(Game1.parseText(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.3180"))); } who.UsingTool = false; who.canReleaseTool = false; } } else if ((bool)instantUse) { Game1.toolAnimationDone(who); who.canReleaseTool = false; who.UsingTool = false; } else if (Name.Equals("Seeds")) { switch (who.FacingDirection) { case 0: who.Sprite.currentFrame = 208; Update(0, 0, who); break; case 1: who.Sprite.currentFrame = 204; Update(1, 0, who); break; case 2: who.Sprite.currentFrame = 200; Update(2, 0, who); break; case 3: who.Sprite.currentFrame = 212; Update(3, 0, who); break; } } else if (this is WateringCan && location.CanRefillWateringCanOnTile((int)who.GetToolLocation().X / 64, (int)who.GetToolLocation().Y / 64)) { switch (who.FacingDirection) { case 2: ((FarmerSprite)who.Sprite).animateOnce(166, 250f, 2); Update(2, 1, who); break; case 1: ((FarmerSprite)who.Sprite).animateOnce(174, 250f, 2); Update(1, 0, who); break; case 0: ((FarmerSprite)who.Sprite).animateOnce(182, 250f, 2); Update(0, 1, who); break; case 3: ((FarmerSprite)who.Sprite).animateOnce(190, 250f, 2); Update(3, 0, who); break; } who.canReleaseTool = false; } else if (this is WateringCan && ((WateringCan)this).WaterLeft <= 0) { Game1.toolAnimationDone(who); who.CanMove = true; who.canReleaseTool = false; } else if (this is WateringCan) { who.jitterStrength = 0.25f; switch (who.FacingDirection) { case 0: who.FarmerSprite.setCurrentFrame(180); Update(0, 0, who); break; case 1: who.FarmerSprite.setCurrentFrame(172); Update(1, 0, who); break; case 2: who.FarmerSprite.setCurrentFrame(164); Update(2, 0, who); break; case 3: who.FarmerSprite.setCurrentFrame(188); Update(3, 0, who); break; } } else if (this is FishingRod) { switch (who.FacingDirection) { case 0: ((FarmerSprite)who.Sprite).animateOnce(295, 35f, 8, FishingRod.endOfAnimationBehavior); Update(0, 0, who); break; case 1: ((FarmerSprite)who.Sprite).animateOnce(296, 35f, 8, FishingRod.endOfAnimationBehavior); Update(1, 0, who); break; case 2: ((FarmerSprite)who.Sprite).animateOnce(297, 35f, 8, FishingRod.endOfAnimationBehavior); Update(2, 0, who); break; case 3: ((FarmerSprite)who.Sprite).animateOnce(298, 35f, 8, FishingRod.endOfAnimationBehavior); Update(3, 0, who); break; } who.canReleaseTool = false; } else if (this is MeleeWeapon) { ((MeleeWeapon)this).setFarmerAnimating(who); } else { switch (who.FacingDirection) { case 0: who.FarmerSprite.setCurrentFrame(176); Update(0, 0, who); break; case 1: who.FarmerSprite.setCurrentFrame(168); Update(1, 0, who); break; case 2: who.FarmerSprite.setCurrentFrame(160); Update(2, 0, who); break; case 3: who.FarmerSprite.setCurrentFrame(184); Update(3, 0, who); break; } } return(false); }