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.

35 lines
1.3KB

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