mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Add can mount
This commit is contained in:
@@ -3,6 +3,20 @@ import cn from 'classnames';
|
|||||||
import { isShieldGenerator } from '../shipyard/ModuleUtils';
|
import { isShieldGenerator } from '../shipyard/ModuleUtils';
|
||||||
import { Infinite } from '../components/SvgIcons';
|
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
|
* Returns the translate name for the module mounted in the specified
|
||||||
* slot.
|
* slot.
|
||||||
|
|||||||
Reference in New Issue
Block a user