diff --git a/src/app/project/game-model/GameModel.ts b/src/app/project/game-model/GameModel.ts index 86a2003..3d75321 100644 --- a/src/app/project/game-model/GameModel.ts +++ b/src/app/project/game-model/GameModel.ts @@ -13,7 +13,6 @@ import {ProductTemplateCreator} from "./templates/productGamesystem/ProductTempl import {CharacterRelation} from "./characters/CharacterRelation"; import {ItemGroup} from "./inventory/ItemGroup"; import {AbstractItemGroup} from "./inventory/AbstractItemGroup"; -import {GameModelLoader} from "../../../../app/storage/loader/GameModelLoader"; import {ConcreteItemGroup} from "./inventory/ConcreteItemGroup"; import {Item} from "./inventory/Item"; diff --git a/src/app/project/game-model/inventory/ConcreteItemGroup.ts b/src/app/project/game-model/inventory/ConcreteItemGroup.ts index 3dad098..478721c 100644 --- a/src/app/project/game-model/inventory/ConcreteItemGroup.ts +++ b/src/app/project/game-model/inventory/ConcreteItemGroup.ts @@ -7,6 +7,7 @@ export class ConcreteItemGroup extends ItemGroup { addItem(item: Item) { if(this.findItemByName(item.componentName) == undefined) { + item.addInheritedGroup(this); this.items.push(item); } } diff --git a/src/app/project/game-model/inventory/Item.ts b/src/app/project/game-model/inventory/Item.ts index 179aa18..f1d055f 100644 --- a/src/app/project/game-model/inventory/Item.ts +++ b/src/app/project/game-model/inventory/Item.ts @@ -4,4 +4,14 @@ import {ItemGroup} from "./ItemGroup"; export class Item extends ModelComponent { inheritedGroups: ItemGroup[] = [] + + addInheritedGroup(itemgroup: ItemGroup) { + if(this.findItemgroupByName(itemgroup.componentName) == undefined) { + this.inheritedGroups.push(itemgroup); + } + } + + findItemgroupByName(groupName: string) { + return this.inheritedGroups.find(group => group.componentName === groupName); + } }