After being fed and pampered, ducks truly desire to swim in water; also makes water tiles more accessible to ducks and awards friendship points to the farmer when ducks can swim.
Like a Duck to Water
PERMISSIONS AND CREDITS
This author has not credited anyone else in this file
- Like a Duck to Water Version 0.4.4
- Null checks
- Like a Duck to Water Version 0.4.3
- Fix for walking on water
- Like a Duck to Water Version 0.4.2
- Fixed mistake
- Version 0.4.1
- Fix for swimming on land
- Version 0.4.0
- Added option to not swim if only autopet
- Fixed not actually swimming after hop
- Like a Duck to Water Version 0.3.1
- Increment animal pathfinding this tick
- Version 0.3.0
- Switched to per tick check
- Added check for already pathfinding this tick
- Added chance per tick to begin moving
- Version 0.2.1
- Added nexus id
- Version 0.2.0
- Add checks after eating and petting
- Added check for hopping to occupied tile
- Like a Duck to Water Version 0.1.1
- GMCM fix
The issue for people complaining about ducks seldom, if ever, swimming in water appears to be a conflict between the game’s collision logic and the farm animal check to determine whether they can reach water from their present tile. In the regular farm, there are only four tiles on the entire map where a duck may leap into the water (they’re at the bottom of the enormous pond).
This patch alters the collision logic for ducks in relation to water, increasing their odds of swimming normally (the standard farm map will have 22 tiles they can enter the water from).
Further, the mod checks each duck on the farm map (after they eat and are petted, and every ten minutes) to see if it:
- has not swam today
- has eaten today
- has been petted today (by default, autopetting counts)
If all of the above conditions are met, and the farm has water-entry tiles nearby (default 20 tiles or less), ducks will start looking for a route to water, traveling immediately to the closest available water-entry tile that is not currently being targeted by another duck.
Finally, ducks gain a set friendship bonus (default 10 points) the first time they swim on a given day.
If such a creature exists, this patch should work with any modified animal that can swim. It should be compatible with any farm map that contains appropriate water tiles.
Ducks are queued with their probable hop tile information, and the mod checks a maximum of one duck each tick (based on a random chance per tick). Pathfinding will only occur if no animal pathfinding was performed on that tick, hence the mod should have no effect on performance.
You can customize this mod by editing the config file or using Generic Mod Config Menu.
Implements a Generic Mod Config Menu interface to change config settings in-game.
Compatible with Mod Updater for automatic updates.
Code is at https://github.com/aedenthorn/StardewValleyMods.
If you want to complain or ask for help or help me test my mods, you can visit my Discord server.
A list of all my mods for Stardew Valley is available at https://www.nexusmods.com/stardewvalley/articles/895.