From 67b5d749df6a0853e303b599462f5d0d069b0afa Mon Sep 17 00:00:00 2001 From: Colin McLeod Date: Thu, 3 Mar 2016 19:55:52 -0800 Subject: [PATCH] Add can mount --- src/app/utils/SlotFunctions.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app/utils/SlotFunctions.js b/src/app/utils/SlotFunctions.js index 8812b6af..63b9391b 100644 --- a/src/app/utils/SlotFunctions.js +++ b/src/app/utils/SlotFunctions.js @@ -3,6 +3,20 @@ import cn from 'classnames'; import { isShieldGenerator } from '../shipyard/ModuleUtils'; import { Infinite } from '../components/SvgIcons'; +/** + * Determine if a slot can mount a module of a particular class and group + * @param {Object} slot Slot object + * @param {String} group Module group/type abbrivation/code + * @param {Integer} clazz [Optional] Module Class/Size + * @return {Boolean} True if the slot can mount the module + */ +export function canMount(slot, group, clazz) { + if (slot && (!slot.eligible || slot.eligible[group]) && (clazz === undefined || slot.maxClass >= clazz)) { + return true; + } + return false; +} + /** * Returns the translate name for the module mounted in the specified * slot.