|
- using RobocraftX.Character;
- using RobocraftX.Character.Movement;
- using Svelto.ECS;
-
- using TechbloxModdingAPI.Engines;
- using TechbloxModdingAPI.Utility;
-
- namespace TechbloxModdingAPI.Players
- {
- public class PlayerEventsEngine : IApiEngine, IReactOnSwap<CharacterPilotSeatEntityStruct>
- {
- public void Ready()
- {
- }
-
- public EntitiesDB entitiesDB { get; set; }
- public void Dispose()
- {
- }
-
- public string Name => "TechbloxModdingAPIPlayerEventsEngine";
- public bool isRemovable => false;
-
- public void MovedTo(ref CharacterPilotSeatEntityStruct entityComponent, ExclusiveGroupStruct previousGroup, EGID egid)
- {
- entitiesDB.TryGetEGID(entityComponent.pilotSeatEntity, out var seatId); //TODO: Can't get EGID
- var player = EcsObjectBase.GetInstance(new EGID(egid.entityID, CharacterExclusiveGroups.OnFootGroup),
- e => new Player(e.entityID));
- if (previousGroup == CharacterExclusiveGroups.InPilotSeatGroup)
- player.seatExited.Invoke(this, new PlayerSeatEventArgs { SeatId = seatId});
- else if (egid.groupID == CharacterExclusiveGroups.InPilotSeatGroup)
- player.seatEntered.Invoke(this, new PlayerSeatEventArgs { SeatId = seatId });
- }
- }
- }
|