예제 #1
0
 def exec(self, system):
     super().exec(system)
     trgt = system.get_object_by_id(self.target_id)
     if trgt is None:
         raise InputValidationError("Target doesn't exist")
     if get_distance(trgt.position, self.object.position):
         raise InputValidationError("Target out of range")
     self.object.set_target()
     return Response(self, self.object.status_report)
예제 #2
0
 def _parse_args(self):
     try:
         self.pitch, self.yaw = [
             float(x) for x in self._raw_args.split(',')
         ]
     except ValueError:
         raise InputValidationError("Bad values given for pitch or yaw")
예제 #3
0
 def _validate(self):
     super()._validate()
     if self.throttle < 0 or self.throttle > 1.2:
         raise InputValidationError("Bad Range")
예제 #4
0
 def _parse_args(self):
     try:
         self.throttle = float(self._raw_args)
     except ValueError:
         raise InputValidationError("Bad value for throttle")
예제 #5
0
 def _validate(self):
     super()._validate()
     if self.focus <= 0 or self.focus >= 90:
         raise InputValidationError("Bad Range for Focus")
예제 #6
0
 def _parse_args(self):
     try:
         self.focus = float(self._raw_args)
     except ValueError:
         raise InputValidationError("Bad value for focus")
예제 #7
0
 def _validate(self):
     super()._validate()
     if self.pitch < -90 or self.pitch > 90:
         raise InputValidationError("Bad Range for Pitch")
     if self.yaw < -90 or self.yaw > 90:
         raise InputValidationError("Bad Range for Yaw")
예제 #8
0
 def _parse_args(self):
     try:
         self.toggle = bool(int(self._raw_args))
     except ValueError:
         raise InputValidationError("Bad value for power toggle")