Add Hierarchy as Template when one member of hierarchy is added
All checks were successful
E2E Testing / test (push) Successful in 1m34s

This commit is contained in:
Sebastian Böckelmann 2024-04-13 07:35:39 +02:00
parent c9bb367f4e
commit 225d6ab43c

View File

@ -1,9 +1,9 @@
import {ModelComponent} from "../ModelComponent";
import {ModelComponentType} from "../ModelComponentType";
import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem";
import {TemplateGamesystem} from "../gamesystems/TemplateGamesystem";
import {ProductTemplateSystem} from "../gamesystems/ProductTemplateSystem";
import {Gamesystem} from "../gamesystems/Gamesystem";
import {TemplateType} from "../TemplateType";
export class Character extends ModelComponent{
@ -16,6 +16,17 @@ export class Character extends ModelComponent{
addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem<Character> | ProductTemplateSystem<Character>) {
if(!this.isGamesystemCharacterSpecific(templateGamesystem.componentName)) {
this.characterSpecificGamesystems.push(templateGamesystem);
if(templateGamesystem instanceof ProductTemplateSystem){
templateGamesystem.innerGamesystems.forEach(innerSystem => {
if(innerSystem instanceof SimpleTemplateGamesystem && innerSystem.templateType == TemplateType.CHARACTER) {
this.addCharacterSpecificGamesystem(innerSystem)
} else if(innerSystem instanceof ProductTemplateSystem && innerSystem.templateType == TemplateType.CHARACTER) {
this.addCharacterSpecificGamesystem(innerSystem)
}
})
} else if(templateGamesystem.parentGamesystem != undefined && templateGamesystem.parentGamesystem instanceof ProductTemplateSystem) {
this.addCharacterSpecificGamesystem(templateGamesystem.parentGamesystem)
}
templateGamesystem.addReferenceKey(this);
}
}