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.

42 lines
1.2KB

  1. using System;
  2. using GamecraftModdingAPI.Engines;
  3. using GamecraftModdingAPI.Utility;
  4. using RobocraftX.Common;
  5. using Svelto.ECS;
  6. namespace GamecraftModdingAPI.Blocks
  7. {
  8. public class BlockEventsEngine : IReactionaryEngine<DBEntityStruct>
  9. {
  10. public event EventHandler<BlockPlacedRemovedEventArgs> Placed;
  11. public event EventHandler<BlockPlacedRemovedEventArgs> Removed;
  12. public void Ready()
  13. {
  14. }
  15. public EntitiesDB entitiesDB { get; set; }
  16. public void Dispose()
  17. {
  18. }
  19. public string Name { get; } = "GamecraftModdingAPIBlockEventsEngine";
  20. public bool isRemovable { get; } = false;
  21. public void Add(ref DBEntityStruct entityComponent, EGID egid)
  22. {
  23. ExceptionUtil.InvokeEvent(Placed, this, new BlockPlacedRemovedEventArgs {ID = egid, Type = (BlockIDs) entityComponent.DBID});
  24. }
  25. public void Remove(ref DBEntityStruct entityComponent, EGID egid)
  26. {
  27. ExceptionUtil.InvokeEvent(Removed, this, new BlockPlacedRemovedEventArgs {ID = egid, Type = (BlockIDs) entityComponent.DBID});
  28. }
  29. }
  30. public struct BlockPlacedRemovedEventArgs
  31. {
  32. public EGID ID;
  33. public BlockIDs Type;
  34. }
  35. }