@@ -34,9 +34,10 @@ class Bot:
3434
3535 def __init__ (self , tower : RingingRoomTower , row_generator : RowGenerator , do_up_down_in : bool ,
3636 stop_at_rounds : bool , rhythm : Rhythm , user_name : Optional [str ] = None ,
37- server_mode : bool = False ) -> None :
37+ server_instance_id : Optional [ int ] = None ) -> None :
3838 """ Initialise a Bot with all the parts it needs to run. """
39- self ._server_mode = server_mode
39+ # If this is None then Wheatley is in client mode, otherwise Wheatley is in server mode
40+ self ._server_instance_id = server_instance_id
4041 self ._last_activity_time = time .time ()
4142
4243 self ._rhythm = rhythm
@@ -91,6 +92,10 @@ def number_of_bells(self) -> int:
9192 """ Convenient property to find the number of bells in the current tower. """
9293 return self ._tower .number_of_bells
9394
95+ @property
96+ def _server_mode (self ) -> bool :
97+ return self ._server_instance_id is not None
98+
9499 # Callbacks
95100 def _on_setting_change (self , key : str , value : Any ) -> None :
96101 def log_invalid_key (message : str ) -> None :
@@ -144,6 +149,9 @@ def _check_number_of_bells(self) -> bool:
144149 def _on_look_to (self ) -> None :
145150 if self ._check_number_of_bells ():
146151 self .look_to_has_been_called (time .time ())
152+ # All Wheatley instances should return a 'Roll Call' message after `Look To` is called.
153+ if self ._server_instance_id is not None :
154+ self ._tower .emit_roll_call (self ._server_instance_id )
147155
148156 # This has to be made public, because the server's main function might have to call it
149157 def look_to_has_been_called (self , call_time : float ) -> None :
0 commit comments