示例#1
0
        private void PassengerRemove(Player player, VehiclePassenger passenger)
        {
            player.VehicleGuid = 0;
            player.MovementManager.SetPosition(Position);
            player.MovementManager.SetRotation(Rotation);
            player.MovementManager.BroadcastCommands();


            if (passenger.SeatType == VehicleSeatType.Pilot)
            {
                player.SetControl(player);
            }

            passengers.Remove(passenger);
            OnPassengerRemove(player, passenger.SeatType, passenger.SeatPosition);

            EnqueueToVisible(new ServerVehiclePassengerRemove
            {
                Self      = Guid,
                Passenger = passenger.Guid
            }, true);

            // this probably isn't correct for all cases
            if (passengers.Count == 0)
            {
                RemoveFromMap();
            }
        }
示例#2
0
        private void PassengerAdd(VehiclePassenger passenger)
        {
            // possible for a player to no longer be visible due to delayed add
            Player player = GetVisible <Player>(passenger.Guid);

            if (player == null)
            {
                return;
            }

            // TODO: research this...
            player.Session.EnqueueMessageEncrypted(new Server08B3
            {
                MountGuid = Guid,
                Unknown0  = 0,
                Unknown1  = true
            });

            // TODO: research this, something UI related
            player.Session.EnqueueMessageEncrypted(new Server0237
            {
            });

            // TODO: research this...
            // Kirmmin: This is used on both mounting up and dismounting
            player.Session.EnqueueMessageEncrypted(new Server0639
            {
            });

            // sets vehicle guid, seat type and seat position to local self entity at client
            // might not be correct as ServerVehiclePassengerAdd does this too, used for changing seats instead?
            player.Session.EnqueueMessageEncrypted(new Server089B
            {
                Self         = passenger.Guid,
                Vehicle      = Guid,
                SeatType     = passenger.SeatType,
                SeatPosition = passenger.SeatPosition
            });

            EnqueueToVisible(new ServerVehiclePassengerAdd
            {
                Self         = Guid,
                SeatType     = passenger.SeatType,
                SeatPosition = passenger.SeatPosition,
                UnitId       = passenger.Guid
            }, true);

            if (passenger.SeatType == VehicleSeatType.Pilot)
            {
                player.SetControl(this);

                EnqueueToVisible(new ServerEntityFaction
                {
                    UnitId  = Guid,
                    Faction = (ushort)player.Faction1
                }, true);

                Faction1 = player.Faction1;
                Faction2 = player.Faction2;
            }

            player.VehicleGuid = Guid;
            player.MovementManager.SetPosition(Vector3.Zero);
            player.MovementManager.SetRotation(Vector3.Zero);
            player.MovementManager.BroadcastCommands();

            passengers.Add(passenger);
            OnPassengerAdd(player, passenger.SeatType, passenger.SeatPosition);
        }