BruceOfTheBow / BruceComfyMods

Player mods made for Comfy Valheim
GNU General Public License v3.0
1 stars 3 forks source link

[ValheimRAFT] compatibility with dynamic rotation #14

Closed zolantris closed 1 week ago

zolantris commented 1 month ago

Hello! Opening a help question here to see if we can figure a way to make these two mods compatible with each-other.

The Code

ValheimRAFT patches only relative rotations related to base-game calls of Quaternion.Euler is the only call that is changed when patching Player.UpdatePlacementGhost. Here is the section.

This transpiler method is not enough to fix other rotation mods including gizmo if they do not call Quaternion.Euler. Makes this approach a bit too brittle.

Guessing this may only be the first part of the issue too. IE after ghost placement there might be additional logic that needs overrides.

BruceOfTheBow commented 1 month ago

ComfyGizmo transpiles the Quaternion value returned from the Quaternion.Euler() call that is used in the rest of UpdatePlacementGhost. Merely patching Quaternion.Euler will indeed result in the calculations done in ValheimRAFT being overwritten.

https://github.com/BruceOfTheBow/BruceComfyMods/blob/5dee1e82148ce8dbb36ea5fb11375e6ecb9845dd/ComfyGizmo/Patches/PlayerPatch.cs#L93-L107

BruceOfTheBow commented 1 month ago

For compatibility you could check if Gizmo is installed, then conditionally patch RotationManager.GetRotation() to return your desired rotation you're calculating in RelativeEuler().

zolantris commented 1 month ago

Thanks! I'll close this when I add a fix to raft. Probably today/tomorrow.

zolantris commented 1 month ago

Hmm, so I think there is more to this issue. The snapping rotation even with a patch to RotationMangaer is not in alignment. Guessing snapping points local position will also need a patch.

BruceOfTheBow commented 1 month ago

Not quite sure what you mean by that. Is that something on the ValheimRAFT side? Let me know if there's any other info on ComfyGizmo that would be helpful to know.

BruceOfTheBow commented 1 week ago

Please reopen if any further questions on ComfyGizmo.