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.

GameStateBuildEmitterEngine.cs 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using Unity.Jobs;
  3. using RobocraftX.StateSync;
  4. using Svelto.ECS;
  5. using GamecraftModdingAPI.Utility;
  6. namespace GamecraftModdingAPI.Events
  7. {
  8. /// <summary>
  9. /// Event emitter engine for switching to to build mode.
  10. /// </summary>
  11. public class GameStateBuildEmitterEngine : IEventEmitterEngine, IInitializeOnBuildStart
  12. {
  13. public string Name { get; } = "GamecraftModdingAPIGameStateBuildEventEmitter" ;
  14. public EntitiesDB entitiesDB { set; private get; }
  15. public object type { get; } = EventType.BuildSwitchedTo;
  16. public bool isRemovable { get; } = false;
  17. public IEntityFactory Factory { set; private get; }
  18. public void Dispose() { }
  19. public void Emit()
  20. {
  21. Logging.Log("Dispatching Build Switched To event");
  22. if (Factory == null) { return; }
  23. Factory.BuildEntity<ModEventEntityDescriptor>(ApiExclusiveGroups.eventID++, ApiExclusiveGroups.eventsExclusiveGroup)
  24. .Init(new ModEventEntityStruct { type = type });
  25. }
  26. public JobHandle OnInitializeBuildMode()
  27. {
  28. Emit();
  29. return default(JobHandle);
  30. }
  31. public void Ready() { }
  32. }
  33. }