aboutsummaryrefslogtreecommitdiff
path: root/behaviors/BehaviorChain.py
diff options
context:
space:
mode:
Diffstat (limited to 'behaviors/BehaviorChain.py')
-rw-r--r--behaviors/BehaviorChain.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/behaviors/BehaviorChain.py b/behaviors/BehaviorChain.py
index 8bf97bb..8b5cb1d 100644
--- a/behaviors/BehaviorChain.py
+++ b/behaviors/BehaviorChain.py
@@ -4,6 +4,9 @@ import pdb
class BehaviorChain(Behavior):
def behaviorInit(self):
self.feedback = {} #dictionary to allow feedback of recursives
+ self.hooks = self['RecursiveHooks']
+ if self.hooks == None:
+ self.hooks = {}
def processResponse(self, sensorInputs, recursiveInputs):
response = sensorInputs
for behaviorId in self['ChainedBehaviors']:
@@ -14,5 +17,11 @@ class BehaviorChain(Behavior):
recurrence = []
(response,recurrence) = behavior.immediateProcessInput(response,\
recurrence)
+
+ if behaviorId in self.hooks: #process recursive hook if there is one
+ hookBehavior = Util.getComponentById(self.hooks[behaviorId])
+ (response, recurrence) = \
+ hookBehavior.immediateProcessInput(response,
+ recurrence)
self.feedback[behaviorId] = recurrence
return response