CharacterSpecific Templatesystems #36

Merged
sebastian merged 31 commits from template-systems into main 2024-04-14 13:45:04 +02:00
3 changed files with 20 additions and 3 deletions
Showing only changes of commit 3c9efa1bd5 - Show all commits

View File

@ -1,10 +1,27 @@
import {ModelComponent} from "../ModelComponent"; import {ModelComponent} from "../ModelComponent";
import {ModelComponentType} from "../ModelComponentType"; import {ModelComponentType} from "../ModelComponentType";
import {TemplateElement} from "../templates/TemplateElement"; import {TemplateElement} from "../templates/TemplateElement";
import {TemplateGamesystem} from "../templates/TemplateGamesystem";
import {Gamesystem} from "../gamesystems/Gamesystem";
import {SimpleTemplateGamesystem} from "../templates/simpleGamesystem/SimpleTemplateGamesystem";
export class Character extends ModelComponent implements TemplateElement { export class Character extends ModelComponent implements TemplateElement {
characterSpecificTemplateSystems: Gamesystem<any, any>[] = []
constructor(componentName: string, componentDescription: string) { constructor(componentName: string, componentDescription: string) {
super(componentName, componentDescription, ModelComponentType.CHARACTER); super(componentName, componentDescription, ModelComponentType.CHARACTER);
} }
addCharacterSpecificSimpleTemplatesystem(gamesystem: SimpleTemplateGamesystem) {
if(!this.isTemplateSystemCharacterSpecific(gamesystem.componentName)) {
this.characterSpecificTemplateSystems.push(gamesystem)
gamesystem.addTemplateElement(this)
}
}
private isTemplateSystemCharacterSpecific(gamesystemName: string) {
return this.characterSpecificTemplateSystems.find(gamesystem => gamesystem.componentName === gamesystemName) != undefined
}
} }

View File

@ -7,7 +7,7 @@ export class SimpleTemplateState extends SimpleState {
conditionMap: Map<TemplateElement, ScriptAccountCondition[]> = new Map(); conditionMap: Map<TemplateElement, ScriptAccountCondition[]> = new Map();
addTemplateElement(templateElement: TemplateElement) { addTemplateElement(templateElement: TemplateElement) {
this.conditionMap.set(templateElement, []) this.conditionMap.set(templateElement, this.conditions)
} }
removeTemplateElement(templateElement: TemplateElement) { removeTemplateElement(templateElement: TemplateElement) {

View File

@ -8,8 +8,8 @@ export class SimpleTemplateTransition extends SimpleTransition{
actionMap: Map<TemplateElement, ScriptAccountAction[]> = new Map(); actionMap: Map<TemplateElement, ScriptAccountAction[]> = new Map();
addTemplateElement(templateElement: TemplateElement) { addTemplateElement(templateElement: TemplateElement) {
this.conditionMap.set(templateElement, []) this.conditionMap.set(templateElement, this.scriptAccountConditions.concat())
this.actionMap.set(templateElement, []) this.actionMap.set(templateElement, this.scriptAccountActions.concat())
} }
removeTemplateElement(templateElement: TemplateElement) { removeTemplateElement(templateElement: TemplateElement) {