0 of 0

File information

Last updated

Original upload

Created by

Andrew Young

Uploaded by

andyruwruw

Virus scan

Safe to use

About this mod

Right-click with your watering can and watch yourself water your crops! Unlike other mods, the crops won't be instantly watered. Your farmer will go crop by crop watering them, expending the same amount of time and energy as if you had done it yourself to keep as vanilla as possible, but a lot less tedious!

Requirements
Permissions and credits
Changelogs


Source Code · Submit an Issue · Youtube Video

For my fellow lazy farmers without sprinklers


Water Bot

Right-clicking on a crop will start up the WaterBot, which will go through and water your crops 1 by 1.

This mod is intended to make the process of watering your plants less tedious, without removing the loss of time and energy usually required in vanilla Stardew.

Don't worry, the bot will automatically fill up the Watering Can if needed.

Say no more, I want to Install

1. Install the latest version of SMAPI.

2. Download this mod and unzip it into  Stardew Valley/Mods

3. Run the game using SMAPI.

How to Use

Good morning!

Time to water your crops.

Pull out your Watering Can, and right-click on any of your beautiful crops as if you were watering them.

By a miracle of love for your budding crops, you're carried away into watering the rest of them without pushing so much as a button.

You automatically get more water to refill your watering can from instinct, still in a lucid state.

Snap out of it early by pressing any button.

Don't worry, you won't knock yourself out from watering, you will stop before you run out of stamina

How to Use (Serious)

Start the Bot:
- Right-click a crop with the Watering Can

Stop the Bot:
- Press any button (left-click...etc)

The bot will automatically:
- Refill water at the nearest source when it runs out.
- Water all crops that need it.

The bot will stop if:
- You run out of stamina.
- There's no accessible water to refill.
- It finishes watering all reachable crops.

Open Source

If you have any issues, post them here.

All the source code is open source, feel free to shoot over a pull request if you find something!

Github Repo

How it Works

1. Trigger

To begin the mod listens for whenever the player right-clicks. If the player is clicking a crop with their watering can, the bot starts.

2. Loading the Player's Farm

The bot first looks through the farm map data, going tile by tile and marking the following traits:

Waterable: Does the tile need to be watered?

Block: Does the tile allow the player to walk on top of it?

Water: Can the player refill the Watering Can here?



All the tiles are placed in a 2D array. Any waterable crops are also placed in their own array.

3. Find Grouped Crops

Tiles with crops that need watering are then grouped based on adjacency using a depth-first search.



4. Cost of Traveling Between Groups

The bot then uses A* pathfinding to determine the cost of traveling from one group to another.

The algorithm starts at the tile closest to the centroid of each grouping.

The cost of traveling to each group is also done from the player's current position.



This gives us a nice cost matrix!

At this point, any unreachable groups are disregarded.

5. The Traveling Water Man

We need to find the shortest path through all the groups, starting at the player's current position.

The bot runs a greedy approach to solving the traveling salesman problem.

The starting point is the player's position.

6. Watering the Group

For each group, depth-first search is applied to fill in the tiles.

At each tile, all adjacent (now including diagonals) are watered as well. This means we can skip walking to every block and simply water anything around us.

If a block cannot be stood on, the bot chooses the next best option and waters it from there.



7. Out of Water!

When the watering can is low, the bot will go to the nearest source of water to refill.

The closest refillable spot is found using breadth-first-search from the player's position.

Once the spot is found, the bot navigates the player to the closest spot to the water, refills, then returns to watering.