A stable modding interface between Techblox and mods https://mod.exmods.org/
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.

CommandPatch.cs 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Reflection;
  7. using HarmonyLib;
  8. using Svelto.Context;
  9. using Svelto.ECS;
  10. using RobocraftX;
  11. using RobocraftX.Multiplayer;
  12. using RobocraftX.StateSync;
  13. using Unity.Entities;
  14. using GamecraftModdingAPI.Utility;
  15. namespace GamecraftModdingAPI.Commands
  16. {
  17. /// <summary>
  18. /// Patch of RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<T>()
  19. /// </summary>
  20. // TODO: fix
  21. [HarmonyPatch]
  22. //[HarmonyPatch(typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot))]
  23. //[HarmonyPatch("Compose")]
  24. //[HarmonyPatch("Compose", new Type[] { typeof(UnityContext<FullGameCompositionRoot>), typeof(EnginesRoot), typeof(World), typeof(Action), typeof(MultiplayerInitParameters), typeof(StateSyncRegistrationHelper)})]
  25. static class CommandPatch
  26. {
  27. public static void Postfix(object contextHolder, EnginesRoot enginesRoot, World physicsWorld, Action reloadGame, MultiplayerInitParameters multiplayerParameters, ref StateSyncRegistrationHelper stateSyncReg)
  28. {
  29. // When a game is loaded, register the command engines
  30. CommandManager.RegisterEngines(enginesRoot);
  31. }
  32. public static MethodBase TargetMethod(Harmony instance)
  33. {
  34. return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));
  35. //return func.Method;
  36. }
  37. }
  38. }