Remove generated Duplicate Transitions
All checks were successful
E2E Testing / test (push) Successful in 1m33s

This commit is contained in:
Sebastian Böckelmann 2024-04-13 08:13:15 +02:00
parent 7acf334db9
commit ec69b9f436
3 changed files with 15 additions and 2 deletions

View File

@ -34,7 +34,11 @@ export class ProductGamesystemGenerator extends AbstractProductGamesystemGenerat
transition.scriptAccountActions = this.generateCombinedActions(leftTransition.scriptAccountActions, rightTransition.scriptAccountActions);
transition.scriptAccountConditions = this.generateCombinedConditions(leftTransition.scriptAccountConditions, rightTransition.scriptAccountConditions);
if(generatedTransitions.find(generatedTransition => generatedTransition.startingState.equals(startingState) && generatedTransition.endingState.equals(endingState)) == undefined) {
generatedTransitions.push(transition)
} else {
console.log(transition)
}
}
}

View File

@ -141,7 +141,11 @@ export class ProductTemplateGamesystemGenerator<TemplateReference> extends Abstr
transition.scriptAccountConditions = this.generateCombinedConditions(leftConditions, rightConditions);
if(generatedTransitions.find(generatedTransition => generatedTransition.startingState.equals(startingState) && generatedTransition.endingState.equals(endingState)) == undefined) {
generatedTransitions.push(transition)
} else {
console.log(transition)
}
}
}

View File

@ -2,6 +2,7 @@ import {ProductTransition} from "../transitions/ProductTransition";
import {State} from "./State";
import {SimpleState} from "./SimpleState";
import {Transition} from "../transitions/Transition";
import {SimpleTemplateState} from "./SimpleTemplateState";
export class ProductState extends State<ProductTransition> {
innerStates: State<any>[] = [];
@ -29,6 +30,10 @@ export class ProductState extends State<ProductTransition> {
return false;
}
if(state instanceof SimpleTemplateState) {
return false;
}
for(let i=0; i<this.innerStates.length; i++) {
if(!this.innerStates[i].equals((state as ProductState).innerStates[i])) {
return false;