CS-ParallelRoadTool
CS-ParallelRoadTool copied to clipboard
Switch to Harmony for detouring
https://github.com/pardeike/Harmony
Imo harmony is superior to the current solution, since it allows multiple detourings to work together without conflicts and determine the order in which they are executed. Check it out.
it allows multiple detourings to work together without conflicts and determine the order in which they are executed.
Does it work also with other mods that are not using Harmony? For example, let's say that a certain mod enables a detour on a method without using Harmony. If I switch to Harmony, will I be able to say that my detour should be executed before or after the one's from the other mod?
I tried Harmony in the very first PoC that I did for this mod, but I ended up with the current solution because it was easier.
Does it work also with other mods that are not using Harmony?
No, it only works if all detours are done with harmony, which is why it's so important IMO that every mod that does detouring switches to that lib.
The alternative is to have non resolvable conflicts in mods so that in the end users can only use one mod or the other. That is a very bad situation to be in IMO.
Not sure why you think the current solution is easier. You can implement Harmony in two different ways, explicitly or with attributes. I prefer the explicit style and I don't think its any different than what you have right now. Here an example: https://github.com/DaEgi01/CitiesSkylines-SortModSettings/blob/master/SortModSettings/Mod.cs
Just tell what method you target, tell what new method you want to use for detouring, and decide if the new method goes prior to, instead of, or after the target.
Ok, so it doesn't provide us any benefit for now. I'll keep this open but I'm marking it with "wontfix" label because I'm not doing this until some of the conflicting mods won't be updated to support Harmony.