import { GEN_ONE_MULTI_PIPETTES } from '@opentrons/shared-data' ; import { MODULES_WITH_COLLISION_ISSUES } from '../constants' ; import type { DeckSlot , PipetteEntity , InvariantContext , RobotState , } from '../types' ; export const modulePipetteCollision = ( args ) : boolean => { const { pipette , labware , invariantContext , prevRobotState } = args ; if ( invariantContext . config . OT_PD_DISABLE_MODULE_RESTRICTIONS ) { return false ; } const pipetteEntity = pipette ? invariantContext . pipetteEntities [ pipette ] : null ; const labwareSlot = labware ? prevRobotState . labware [ labware ] ?. slot : null ; if ( ! pipette || ! labware || ! pipetteEntity || ! labwareSlot ) { return false ; } const labwareInDangerZone = Object . keys ( invariantContext . moduleEntities ) . some ( moduleId => { const moduleModel = invariantContext . moduleEntities [ moduleId ] . model ; if ( MODULES_WITH_COLLISION_ISSUES . includes ( moduleModel ) ) { const moduleSlot = prevRobotState . modules [ moduleId ] ?. slot ; const labwareInNorthSlot = ( moduleSlot === '1' && labwareSlot === '4' ) || ( moduleSlot === '3' && labwareSlot === '6' ) ; return labwareInNorthSlot ; } else { return false ; } } ) ; return ( GEN_ONE_MULTI_PIPETTES . includes ( pipetteEntity . name ) && labwareInDangerZone ) ; } ;