Open RadthorDax opened 4 years ago
There is _zero_ reason to reinvent the wheel here. Harmony allows _any_ number of patches to the same method. The problem here are **modders** (including **this** mod's authors) who decide to only go the "I'll prefix/postfix this method & replace the whole stinkin thing with _my_ logic and that's that. Screw everybody else!". This ultimately is not one iota better than just detouring stuff and _praying_ that you are the last guy who gets to detour everybody elses detours... *That is not a tennable situation*. --- Coming from modding a game (Rimworld) which did go through quite the same growing pains (everybody under the sun wanted to do *their* patch and did not think about playing well with others) I can tell that Harmony **used correctly** solves all those problems. That game now enjoys thousands and thousands of different mods, with an overwhelming amount of mods (I'd say >99,9%) not having any undesired interactions or blocking each other. That is because someone put together a tool which allows multiple people mucking around in the same functionality without everybody blocking everybody else. Problem is: *That tool needs to be used _correctly_*. Which in Harmony's case means: nine times out of ten people need to either * use Postfixes to let default logic run and then muck around with the returned results as desired * or use a `HarmonyTranspiler` to surgically only modify _that_ tiny part of the default method which deals with the functionality you want to change and not just make a copy and wrench in your own stuff. I'm aware that writing transpilers - especially transpilers which interact nice with potential other transpilers - is **hard**. Hard as in "it might not be rocket science, but you certainly can at least see that topic from where you're at". _Of course_ there will always be collisions which can not be resolved. If mod `Foo` wants to change a skill to give an additional `30%` bonus it might just end up multiplying the default value with `1.3`. Now if another mod is already in there and adds its own `20%` bonus you might end up with `50% (30+20)` or even `56%` bonus (1.3*1.2). That's something the user is going to have to live with, because if they run multiple things which modify the very same thing there may well be interactions. But *please* dont go "lalala, someone touched this I'm not doing my stuff" or the reverse "screw everybody else, I'll just jam in _my_ prefix". Write a postfix... write a transpiler... write _minimal_ patches!
> The problem here are **modders** (including **this** mod's authors) who decide to only go the "I'll prefix/postfix this method & replace the whole stinkin thing with _my_ logic and that's that. Screw everybody else!".
Hey stop being belligerent.
Our patches look like this, from [NeutralClanTierUpPatch.cs](https://github.com/Tyler-IN/MnB2-Bannerlord-CommunityPatch/blob/dev/src/CommunityPatch/Patches/NeutralClanTierUpPatch.cs) as an example;
```cs
private static readonly MethodInfo TargetMethodInfo = typeof(HeroSpawnCampaignBehavior).GetMethod("OnClanTierIncreased", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly);
private static readonly MethodInfo PatchMethodInfo = typeof(NeutralClanTierUpPatch).GetMethod(nameof(Prefix), BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly);
public override IEnumerable
But when you disable your fixes on a hair trigger, it artificially creates a conflict where none exists.
We intend to have options to be added in a GUI that gives each patch 3 states; Automatic, Forced, and Disabled. Automatic is the current mode of operation.
It should also show the applicability of the patch, whether or not it has been applied, and other information.
Right now this information is only visible in a diagnostic report.
As more and more methods are patched by the community mod, an increasing number of other mods will also be patching those methods, not always to fix the same issue as you guys are. Often these patches will even be compatible with the community patch. But when you disable your fixes on a hair trigger, it artificially creates a conflict where none exists.
I'd like to see some solution that allows the community patch to run alongside other mods that affect the same methods but play nice with each other. Whether that's a specific substring in the harmony patch id, or a prompt for the user to decide manually and the decision result saved, or something else entirely, I don't mind.
This is only going to become a larger issue as more mods get made and more fixes are added to the community patch.