Skip to content

Commit

Permalink
Fix activation_condition logic
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardwbarber committed Jul 12, 2022
1 parent 643814e commit ba96c09
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions gremlin/ui/activation_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,12 +624,38 @@ def _modify_vjoy(self, data):
self.condition_data.vjoy_id = data["device_id"]
self.condition_data.input_type = data["input_type"]
self.condition_data.input_id = data["input_id"]

valid_axis_condition = [
"inside",
"outside"
]
valid_button_condition = [
"pressed",
"released"
]
valid_hat_condition = [
"center",
"north",
"north-east",
"east",
"south-east",
"south",
"south-west",
"west",
"north-west"
]

if data["input_type"] == InputType.JoystickAxis:
if (data["input_type"] == InputType.JoystickAxis and
self.condition_data.comparison not in valid_axis_condition
):
self.condition_data.comparison = "inside"
elif data["input_type"] == InputType.JoystickButton:
elif (data["input_type"] == InputType.JoystickButton and
self.condition_data.comparison not in valid_button_condition
):
self.condition_data.comparison = "pressed"
elif data["input_type"] == InputType.JoystickHat:
elif (data["input_type"] == InputType.JoystickHat and
self.condition_data.comparison not in valid_hat_condition
):
self.condition_data.comparison = \
util.hat_tuple_to_direction((0, 0))
self._create_ui()
Expand Down

0 comments on commit ba96c09

Please sign in to comment.