public void HandleMessage(IServerMessageBase msg) { if (!(msg.Data is VesselPartSyncMsgData msgData) || !System.PartSyncSystemReady) { return; } //We received a msg for our own controlled/updated vessel so ignore it if (!VesselCommon.DoVesselChecks(msgData.VesselId)) { return; } //Vessel might exist in the store but not in game (if the vessel is in safety bubble for example) VesselsProtoStore.UpdateVesselProtoPartModules(msgData); var vessel = FlightGlobals.FindVessel(msgData.VesselId); if (vessel == null) { return; } UpdateVesselValues(vessel.protoVessel, msgData); }
public void SendVesselPartSyncMsg(Guid vesselId, uint partFlightId, string moduleName, string baseModuleName, string fieldName, string value) { var msgData = NetworkMain.CliMsgFactory.CreateNewMessageData <VesselPartSyncMsgData>(); msgData.VesselId = vesselId; msgData.PartFlightId = partFlightId; msgData.ModuleName = moduleName; msgData.BaseModuleName = baseModuleName; msgData.FieldName = fieldName; msgData.Value = value; VesselsProtoStore.UpdateVesselProtoPartModules(msgData); SendMessage(msgData); }
public void SendVesselPartSyncMsg(Guid vesselId, uint partFlightId, string moduleName, string baseModuleName, string fieldName, string value) { var msgData = NetworkMain.CliMsgFactory.CreateNewMessageData <VesselPartSyncMsgData>(); msgData.ServerIgnore = FieldModuleStore.GetCustomFieldDefinition(moduleName, fieldName)?.ServerIgnore ?? false; msgData.GameTime = TimeSyncerSystem.UniversalTime; msgData.VesselId = vesselId; msgData.PartFlightId = partFlightId; msgData.ModuleName = moduleName; msgData.BaseModuleName = baseModuleName; msgData.FieldName = fieldName; msgData.Value = value; VesselsProtoStore.UpdateVesselProtoPartModules(msgData); SendMessage(msgData); }