Fix undefined error when adding conditions to freshly added templatestate
All checks were successful
E2E Testing / test (push) Successful in 2m0s
All checks were successful
E2E Testing / test (push) Successful in 2m0s
This commit is contained in:
parent
803d0d4443
commit
859f207503
@ -102,9 +102,11 @@ export class SimpleStateEditorComponent implements OnInit{
|
|||||||
onCreateCondition(state: SimpleState, condition: ScriptAccountCondition) {
|
onCreateCondition(state: SimpleState, condition: ScriptAccountCondition) {
|
||||||
if(this.templateReference instanceof Character) {
|
if(this.templateReference instanceof Character) {
|
||||||
const templateState = state as SimpleTemplateState<Character>
|
const templateState = state as SimpleTemplateState<Character>
|
||||||
console.log("CharacterRef: ", this.templateReference);
|
if(templateState.conditionMap.has(this.templateReference)) {
|
||||||
templateState.conditionMap.get(this.templateReference as Character)!.push(condition)
|
templateState.conditionMap.get(this.templateReference as Character)!.push(condition)
|
||||||
console.log(templateState)
|
} else {
|
||||||
|
templateState.conditionMap.set(this.templateReference as Character, [condition])
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
state.addScriptAccountCondition(condition);
|
state.addScriptAccountCondition(condition);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,16 @@
|
|||||||
{
|
{
|
||||||
"stateLabel": "Wütend",
|
"stateLabel": "Wütend",
|
||||||
"conditionMap": []
|
"conditionMap": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stateLabel": "Enttäuscht",
|
||||||
|
"conditionMap": [
|
||||||
|
{
|
||||||
|
"scriptAccount": "Luftfeuchtigkeit",
|
||||||
|
"minValue": 0,
|
||||||
|
"maxValue": "10"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transitions": [
|
"transitions": [
|
||||||
|
@ -13,6 +13,12 @@
|
|||||||
"conditions": [],
|
"conditions": [],
|
||||||
"stateLabel": "Wütend",
|
"stateLabel": "Wütend",
|
||||||
"stateDescription": ""
|
"stateDescription": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"initial": false,
|
||||||
|
"conditions": [],
|
||||||
|
"stateLabel": "Enttäuscht",
|
||||||
|
"stateDescription": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transitions": [
|
"transitions": [
|
||||||
|
Loading…
Reference in New Issue
Block a user