private void OnRiderGetState(EntityUid uid, RiderComponent component, ref ComponentGetState args)
 {
     args.State = new RiderComponentState()
     {
         Entity = component.Vehicle,
     };
 }
 /// <summary>
 /// Kick the rider off the vehicle if they go into crit or die.
 /// </summary>
 private void OnMobStateChanged(EntityUid uid, RiderComponent rider, MobStateChangedEvent args)
 {
     if (args.Component.IsCritical() || args.Component.IsDead())
     {
         UnbuckleFromVehicle(uid);
     }
 }
 /// <summary>
 /// Kick the rider off the vehicle if they press q / drop the virtual item
 /// </summary>
 private void OnVirtualItemDeleted(EntityUid uid, RiderComponent component, VirtualItemDeletedEvent args)
 {
     if (args.BlockingEntity == component.Vehicle)
     {
         UnbuckleFromVehicle(uid);
     }
 }
 private void OnRiderGetStateAttempt(EntityUid uid, RiderComponent component, ref ComponentGetStateAttemptEvent args)
 {
     if (uid != args.Player.AttachedEntity)
     {
         args.Cancelled = true;
     }
 }
 private void OnRiderRemoval(EntityUid uid, RiderComponent component, ref MetaFlagRemoveAttemptEvent args)
 {
     if ((args.ToRemove & MetaDataFlags.EntitySpecific) != 0x0)
     {
         args.ToRemove = MetaDataFlags.None;
     }
 }
 private void OnRiderPull(EntityUid uid, RiderComponent component, PullAttemptEvent args)
 {
     if (component.Vehicle != null)
     {
         args.Cancelled = true;
     }
 }
        private void OnRiderHandleState(EntityUid uid, RiderComponent component, ref ComponentHandleState args)
        {
            // Server should only be sending states for our entity.
            if (args.Current is not RiderComponentState state)
            {
                return;
            }
            component.Vehicle = state.Entity;

            UpdateEye(component);
        }
        private void UpdateEye(RiderComponent component)
        {
            if (!TryComp(component.Vehicle, out EyeComponent? eyeComponent))
            {
                TryComp(_playerManager.LocalPlayer?.ControlledEntity, out eyeComponent);
            }

            if (eyeComponent?.Eye == null)
            {
                return;
            }

            _eyeManager.CurrentEye = eyeComponent.Eye;
        }
 private void OnRiderDetached(EntityUid uid, RiderComponent component, PlayerDetachedEvent args)
 {
     UpdateEye(component);
 }
 private void OnRiderShutdown(EntityUid uid, RiderComponent component, ComponentShutdown args)
 {
     component.Vehicle = null;
     UpdateEye(component);
 }
 /// <summary>
 /// Kick the rider off the vehicle if they get stunned
 /// </summary>
 private void OnFallDown(EntityUid uid, RiderComponent rider, FellDownEvent args)
 {
     UnbuckleFromVehicle(uid);
 }
 private void OnRiderShutdown(EntityUid uid, RiderComponent component, ComponentShutdown args)
 {
     _metadata.RemoveFlag(uid, MetaDataFlags.EntitySpecific);
 }
 private void OnRiderStartup(EntityUid uid, RiderComponent component, ComponentStartup args)
 {
     _metadata.AddFlag(uid, MetaDataFlags.EntitySpecific);
 }