Example #1
0
    def _on_target_request(self, allow_ground, target_id, flags):
        if not self._target_locked: return

        if False:
            # point to floor

            position = self._world.player.position
            if position is None:
                self._target_mutex.put_target()
                self._failure()
                return

            self._client.send(p.TargetResponse(1, target_id, flags, 0,
                                               position.x, position.y, position.z, 0))
            self._target_mutex.put_target()
            self._success()
        else:
            assert self._targets

            # get the next target from the list and send TargetResponse
            target, self._targets = self._targets[0], self._targets[1:]
            self._client.send(p.TargetResponse(0, target_id, flags, target.serial,
                                               0xffff, 0xffff, -1, 0))

            if not self._targets:
                # all targets have been used: return the target cursor
                # reservation
                self._target_mutex.put_target()
                self._success()
Example #2
0
    def response(self, target_id, flags):
        if self.serial != 0:
            type = 0
        else:
            type = 1

        return p.TargetResponse(type, target_id, flags, self.serial,
                                self.x, self.y, self.z, self.graphic)
Example #3
0
 def _on_target_request(self, allow_ground, target_id, flags):
     self._client.send(
         p.TargetResponse(0, target_id, flags, self.cloth.serial, 0xffff,
                          0xffff, -1, 0))