Пример #1
0
        public void HandleMessage(IServerMessageBase msg)
        {
            if (!(msg.Data is VesselEvaMsgData msgData) || !System.EvaSystemReady)
            {
                return;
            }

            //We received a msg for our own controlled vessel so ignore it
            if (LockSystem.LockQuery.ControlLockBelongsToPlayer(msgData.VesselId, SettingsSystem.CurrentSettings.PlayerName))
            {
                return;
            }

            //Vessel might exist in the store but not in game (if the vessel is in safety bubble for example)
            VesselsProtoStore.UpdateVesselProtoEvaFsm(msgData);

            var vessel = FlightGlobals.FindVessel(msgData.VesselId);

            if (vessel == null || !vessel.isEVA)
            {
                return;
            }

            try
            {
                System.RunEvent(vessel, msgData.NewState, msgData.EventToRun);
            }
            catch (Exception)
            {
                //Ignore the eva animation errors
            }
        }
Пример #2
0
        public void SendEvaData(Vessel vessel, string newState, string eventToRun, float lastBoundStep = float.NaN)
        {
            if (vessel == null)
            {
                return;
            }

            var msgData = NetworkMain.CliMsgFactory.CreateNewMessageData <VesselEvaMsgData>();

            msgData.VesselId      = vessel.id;
            msgData.NewState      = newState;
            msgData.EventToRun    = eventToRun;
            msgData.LastBoundStep = lastBoundStep;

            SendMessage(msgData);

            VesselsProtoStore.UpdateVesselProtoEvaFsm(msgData);
        }