Action.step: Construct Actions using Child.
[python-bulletml.git] / bulletml / impl.py
index f0e8964..ea4893f 100644 (file)
@@ -48,7 +48,8 @@ class Action(object):
         return "%s(pc=%r, actions=%r)" % (
             type(self).__name__, self.pc, self.actions)
 
-    def Child(self, actions, params, rank, repeat=1):
+    def Child(self, action, params, rank, repeat=1):
+        actions, params = action(params, rank)
         return type(self)(self, actions, params, rank, repeat)
 
     def vanish(self):
@@ -119,8 +120,7 @@ class Action(object):
                     action = self.actions[self.pc]
 
             if isinstance(action, (parser.ActionDef, parser.ActionRef)):
-                actions, params = action(s_params, rank)
-                child = self.__class__(self, actions, params, rank)
+                child = self.Child(action, s_params, rank)
                 owner.replace(self, child)
                 child.step(owner, created)
                 break