/// <summary> /// Gets the NetworkStorage this client is connected to or null, if it is not connected to a storage. /// Always test against null, player may forget to put an antenna on the ship. /// </summary> /// <returns>The NetworkStorage this client is connected to or null.</returns> public RelayStorage GetStorage() { RelayNode node = GetNode(); RelayStorage store = node != null ? node.Storage : null; Log.DebugLog("current storage: " + StorageName(m_storage) + ", new storage: " + StorageName(store), condition: m_storage != store); if (store != m_storage && m_messageHandler != null) { if (m_storage != null) { m_storage.RemoveMessageHandler(m_block.EntityId); } if (store != null) { store.AddMessageHandler(m_block.EntityId, m_messageHandler); } } m_storage = store; return(m_storage); }