Closed HymnStudio closed 3 months ago
Thanks a lot for reporting this! This definitely looks wrong. A compound state should under no circumstances have more than one child state active at any given time. So i think the correct flow should be
So an immediate transition will supersede any initial state (which is the idea behind this expect_transition flag, but it obviously is not properly set here). I will do a bit of investigation as such setups may lead to very interesting edge cases and I'll probably also need to update the manual to describe the behaviour that can be expected.
I found another edge case if the transition leaves for a totally different state. Then the initial state is entered but never exited. Fixed this as well.
Here I use the example scene in performance_test, add a transition node to Root compound state, which is an automatic transition to StateB with no delay time and guard.![image](https://github.com/derkork/godot-statecharts/assets/144443371/4bc650f8-10b8-4f9b-b956-aba2dd88ea7d)
By doing so, a compound state can have its two child both active at the same time:![image](https://github.com/derkork/godot-statecharts/assets/144443371/e54ae2da-550b-4ebf-938f-5ab996659338)
I am not sure if it is intended, but here is my understanding: when entering compound state,1. it first calls the base state _state_enter() method, triggering the automatic transiton to active StateB,2. then it calls its _state_enter() method, activating StateA according to its initial state setting:![image](https://github.com/derkork/godot-statecharts/assets/144443371/7157e1e2-e91b-4c5c-a571-ccaee9b9bfa7)