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.2KB

  1. using RobocraftX.Character;
  2. using RobocraftX.Character.Movement;
  3. using Svelto.ECS;
  4. using TechbloxModdingAPI.Engines;
  5. namespace TechbloxModdingAPI.Players
  6. {
  7. public class PlayerEventsEngine : IApiEngine, IReactOnSwap<CharacterPilotSeatEntityStruct>
  8. {
  9. public void Ready()
  10. {
  11. }
  12. public EntitiesDB entitiesDB { get; set; }
  13. public void Dispose()
  14. {
  15. }
  16. public string Name => "TechbloxModdingAPIPlayerEventsEngine";
  17. public bool isRemovable => false;
  18. public void MovedTo(ref CharacterPilotSeatEntityStruct entityComponent, ExclusiveGroupStruct previousGroup, EGID egid)
  19. {
  20. var seatId = entityComponent.pilotSeatEntity.ToEGID(entitiesDB);
  21. var player = EcsObjectBase.GetInstance(new EGID(egid.entityID, CharacterExclusiveGroups.OnFootGroup),
  22. e => new Player(e.entityID));
  23. if (previousGroup == CharacterExclusiveGroups.InPilotSeatGroup)
  24. player.seatExited.Invoke(this, new PlayerSeatEventArgs { SeatId = seatId});
  25. else if (egid.groupID == CharacterExclusiveGroups.InPilotSeatGroup)
  26. player.seatEntered.Invoke(this, new PlayerSeatEventArgs { SeatId = seatId });
  27. }
  28. }
  29. }