Add can mount

This commit is contained in:
Colin McLeod
2016-03-03 19:55:52 -08:00
parent a19fd69d0b
commit 67b5d749df

View File

@@ -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.