Example #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)
Example #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")
Example #3
0
 def _validate(self):
     super()._validate()
     if self.throttle < 0 or self.throttle > 1.2:
         raise InputValidationError("Bad Range")
Example #4
0
 def _parse_args(self):
     try:
         self.throttle = float(self._raw_args)
     except ValueError:
         raise InputValidationError("Bad value for throttle")
Example #5
0
 def _validate(self):
     super()._validate()
     if self.focus <= 0 or self.focus >= 90:
         raise InputValidationError("Bad Range for Focus")
Example #6
0
 def _parse_args(self):
     try:
         self.focus = float(self._raw_args)
     except ValueError:
         raise InputValidationError("Bad value for focus")
Example #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")
Example #8
0
 def _parse_args(self):
     try:
         self.toggle = bool(int(self._raw_args))
     except ValueError:
         raise InputValidationError("Bad value for power toggle")