Stardew Valley

File information

Last updated

Original upload

Created by

Shockah

Uploaded by

Shockah

Virus scan

Safe to use

About this mod

Ever hated having to put a sprinkler in the middle of your crops? Ever wanted to make a layout that isn't 5x5? Now you can!

Requirements
Permissions and credits
Translations
  • Portuguese
  • Mandarin
Changelogs
TL;DR:
Ever hated having to put a sprinkler in the middle of your crops? Ever wanted to make a layout that isn't 5x5? Now you can!
Improves all sprinklers to be more flexible, and yet tries to keep compatibility with existing farm setups.

1. Cluster algorithm
The main feature of this mod is a customized clustered watering algorithm for sprinklers. Sprinklers will now try to find clusters of tiles to water and split work between them to water as much as possible, without overlaps. This should allow for EVEN MORE custom crop layouts. Each type of sprinkler has a different max range at which it will look at tiles - the better the sprinkler is, the higher the range.

By default, the simple vanilla watering algorithm is used, but if any of the tiles it should water are not able to watered, the cluster algorithm takes over.

This behavior is configurable - you can disable the vanilla algorithm altogether, which can in some cases be beneficial (as otherwise the sprinklers may water the same tiles if their vanilla ranges overlap).

Due to the nature of this algorithm, the sprinklers may sometimes fall into an edge case where they cannot decide on which tiles to water, because they're equally the "best" ones. The behavior for this case is also configurable, and by default a "relaxed" setting is used, meaning sprinklers may water more tiles than they should. Alternatively you can change it to "restrictive" (may water less tiles) or "exact" (will water exactly as many tiles as it should, in a sort-of spiraling manner around a sprinkler).

You can also completely disable the new algorithm, if all you're after is the other features.

2. Configurable sprinkler power
The mod's config allows you to change how many tiles each tier of vanilla-style sprinklers should actually water. This is only taken into consideration when using the flood fill algorithm. Settings are provided for tiers 1-8 (vanilla game only has tiers 1-4, the rest may be reachable when combined with other mods).

3. Activating sprinklers on placement / action, or before sleep
Placing sprinklers and pressing the interaction keybind (right click / interaction button on controller) will now instantly activate the sprinkler. Both options are configurable, enabled by default. Unfortunately, those don't work with the Cluster behavior, due to its nature.
Additionally sprinklers can be activated before sleep, which DOES work with the Cluster behavior. This is also configurable.

4. Coverage display
Another feature is being able to display the current sprinkler coverage for several seconds, potentially also animating it to visualize how did the sprinklers pick their tiles to water (which may help improving the layout). Again, a lot of configurable options here.

5. Mod compatibility
The mod tries to be as compatible as possible with other sprinkler mods. Mods that were tested:

Additionally, due to the nature of my mod, this makes those mods compatible with the other features - this means all of those mods will now be able to be activated on placement/action, and they will also behave more akin to vanilla sprinklers, meaning they should also be able to receive the Enricher upgrade. Currently it may or may not work with the Pressure Nozzle - if the sprinkler uses the vanilla layout, it will work (most of the above mods), but custom ones won't (Line Sprinklers) - I may "fix" this in the future.

There is also a dedicated setting to patch the game code in a bit more compatible way (postfixing instead of prefixing whenever possible), which is enabled by default. If you have any performance problems due to this (it's not much of a performance hit, but still), you can turn this off.

The mod also adds its own very extensive API other mod developers can use to make their mods compatible with it, override its functionality or to retrieve information specific to this mod.

Mods I will not make compatible for various reasons:
  • Any of the "Sprinkler Activation" mods - this mod already does it, and has to do it. If it didn't, it wouldn't be compatible with those mods, so I had to reimplement it as part of this mod.
  • Basic Sprinkler Improved - this mod sort-of already does what that mod does, but in its own way.
  • Any other outdated mods, especially without source code available.


6. Enricher fix
This is a small one, but Enricher on a Basic Sprinkler worked as if it was on a Quality Sprinkler. Due to the nature of this mod this is "fixed".

Configuration
The mod has Generic Mod Config Menu support. You can also edit the config.json file manually.

Known issues and future plans
This is a list of things I may or may not do in this mod in the future:
  • BUG: Pressure Nozzle has no effect on Line Sprinklers:
    This should actually be a feature implemented in Line Sprinklers - it would require no or barely any further changes from the side of this mod if done that way.
  • BUG: Some modded sprinklers (noticed with Line Sprinklers) use the machine "dance" animation instead of rendering sprinkler upgrades. This is purely visual.
    I may or may not bother fixing it, as it's also something that should really be done on the side of the Line Sprinklers mod, but we'll see.
  • TODO: Customized animations.
    The current animations don't exactly fit the new behavior, but this is purely a visual thing.


Other info
You can find the source code here.