OctoD/godot-gameplay-systems

๐Ÿ› [bug] Signal emission in the end_turn_sequence() method in TurnBasedGame.gd maybe incorrect.

cbrfkygame opened this issue ยท 3 comments

subscribers[current_turn].turn_started.emit() and subscribers[current_turn]._turn_started() should be changed to subscribers[current_turn].turn_ended.emit() and subscribers[current_turn]._turn_ended().

Another issue is whether the turn_game_stopped.emit() and turn_game_started.emit() are missing in the next_turn() method in the same class.โ€

OctoD commented

Hi, may I ask you to be a bit more precise on where it should be incorrect? Thank you.

I am a little confused about the function of end_turn_sequence(). In my opinion, the end_turn_sequence() function is performed when the turn-based battle ends, and there is no next subscriber to act. Otherwise, this method can be replaced with next_turn(). However, the current end_turn_sequence() first calls subscribers[current_turn].end_turn(), which means that next_turn() is called. Then current_turn += 1, once again increasing the number of turns and triggering the start signal of the current subscribers.

Before calling end_turn_sequence(), assuming the current turn is 1, during the process of subscribers[current_turn].end_turn(), the end signal of subscribers[1] and the start signal of subscribers[2] are emitted. Subsequently, the code emits the start signal of subscribers[3]. According to my understanding of the end_turn_sequence() function, only emitting the end signal of subscribers[1] is ok.

OctoD commented

Thank you for highlighting this issue! I admit I rushed the turn based nodes while commuting, I am sorry for the inconvenience!