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.

33 lines
1.0KB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Harmony;
  7. using RobocraftX;
  8. using Svelto.ECS;
  9. using GamecraftModdingAPI.Utility;
  10. namespace GamecraftModdingAPI.Events
  11. {
  12. /// <summary>
  13. /// Patch of RobocraftX.FullGameCompositionRoot.ActivateGame()
  14. /// </summary>
  15. [HarmonyPatch(typeof(FullGameCompositionRoot), "ActivateGame")]
  16. class GameActivatedPatch
  17. {
  18. public static void Postfix(ref EnginesRoot ____mainGameEnginesRoot)
  19. {
  20. // register custom game engines
  21. GameEngineManager.RegisterEngines(____mainGameEnginesRoot);
  22. // A new EnginesRoot is always created when ActivateGame is called
  23. // so all event emitters and handlers must be re-registered.
  24. EventManager.RegisterEngines(____mainGameEnginesRoot);
  25. Logging.Log("Dispatching Game Activated event");
  26. EventManager.GetEventEmitter("GamecraftModdingAPIGameActivatedEventEmitter").Emit();
  27. }
  28. }
  29. }