use of me.retrodaredevil.action.SimpleAction in project solarthing by wildmountainfarms.
the class RequireFullOutputActionNode method createAction.
@Override
public Action createAction(ActionEnvironment actionEnvironment) {
LatestFragmentedPacketGroupEnvironment latestPacketGroupEnvironment = actionEnvironment.getInjectEnvironment().get(LatestFragmentedPacketGroupEnvironment.class);
return new SimpleAction(false) {
@Override
protected void onUpdate() {
super.onUpdate();
FragmentedPacketGroup latestPacketGroup = latestPacketGroupEnvironment.getFragmentedPacketGroupProvider().getPacketGroup();
if (latestPacketGroup != null) {
setDone(isFullOutput(latestPacketGroup));
}
}
};
}
use of me.retrodaredevil.action.SimpleAction in project solarthing by wildmountainfarms.
the class FlagActionNode method createAction.
@Override
public Action createAction(ActionEnvironment actionEnvironment) {
AlterPacketsEnvironment alterPacketsEnvironment = actionEnvironment.getInjectEnvironment().get(AlterPacketsEnvironment.class);
AlterPacketsProvider provider = alterPacketsEnvironment.getAlterPacketsProvider();
return new SimpleAction(false) {
@Override
protected void onUpdate() {
super.onUpdate();
List<VersionedPacket<StoredAlterPacket>> packets = provider.getPackets();
if (packets != null) {
Instant now = Instant.now();
if (FlagUtil.isFlagActive(now, flagName, packets.stream().map(VersionedPacket::getPacket)) != not) {
setDone(true);
}
}
}
};
}
use of me.retrodaredevil.action.SimpleAction in project solarthing by wildmountainfarms.
the class ACModeActionNode method createAction.
@Override
public Action createAction(ActionEnvironment actionEnvironment) {
LatestPacketGroupEnvironment latestPacketGroupEnvironment = actionEnvironment.getInjectEnvironment().get(LatestPacketGroupEnvironment.class);
PacketGroupProvider packetGroupProvider = latestPacketGroupEnvironment.getPacketGroupProvider();
return new SimpleAction(false) {
@Override
protected void onUpdate() {
super.onUpdate();
PacketGroup packetGroup = packetGroupProvider.getPacketGroup();
if (packetGroup == null) {
LOGGER.warn("packetGroup is null!");
return;
}
FXStatusPacket fxStatusPacket = OutbackUtil.getMasterFX(packetGroup);
if (fxStatusPacket == null) {
LOGGER.warn("No master FX Status Packet!");
} else {
setDone((fxStatusPacket.getACMode() == acMode) == !not);
}
}
};
}
use of me.retrodaredevil.action.SimpleAction in project solarthing by wildmountainfarms.
the class RequiredIdentifierActionNode method createAction.
@Override
public Action createAction(ActionEnvironment actionEnvironment) {
LatestFragmentedPacketGroupEnvironment latestPacketGroupEnvironment = actionEnvironment.getInjectEnvironment().get(LatestFragmentedPacketGroupEnvironment.class);
return new SimpleAction(false) {
@Override
protected void onUpdate() {
super.onUpdate();
FragmentedPacketGroup packetGroup = latestPacketGroupEnvironment.getFragmentedPacketGroupProvider().getPacketGroup();
if (packetGroup == null) {
return;
}
String reason = IdentifierUtil.getRequirementNotMetReason(requiredIdentifierMap, packetGroup);
if (reason != null) {
if (log) {
LOGGER.info("Requirement not met: " + reason);
}
} else {
setDone(true);
}
}
};
}
use of me.retrodaredevil.action.SimpleAction in project solarthing by wildmountainfarms.
the class MateCommandWaitActionNode method createAction.
@Override
public Action createAction(ActionEnvironment actionEnvironment) {
MateCommandEnvironment mateCommandEnvironment = actionEnvironment.getInjectEnvironment().get(MateCommandEnvironment.class);
Queue<?> queue = mateCommandEnvironment.getQueue();
return new SimpleAction(false) {
@Override
protected void onUpdate() {
super.onUpdate();
setDone(queue.isEmpty());
}
};
}
Aggregations