From bc0617eb85556b441b72b6dab7c35eafc4fc378e Mon Sep 17 00:00:00 2001 From: Sebastian Boeckelmann Date: Sat, 15 Jun 2024 14:17:08 +0200 Subject: [PATCH] Assign ScriptAccountActions to expanded ineraction --- .../character-interaction-editor.component.html | 9 ++++++--- .../character-interaction-editor.component.ts | 7 +++++++ src/app/project/game-model/interactions/Interaction.ts | 7 +++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/app/editor/character-editor/character-interaction-editor/character-interaction-editor.component.html b/src/app/editor/character-editor/character-interaction-editor/character-interaction-editor.component.html index cdb366e..76c23bf 100644 --- a/src/app/editor/character-editor/character-interaction-editor/character-interaction-editor.component.html +++ b/src/app/editor/character-editor/character-interaction-editor/character-interaction-editor.component.html @@ -123,13 +123,16 @@ - - -

Inventory Actions

+ + + + +

Gamesystem Actions

diff --git a/src/app/editor/character-editor/character-interaction-editor/character-interaction-editor.component.ts b/src/app/editor/character-editor/character-interaction-editor/character-interaction-editor.component.ts index da52e9c..d537790 100644 --- a/src/app/editor/character-editor/character-interaction-editor/character-interaction-editor.component.ts +++ b/src/app/editor/character-editor/character-interaction-editor/character-interaction-editor.component.ts @@ -47,6 +47,13 @@ export class CharacterInteractionEditorComponent implements OnInit{ return interaction instanceof InteractionSequences } + getInterActionAsSolidInteraction(interaction: AbstractInteraction) { + if(interaction instanceof Interaction) { + return interaction as Interaction; + } + return undefined; + } + addInteraction() { const interaction = new Interaction(this.character!, undefined, "") this.editedElement = interaction; diff --git a/src/app/project/game-model/interactions/Interaction.ts b/src/app/project/game-model/interactions/Interaction.ts index 0c639e4..cd89c73 100644 --- a/src/app/project/game-model/interactions/Interaction.ts +++ b/src/app/project/game-model/interactions/Interaction.ts @@ -2,6 +2,9 @@ import {Character} from "../characters/Character"; import {Condition} from "./condition/Condition"; import {Action} from "./actions/Action"; import {AbstractInteraction} from "./AbstractInteraction"; +import {ScriptAccountCondition} from "../gamesystems/conditions/ScriptAccountCondition"; +import {ScriptAccountAction} from "../gamesystems/actions/ScriptAccountAction"; +import {InventoryCondition} from "./condition/InventoryCondition"; export class Interaction extends AbstractInteraction{ @@ -34,6 +37,10 @@ export class Interaction extends AbstractInteraction{ return validCharacters && validLabel; } + get scriptAccountActions() : ScriptAccountAction[]{ + return this.actions.filter(condition => condition instanceof ScriptAccountAction).map(condition => condition as ScriptAccountAction) + } + addAction(action: Action) { this.actions.push(action);