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.

34 lines
1.1KB

  1. using System;
  2. using System.Reflection;
  3. using HarmonyLib;
  4. using Svelto.ECS;
  5. using RobocraftX.CR.MainGame;
  6. using RobocraftX.Multiplayer;
  7. using RobocraftX.StateSync;
  8. using TechbloxModdingAPI.Utility;
  9. namespace TechbloxModdingAPI.Commands
  10. {
  11. /// <summary>
  12. /// Patch of RobocraftX.CR.MainGame.MainGameCompositionRoot.DeterministicCompose<T>()
  13. /// Initializes custom commands
  14. /// </summary>
  15. [HarmonyPatch]
  16. static class CommandPatch
  17. {
  18. public static void Postfix(StateSyncRegistrationHelper stateSyncReg)
  19. {
  20. /*CommandLineCompositionRoot.Compose(contextHolder, stateSyncReg.enginesRoot, reloadGame, multiplayerParameters,
  21. stateSyncReg); - uREPL C# compilation not supported anymore */
  22. var enginesRoot = stateSyncReg.enginesRoot;
  23. CommandManager.RegisterEngines(enginesRoot);
  24. }
  25. public static MethodInfo TargetMethod()
  26. {
  27. return AccessTools.Method(typeof(MainGameCompositionRoot), "DeterministicCompose")
  28. .MakeGenericMethod(typeof(object));
  29. }
  30. }
  31. }