private void RideOnVehicle(PlayerEntity playerEntity, VehicleEntity vehicle, int preferedSeat) { if (!playerEntity.IsVehicleEnterable(vehicle)) { return; } if (!vehicle.IsRidable()) { vehicle.ResetPose(!SharedConfig.IsOffline && !SharedConfig.IsServer); return; } if (!vehicle.AddPassager(playerEntity, ref preferedSeat)) { Logger.Debug("add passager failed"); return; } var rigidBody = vehicle.gameObject.UnityObject.AsGameObject.GetComponent <Rigidbody>(); playerEntity.controlledVehicle.RideOn(preferedSeat, vehicle.entityKey.Value, rigidBody, _currentTime.CurrentTime); playerEntity.AudioController().StopSwimAudio(); CheckAndAddOwnerId(vehicle, playerEntity); SetPositionInterpolateMode(playerEntity); playerEntity.SetCharacterStateWithVehicle(_contexts, _vehicleContext); }