zolantris / ValheimMods

Collection of ValheimMods, ValheimRaft (originally created by Sarcen) and a few other upcoming mods including a vehicles mod.
GNU General Public License v3.0
8 stars 4 forks source link

[compatibility] searica's MoreVanillaPrefabs #83

Closed zolantris closed 1 month ago

zolantris commented 1 month ago

Use same approach as MoreVanillaPrefabs for patching PlacePiece.

The proposed solution in #81 did not work because the GameObject type broke the transpiler 😢 .

searica commented 1 month ago

Replying to your comment from https://github.com/zolantris/ValheimMods/pull/81#issuecomment-2122262981.

I think the issue with the earlier PR probably came from using OpCodes.Call, AccessTools.Method(typeof(Player_Patch), nameof(PlacedPiece)) instead of Transpilers.EmitDelegate<Func<GameObject, GameObject>>(PlacedPiece). I had wondered if using EmitDelegate was necessary but I was trying to be as minimal as possible with changes and didn't confirm that it was needed so sorry about that.

This looks good to me and I'm glad you can use some of the approaches from MVBP, though I think it's worth crediting that I learned the generic method matching from redseiko's PotteryBarn mod. Also, these changes will probably fix the conflict with CustomShips as well since that is triggered by the PlacePiece transpiler as well. So nice work!