Automatically add Owning group of item to inherited group-list
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				E2E Testing / test (push) Successful in 1m44s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	E2E Testing / test (push) Successful in 1m44s
				
			This commit is contained in:
		
							parent
							
								
									bf4c6bd19c
								
							
						
					
					
						commit
						a57024c6af
					
				@ -13,7 +13,6 @@ import {ProductTemplateCreator} from "./templates/productGamesystem/ProductTempl
 | 
				
			|||||||
import {CharacterRelation} from "./characters/CharacterRelation";
 | 
					import {CharacterRelation} from "./characters/CharacterRelation";
 | 
				
			||||||
import {ItemGroup} from "./inventory/ItemGroup";
 | 
					import {ItemGroup} from "./inventory/ItemGroup";
 | 
				
			||||||
import {AbstractItemGroup} from "./inventory/AbstractItemGroup";
 | 
					import {AbstractItemGroup} from "./inventory/AbstractItemGroup";
 | 
				
			||||||
import {GameModelLoader} from "../../../../app/storage/loader/GameModelLoader";
 | 
					 | 
				
			||||||
import {ConcreteItemGroup} from "./inventory/ConcreteItemGroup";
 | 
					import {ConcreteItemGroup} from "./inventory/ConcreteItemGroup";
 | 
				
			||||||
import {Item} from "./inventory/Item";
 | 
					import {Item} from "./inventory/Item";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,6 +7,7 @@ export class ConcreteItemGroup extends ItemGroup {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  addItem(item: Item) {
 | 
					  addItem(item: Item) {
 | 
				
			||||||
    if(this.findItemByName(item.componentName) == undefined) {
 | 
					    if(this.findItemByName(item.componentName) == undefined) {
 | 
				
			||||||
 | 
					      item.addInheritedGroup(this);
 | 
				
			||||||
      this.items.push(item);
 | 
					      this.items.push(item);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -4,4 +4,14 @@ import {ItemGroup} from "./ItemGroup";
 | 
				
			|||||||
export class Item extends ModelComponent {
 | 
					export class Item extends ModelComponent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  inheritedGroups: ItemGroup[] = []
 | 
					  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);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user