/// <summary> /// Creates a NetworkNode for a block, checking block attachments, laser, and radio communication. /// </summary> /// <param name="block">The block to create the NetworkNode for.</param> public RelayNode(IMyCubeBlock block) { this.m_loggingName = () => block.DisplayNameText; this.m_logger = new Logger(GetType().Name, block) { MinimumLevel = Logger.severity.INFO }; this.m_ownerId = () => block.OwnerId; this.m_entity = block; this.m_comp_blockAttach = block; this.m_comp_radio = ComponentRadio.TryCreateRadio(block); Ingame.IMyLaserAntenna lAnt = block as Ingame.IMyLaserAntenna; if (lAnt != null) this.m_comp_laser = new ComponentLaser(lAnt); Registrar.Add(block, this); }
/// <summary> /// Checks for a connection between two lasers. Both of them must have been updated. /// </summary> /// <param name="other">The laser to check for a connection to.</param> /// <returns>True iff this laser is targeting other and both are in the final stage.</returns> public bool IsConnectedTo(ComponentLaser other) { return m_targetEntityId == other.m_laser.EntityId && m_state == FinalState && other.m_state == FinalState; }
/// <summary> /// Checks for a connection between two lasers. Both of them must have been updated. /// </summary> /// <param name="other">The laser to check for a connection to.</param> /// <returns>True iff this laser is targeting other and both are in the final stage.</returns> public bool IsConnectedTo(ComponentLaser other) { return(m_targetEntityId == other.m_laser.EntityId && m_state == FinalState && other.m_state == FinalState); }