1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Added hook for storage can accept item

This commit is contained in:
DJ1TJOO 2022-02-05 22:50:31 +01:00
parent 86b104080f
commit 67b4e0be8b

View File

@ -5,6 +5,10 @@ import { typeItemSingleton } from "../item_resolver";
import { ColorItem } from "../items/color_item"; import { ColorItem } from "../items/color_item";
import { ShapeItem } from "../items/shape_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 { export class StorageComponent extends Component {
static getId() { static getId() {
return "Storage"; return "Storage";
@ -56,8 +60,12 @@ export class StorageComponent extends Component {
const itemType = item.getItemType(); const itemType = item.getItemType();
// Check type matches if (MODS_ADDITIONAL_STORAGE_ITEM_RESOLVER[itemType]) {
return MODS_ADDITIONAL_STORAGE_ITEM_RESOLVER[itemType].apply(this, [item]);
}
if (itemType !== this.storedItem.getItemType()) { if (itemType !== this.storedItem.getItemType()) {
// Check type matches
return false; return false;
} }