diff --git a/src/js/game/components/storage.js b/src/js/game/components/storage.js index be243a44..46305929 100644 --- a/src/js/game/components/storage.js +++ b/src/js/game/components/storage.js @@ -5,6 +5,10 @@ import { typeItemSingleton } from "../item_resolver"; import { ColorItem } from "../items/color_item"; import { ShapeItem } from "../items/shape_item"; +/** @type {{ + * [x: string]: (item: BaseItem) => Boolean + * }} */ +export const MODS_ADDITIONAL_STORAGE_ITEM_RESOLVER = {}; export class StorageComponent extends Component { static getId() { return "Storage"; @@ -56,11 +60,15 @@ export class StorageComponent extends Component { const itemType = item.getItemType(); - // Check type matches if (itemType !== this.storedItem.getItemType()) { + // Check type matches return false; } + if (MODS_ADDITIONAL_STORAGE_ITEM_RESOLVER[itemType]) { + return MODS_ADDITIONAL_STORAGE_ITEM_RESOLVER[itemType].apply(this, [item]); + } + if (itemType === "color") { return /** @type {ColorItem} */ (this.storedItem).color === /** @type {ColorItem} */ (item).color; }