Skip to content

Commit

Permalink
send glowtip moves first
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Jun 12, 2024
1 parent 64d4722 commit dff5c72
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/Backend/sensors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,6 @@ abstract class TriggerDefinition extends ChangeNotifier implements Comparable<Tr
BaseAction? baseAction;
List<BaseAction> actionsToRun = [];

// check if non glowy actions are set
if (moveActions.isNotEmpty) {
baseAction = moveActions[_random.nextInt(moveActions.length)];
actionsToRun.add(baseAction);
}
// add a glowtip action if it exists
if (glowActions.isNotEmpty) {
final BaseAction glowAction = glowActions[_random.nextInt(glowActions.length)];
Expand All @@ -231,7 +226,11 @@ abstract class TriggerDefinition extends ChangeNotifier implements Comparable<Tr
}
final Set<DeviceType> flattenedDeviceTypes = deviceTypes.values.flattened.toSet();
final Map<String, BaseStatefulDevice> knownDevices = ref.read(knownDevicesProvider);

// check if non glowy actions are set
if (moveActions.isNotEmpty) {
baseAction = moveActions[_random.nextInt(moveActions.length)];
actionsToRun.add(baseAction);
}
if (baseAction != null && !baseAction.deviceCategory.toSet().containsAll(flattenedDeviceTypes)) {
// find the missing device type
// The goal here is if a user selects multiple moves, send a move to all gear
Expand Down

0 comments on commit dff5c72

Please sign in to comment.