bcmpinc / StardewHack

A bunch of Stardew Valley mods that heavily rely on IL code modification.
GNU Lesser General Public License v3.0
20 stars 14 forks source link

[HarvestWithScythe] Deep woods support #39

Open bcmpinc opened 4 years ago

bcmpinc commented 4 years ago

Scythe doesn't work on forage from the deep woods mod See https://forums.nexusmods.com/index.php?showtopic=6939211/#entry75979523.

maxvollmer commented 3 years ago

Hi! Just saw that you have this feature planned. I had a quick look at your source code to figure out why it doesn't work. Unfortunately I don't have time to implement this and create a PR, but basically the reason your mod can't harvest flowers in DeepWoods, is because flowers are a custom class that inherits HoeDirt and overrides the performToolAction method you patch:

https://github.com/maxvollmer/DeepWoodsMod/blob/master/DeepWoodsMod/Flower.cs#L45

I essentially disable all tools, so that flowers in the forest can't be destroyed, tilled, planted into etc., and the method you patch never gets called.

In order to make the scythe work with your mod, you'd need to patch the performToolAction method in the DeepWoods Flower class directly.

bcmpinc commented 3 years ago

Hi,

Thanks for reaching out to me. I try to avoid patching mods directly, as I might have to update my mod every time the patched mod updates. However, there's an easy way to implement integration with my mod from your side.

If you add the following line as the first in performToolAction, our mods should cooperate correctly: if (t is MeleeWeapon) return performToolAction(t, damage, tileLocation, location);