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
|
a float within the range [0.0, 1.0] that defines the intensity
|
||||||
"""
|
"""
|
||||||
vibrateInstead, duration, intensity = action
|
vibrateInstead, duration, intensity = action
|
||||||
if vibrateInstead:
|
callFunc = self.shocker.vibrate if vibrateInstead else self.shocker.shock
|
||||||
self.shocker.vibrate(duration=duration, intensity=intensity)
|
# Try to execute the step
|
||||||
else:
|
try:
|
||||||
self.shocker.shock(duration=duration, intensity=intensity)
|
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):
|
def close(self):
|
||||||
pass
|
pass
|
||||||
@ -168,10 +181,24 @@ class simplest(Expansion):
|
|||||||
"""
|
"""
|
||||||
vibrateInstead, duration, intensity = action
|
vibrateInstead, duration, intensity = action
|
||||||
values = f"duration={duration}, intensity={intensity}"
|
values = f"duration={duration}, intensity={intensity}"
|
||||||
if vibrateInstead:
|
interact_type = "Vibrate" if vibrateInstead else "Shock"
|
||||||
print(f"Vibrate with {values}")
|
# Try to execute the step
|
||||||
else:
|
try:
|
||||||
print(f"Shock with {values}")
|
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):
|
def close(self):
|
||||||
print("Closing")
|
print("Closing")
|
||||||
|
|||||||
Reference in New Issue
Block a user