def _send_tracker_to_client(self, init=False):
     owner = self.owner_sim_info
     if owner is None or owner.is_npc or owner.manager is None:
         return
     msg_empty = True
     msg = Sims_pb2.AspirationTrackerUpdate()
     for guid in self._completed_milestones:
         while not self.milestone_sent(guid):
             self._sent_milestones.add(guid)
             msg.aspirations_completed.append(guid)
             if msg_empty:
                 msg_empty = False
     for guid in self._completed_objectives:
         while not self.objective_sent(guid):
             self._sent_objectives.add(guid)
             msg.objectives_completed.append(guid)
             if msg_empty:
                 msg_empty = False
     if not msg_empty:
         msg.sim_id = owner.id
         msg.init_message = init
         distributor = Distributor.instance()
         distributor.add_op(
             owner,
             GenericProtocolBufferOp(
                 Operation.SIM_ASPIRATION_TRACKER_UPDATE, msg))
Пример #2
0
 def _send_tracker_to_client(self, init=False):
     owner = self.owner_sim_info
     if owner is None or owner.is_npc or owner.manager is None:
         return
     msg_empty = True
     msg = Sims_pb2.AspirationTrackerUpdate()
     for aspiration in self._completed_milestones:
         if not self.milestone_sent(aspiration):
             self._sent_milestones.add(aspiration)
             msg.aspirations_completed.append(aspiration.guid64)
             msg_empty = False
     for objective in self._completed_objectives:
         if not self.objective_sent(objective):
             self._sent_objectives.add(objective)
             msg.objectives_completed.append(objective.guid64)
             msg_empty = False
     for objective in self._reset_objectives:
         if not self.objective_sent(objective):
             self._sent_objectives.add(objective)
             msg.objectives_reset.append(objective.guid64)
             msg_empty = False
     for unlocked_hidden_aspiration_track in self._unlocked_hidden_aspiration_tracks:
         if not self.unlocked_hidden_aspiration_track_sent(
                 unlocked_hidden_aspiration_track):
             msg.unlocked_hidden_aspiration_tracks.append(
                 unlocked_hidden_aspiration_track.guid64)
             msg_empty = False
     if not msg_empty:
         msg.sim_id = owner.id
         msg.init_message = init
         distributor = Distributor.instance()
         distributor.add_op(
             owner,
             GenericProtocolBufferOp(
                 Operation.SIM_ASPIRATION_TRACKER_UPDATE, msg))