[LIB] Things Go Wrong 1.0.4

Started by RemingtonRyder, December 20, 2018, 09:56:16 AM

Previous topic - Next topic

RemingtonRyder

Things Go Wrong

This is a test implementation of Things Go Wrong designed to target TwitchToolkit.

It uses functions from my mod Sometimes Raids Go Wrong but has been adapted to work with TwitchToolkit. You do not need Sometimes Raids Go Wrong to use this mod, but you do need TwitchToolkit.

What it does is sometimes randomly override TwitchToolkit's raids (the chance can be adjusted in the mod settings page) and make something go wrong.

For normal raids, you will still need Sometimes Raids Go Wrong.

Untested at this time.

Download from Dropbox (source is in the Source folder): https://www.dropbox.com/s/2rh35wuyy1edkno/MarvsThingsGoWrong104_TEST_R1.zip?dl=1

Changelog:
v1.0.4
- Fixed chance=0 or chance=100 not working as they should.
- Fixed for loop error.
- New patching (thanks to Hodl). This version targets v1.7 of TwitchToolkit, so quote is not working yet.

v1.0.2 & v1.0.3
- Updated to target newest version of TwitchToolkit.
- Fixed bad Harmony patching (needed to target TwitchToolkit's assembly).
- Fixed settings menu.

v1.0.1
- TwitchToolkit random storyteller gets an additional roll when deciding whether to choose a Bad, Neutral or Good outcome.
- A random roll to decide the type of outcome is made. Randy gets an additional roll and takes the better result.
- Updated to patch TwitchToolkit's raids.

v1.0.0
- Initial concept, turning Sometimes Raids Go Wrong's events into outcomes which could be triggered for more than just raids. Non-functional, but nice to look at.


hodlhodl

For me I'm getting harmony exception

Error while instantiating a mod of type ThingsGoWrongLib.TGW_Loader: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: No target method specified for class ThingsGoWrongLib.Try_Execute_Worker_Patch (declaringType=, methodName =TryExecuteWorker, methodType=, argumentTypes=NULL)

But this is really cool!

RemingtonRyder

#2
Hmm, if I'm reading the Harmony wiki correctly, then the problem might be that I need to search through the TwitchToolkit assembly, not the RimWorld assembly (which I think would be the default value) which would explain why it cannot find the target method - it literally doesn't exist where it's looking. But that's just my guess.

Edit: Yep, that was the problem. Also, I fixed the settings screen not showing up. Now I just need to test that it actually does something. :)

hodlhodl

I don't i would've broken your fix with last update since i still have my own custom IncidentWorker for raids which i believe is what your overwriting. One thing you should look out for is the reason I have a custom IncidentWorker is because the raids name viewers, and that happens in the code your replacing.

RemingtonRyder

Okay, no worries. I just looked at line 77 of IncidentWorker_Raid.cs and I see what you mean. I'll factor it into the next version.