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:
		
							parent
							
								
									86b104080f
								
							
						
					
					
						commit
						67b4e0be8b
					
				| @ -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,8 +60,12 @@ export class StorageComponent extends Component { | ||||
| 
 | ||||
|         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()) { | ||||
|             // Check type matches
 | ||||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user