From 4d4efa49c9d4268b172bfc2dd833d92303fa14dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sun, 14 Apr 2024 11:39:39 +0200 Subject: [PATCH] Exclude SiblingTemplates to be automatically specified only by recursive call --- src/app/project/game-model/characters/Character.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/project/game-model/characters/Character.ts b/src/app/project/game-model/characters/Character.ts index e4161ab..4d9bf6c 100644 --- a/src/app/project/game-model/characters/Character.ts +++ b/src/app/project/game-model/characters/Character.ts @@ -15,7 +15,7 @@ export class Character extends ModelComponent implements TemplateElement { super(componentName, componentDescription, ModelComponentType.CHARACTER); } - addCharacterSpecificSimpleTemplatesystem(gamesystem: Gamesystem) { + addCharacterSpecificSimpleTemplatesystem(gamesystem: Gamesystem, recursiveCall: boolean = false) { if(!this.isTemplateSystemCharacterSpecific(gamesystem.componentName)) { if(gamesystem instanceof SimpleTemplateGamesystem) { this.characterSpecificTemplateSystems.push(gamesystem) @@ -23,10 +23,15 @@ export class Character extends ModelComponent implements TemplateElement { } else if(gamesystem instanceof ProductTemplateSystem) { this.characterSpecificTemplateSystems.push(gamesystem) gamesystem.addTemplateElement(this) + + if(!recursiveCall) { + gamesystem.innerGamesystems.forEach(innerGamesystem => this.addCharacterSpecificSimpleTemplatesystem(innerGamesystem, true)) + } + } if(gamesystem.parentGamesystem != undefined) { - this.addCharacterSpecificSimpleTemplatesystem(gamesystem.parentGamesystem) + this.addCharacterSpecificSimpleTemplatesystem(gamesystem.parentGamesystem, true) } } }