Added the return information
This commit is contained in:
@ -137,10 +137,23 @@ class serialShocker(Expansion):
|
||||
a float within the range [0.0, 1.0] that defines the intensity
|
||||
"""
|
||||
vibrateInstead, duration, intensity = action
|
||||
if vibrateInstead:
|
||||
self.shocker.vibrate(duration=duration, intensity=intensity)
|
||||
else:
|
||||
self.shocker.shock(duration=duration, intensity=intensity)
|
||||
callFunc = self.shocker.vibrate if vibrateInstead else self.shocker.shock
|
||||
# Try to execute the step
|
||||
try:
|
||||
callFunc(duration=duration, intensity=intensity)
|
||||
error = None
|
||||
done = True
|
||||
except Exception as e:
|
||||
error = e
|
||||
done = False
|
||||
# Return additionnal info
|
||||
step_info = {
|
||||
"expansionID": self._ID,
|
||||
"showOnScreen": None,
|
||||
"error": error,
|
||||
"done": done
|
||||
}
|
||||
return step_info
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
@ -168,10 +181,24 @@ class simplest(Expansion):
|
||||
"""
|
||||
vibrateInstead, duration, intensity = action
|
||||
values = f"duration={duration}, intensity={intensity}"
|
||||
if vibrateInstead:
|
||||
print(f"Vibrate with {values}")
|
||||
else:
|
||||
print(f"Shock with {values}")
|
||||
interact_type = "Vibrate" if vibrateInstead else "Shock"
|
||||
# Try to execute the step
|
||||
try:
|
||||
message = f"{interact_type} with {values}"
|
||||
error = None
|
||||
done = True
|
||||
except Exception as e:
|
||||
message = None
|
||||
error = e
|
||||
done = False
|
||||
# Return additionnal info
|
||||
step_info = {
|
||||
"expansionID": self._ID,
|
||||
"showOnScreen": message,
|
||||
"error": error,
|
||||
"done": done
|
||||
}
|
||||
return step_info
|
||||
|
||||
def close(self):
|
||||
print("Closing")
|
||||
|
||||
Reference in New Issue
Block a user