turn_manager module

class core.gameCreation.turn_manager.TurnManager

Bases: object

Manages turn-based scheduling and execution of callbacks.

This class allows scheduling callbacks to be executed after a certain number of turns.

next_turn()

Advances to the next turn and dispatches any due callbacks.

Returns:

The new current turn number.

Return type:

int

schedule_in(turns: int, callback, data=None)

Schedule a callback to be executed after a given number of turns.

Parameters:
  • turns (int) – Number of turns to wait before executing the callback.

  • callback (callable) – The function to call when the scheduled turn is reached.

  • data (any, optional) – Optional data to pass to the callback.