execute unless entity @e[tag=firstselected] run return run title @s actionbar {"translate":"scientist.craft.selectcomponents","color":"red"}
execute unless entity @e[tag=secondselected] run return run title @s actionbar {"translate":"scientist.craft.selectcomponents","color":"red"}
execute if entity @e[tag=secondselected,tag=firstselected] run return run title @s actionbar {"translate":"scientist.craft.samecomponents","color":"red"}
execute as @e[tag=firstselected] run function ws:work/misc/tier2/scientist/checkcount with entity @s Passengers[].data
execute unless score @n[tag=scientist.craft] scientist.storage matches 20.. run return run title @s actionbar {"translate":"scientist.craft.notenoughcomponents","color":"red"}
execute as @e[tag=secondselected] run function ws:work/misc/tier2/scientist/checkcount with entity @s Passengers[].data
execute unless score @n[tag=scientist.craft] scientist.storage matches 20.. run return run title @s actionbar {"translate":"scientist.craft.notenoughcomponents","color":"red"}
execute as @e[tag=scientist.craft] run function ws:work/misc/tier2/scientist/spawncraft with entity @s