pardeike / Achtung2

Command your colonists like a boss!
https://www.patreon.com/pardeike
MIT License
28 stars 11 forks source link

Apparent mod incompatibility between Achtung and BuildProductive #3

Closed mheguy closed 7 years ago

mheguy commented 7 years ago

Rimworld version 0.14.1249 Achtung by @pardeike Version used: https://github.com/pardeike/RimWorld-Achtung-Mod/commit/8a237f92b2c3c0b9ab675a678d5f6f9dd9b592a8

Direct download: https://github.com/pardeike/RimWorld-Achtung-Mod/archive/8a237f92b2c3c0b9ab675a678d5f6f9dd9b592a8.zip

BuildProductive by @micktu Version used: https://github.com/micktu/RimWorld-BuildProductive/tree/0.30

Direct download: https://github.com/micktu/RimWorld-BuildProductive/releases/download/0.30/BuildProductive-0.30.zip

Replication steps: Attempt to start a new colony with both mods enabled (mod order and/or presence of CCL or other mods has no discernible effect).

Error log:

Initializing new game with mods Core, AchtungMod, and BuildProductive-0.30
...
Exception from asynchronous event: System.StackOverflowException: The requested operation caused a stack overflow.

These next 2 lines repeat 599 times in the error log.

  at AchtungMod.MapIniterUtility_Patch.MapIniterUtility_FinalizeMapInit () [0x00000] in <filename unknown>:0 
  at BuildProductive.InitScript.MapIniterUtility_FinalizeMapInit () [0x00000] in <filename unknown>:0 

Ref: https://github.com/micktu/RimWorld-BuildProductive/issues/1

pardeike commented 7 years ago

See my comment in the other repo.

pardeike commented 7 years ago

I finally found a new way to patch Rimworld code. With this, any number of mods can inject code that runs at the beginning or end of an existing method and even has the ability to skip the original code if necessary. I do it by creating dynamic code and compile it at runtime, then patch the routine to that new code. Side effect: everyone can use the lib to compile stuff at runtime for their own purpose.

Just fixing the last few quirks and adding some sort of importance factor to each patch so the lib can order them in a custom order that is independent of mod load order.

I will create a repo here that will allow everyone to contribute and drive this into a direction that everyone could benefit from.

micktu commented 7 years ago

Totally makes sense. Good job! Unfortunately, I cannot contribute, as I'm not supporting my mod anymore. Go on and promote this thing in the modding forums, but beware of the angry overprotective CCL authors.

pardeike commented 7 years ago

Hi micktu. Not sure if you're interested but I think you might find it interesting that I have released a general c# patching library called "Harmony". Works with Unity mods (not Rimworld only) and is totally non-destructive. Check it out at https://github.com/pardeike/Harmony and feel free to contribute if you're into such a thing :-)

Cheers!