You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CameraPatch.cs 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System.Reflection;
  2. using HarmonyLib;
  3. using Svelto.ECS;
  4. using Unity.Jobs;
  5. namespace NScript
  6. {
  7. [HarmonyPatch]
  8. class CameraPatch
  9. {
  10. public static bool AllowDefaultBehaviour = true;
  11. public static bool Prefix(in float deltaTime, ExclusiveGroup cameraGroup)
  12. {
  13. if (!AllowDefaultBehaviour) GamecraftModdingAPI.Utility.Logging.MetaLog("Doing custom camera");
  14. return AllowDefaultBehaviour;
  15. }
  16. [HarmonyTargetMethod]
  17. static MethodBase Target()
  18. {
  19. return AccessTools.Method("Techblox.Camera.CharacterCameraMovementEngine:SimulateCameras");
  20. }
  21. }
  22. [HarmonyPatch]
  23. class RotationPatch
  24. {
  25. public static bool Prefix(JobHandle jobHandle, ref JobHandle __result)
  26. {
  27. if (!CameraPatch.AllowDefaultBehaviour) GamecraftModdingAPI.Utility.Logging.MetaLog("Doing custom rotation");
  28. __result = default(JobHandle);
  29. return CameraPatch.AllowDefaultBehaviour;
  30. }
  31. [HarmonyTargetMethod]
  32. static MethodBase Target()
  33. {
  34. return AccessTools.Method("Techblox.Camera.VisualCameraRotationEngine:Execute");
  35. }
  36. }
  37. [HarmonyPatch]
  38. class VisualPatch
  39. {
  40. public static bool Prefix(JobHandle jobHandle, ref JobHandle __result)
  41. {
  42. if (!CameraPatch.AllowDefaultBehaviour) GamecraftModdingAPI.Utility.Logging.MetaLog("Doing custom visual");
  43. __result = default(JobHandle);
  44. return CameraPatch.AllowDefaultBehaviour;
  45. }
  46. [HarmonyTargetMethod]
  47. static MethodBase Target()
  48. {
  49. return AccessTools.Method("Techblox.Camera.VisualCameraEffectsEngine:Execute");
  50. }
  51. }
  52. }