From f98ad400e36b723aff7b1a54eb4485f34740f0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 19 Apr 2024 16:07:08 +0200 Subject: [PATCH] Fix Product Template Generation for Relations (generation was not triggered) --- src/app/project/game-model/GameModel.ts | 1 + src/app/project/game-model/characters/CharacterRelation.ts | 2 ++ .../TemplateProductSystemGenerator.ts | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/project/game-model/GameModel.ts b/src/app/project/game-model/GameModel.ts index 1089ccc..295b6bb 100644 --- a/src/app/project/game-model/GameModel.ts +++ b/src/app/project/game-model/GameModel.ts @@ -76,6 +76,7 @@ export class GameModel { let parentProductGamesystem: ProductGamesystem; if(parentGamesystem instanceof SimpleTemplateGamesystem) { + console.log("Simple Template") parentProductGamesystem = ProductTemplateCreator.constructTemplateFromSimpleGamesystem(parentGamesystem, this, templateType!) } else if(parentGamesystem instanceof SimpleGamesystem) { if(simpleGamesystem instanceof SimpleTemplateGamesystem) { diff --git a/src/app/project/game-model/characters/CharacterRelation.ts b/src/app/project/game-model/characters/CharacterRelation.ts index 68dfdfd..bdbd03a 100644 --- a/src/app/project/game-model/characters/CharacterRelation.ts +++ b/src/app/project/game-model/characters/CharacterRelation.ts @@ -4,6 +4,7 @@ import {ProductTemplateSystem} from "../templates/productGamesystem/ProductTempl import {Gamesystem} from "../gamesystems/Gamesystem"; import {SimpleTemplateGamesystem} from "../templates/simpleGamesystem/SimpleTemplateGamesystem"; import {TemplateType} from "../templates/TemplateType"; +import {ProductTemplateCreator} from "../templates/productGamesystem/ProductTemplateCreator"; export class CharacterRelation implements TemplateElement{ @@ -23,6 +24,7 @@ export class CharacterRelation implements TemplateElement{ templateGamesystem.addChildGamesystem(gamesystem); templateGamesystem.addChildGamesystem(gamesystem); this.characterRelationGamesystems.push(templateGamesystem); + templateGamesystem.addTemplateElement(this); } else { console.log("Test") } diff --git a/src/app/project/game-model/gamesystems/productSystemGenerator/TemplateProductSystemGenerator.ts b/src/app/project/game-model/gamesystems/productSystemGenerator/TemplateProductSystemGenerator.ts index ba66f19..9fb3666 100644 --- a/src/app/project/game-model/gamesystems/productSystemGenerator/TemplateProductSystemGenerator.ts +++ b/src/app/project/game-model/gamesystems/productSystemGenerator/TemplateProductSystemGenerator.ts @@ -27,6 +27,8 @@ export class TemplateProductSystemGenerator extends ProductSystemGenerator { const productTemplateSystem = this.productGamesystem as ProductTemplateSystem productTemplateSystem.transitionMap.set(this.templateElement, generationResult.transitions) productTemplateSystem.stateMap.set(this.templateElement, generationResult.states) + + console.log("Test") } protected getTransitionConditions(transition: Transition, leftSystem: boolean) { @@ -41,7 +43,7 @@ export class TemplateProductSystemGenerator extends ProductSystemGenerator { const templateElement = this.determineTemplateElement(leftSystem)!; if(transition instanceof SimpleTemplateTransition && transition.actionMap.has(templateElement)) { - return transition.actionMap.get(this.templateElement)! + return transition.actionMap.get(templateElement)! } else { return transition.scriptAccountActions; } @@ -51,7 +53,7 @@ export class TemplateProductSystemGenerator extends ProductSystemGenerator { protected getStateConditions(state: State, leftSystem: boolean): ScriptAccountCondition[] { const templateElement = this.determineTemplateElement(leftSystem)! if(state instanceof SimpleTemplateState && state.conditionMap.has(templateElement)) { - return state.conditionMap.get(this.templateElement)! + return state.conditionMap.get(templateElement)! } else { return state.conditions } -- 2.34.1