private static void HandleVesselProto(VesselProtoMsgData messageData)
        {
            if (!System.ProtoSystemBasicReady || VesselCommon.UpdateIsForOwnVessel(messageData.VesselId))
            {
                return;
            }

            HandleVesselProtoData(messageData.VesselData, messageData.VesselId.ToString(), messageData.Subspace);
        }
Ejemplo n.º 2
0
        public void HandleMessage(IMessageData messageData)
        {
            var msgData = messageData as VesselUpdateMsgData;

            if (msgData == null || !System.UpdateSystemReady || VesselCommon.UpdateIsForOwnVessel(msgData.VesselId))
            {
                return;
            }

            HandleVesselUpdate(msgData);
        }
Ejemplo n.º 3
0
        public void HandleMessage(IMessageData messageData)
        {
            var msgData = messageData as VesselPositionMsgData;

            if (msgData == null || !System.PositionUpdateSystemBasicReady || VesselCommon.UpdateIsForOwnVessel(msgData.VesselId))
            {
                return;
            }

            var update = new VesselPositionUpdate(msgData);

            if (!System.ReceivedUpdates.ContainsKey(update.VesselId))
            {
                System.ReceivedUpdates.Add(update.VesselId, new Queue <VesselPositionUpdate>());
            }

            if (System.ReceivedUpdates[update.VesselId].Count + 1 > VesselPositionInterpolationSystem.MaxTotalUpdatesInQueue)
            {
                System.ReceivedUpdates[update.VesselId].Dequeue();
            }

            System.ReceivedUpdates[update.VesselId].Enqueue(update);
        }
Ejemplo n.º 4
0
        public void HandleMessage(IMessageData messageData)
        {
            var msgData = messageData as VesselUpdateMsgData;

            if (msgData == null || !System.UpdateSystemBasicReady || VesselCommon.UpdateIsForOwnVessel(msgData.VesselId))
            {
                return;
            }

            var update = new VesselUpdate
            {
                Id                 = Guid.NewGuid(),
                ReceiveTime        = Time.fixedTime,
                PlanetTime         = msgData.PlanetTime,
                Stage              = msgData.Stage,
                SentTime           = msgData.GameSentTime,
                ActiveEngines      = msgData.ActiveEngines,
                StoppedEngines     = msgData.StoppedEngines,
                Decouplers         = msgData.Decouplers,
                AnchoredDecouplers = msgData.AnchoredDecouplers,
                Clamps             = msgData.Clamps,
                Docks              = msgData.Docks,
                VesselId           = msgData.VesselId,
                BodyName           = msgData.BodyName,
                Rotation           = msgData.Rotation,
                FlightState        = new FlightCtrlState
                {
                    mainThrottle      = msgData.MainThrottle,
                    wheelThrottleTrim = msgData.WheelThrottleTrim,
                    X              = msgData.X,
                    Y              = msgData.Y,
                    Z              = msgData.Z,
                    killRot        = msgData.KillRot,
                    gearUp         = msgData.GearUp,
                    gearDown       = msgData.GearDown,
                    headlight      = msgData.Headlight,
                    wheelThrottle  = msgData.WheelThrottle,
                    roll           = msgData.Roll,
                    yaw            = msgData.Yaw,
                    pitch          = msgData.Pitch,
                    rollTrim       = msgData.RollTrim,
                    yawTrim        = msgData.YawTrim,
                    pitchTrim      = msgData.PitchTrim,
                    wheelSteer     = msgData.WheelSteer,
                    wheelSteerTrim = msgData.WheelSteerTrim
                },
                ActionGrpControls = msgData.ActiongroupControls,
                IsSurfaceUpdate   = msgData.IsSurfaceUpdate
            };

            if (update.IsSurfaceUpdate)
            {
                update.Position     = msgData.Position;
                update.Velocity     = msgData.Velocity;
                update.Acceleration = msgData.Acceleration;
            }
            else
            {
                update.Orbit = msgData.Orbit;
            }

            if (!System.ReceivedUpdates.ContainsKey(update.VesselId))
            {
                System.ReceivedUpdates.Add(update.VesselId, new Queue <VesselUpdate>());
            }

            if (System.ReceivedUpdates[update.VesselId].Count + 1 > VesselUpdateInterpolationSystem.MaxTotalUpdatesInQueue)
            {
                System.ReceivedUpdates[update.VesselId].Dequeue();
            }

            System.ReceivedUpdates[update.VesselId].Enqueue(update);
        }