Python Help Desperately needed

Project:Wrectified - Issue priority 1 - CUBIX+Snap

I have a script

http://www.pasteall.org/41954/python

in the system “re_programmable 3d logic node” http://www.pasteall.org/blend/21138

I need to add in “Parent Ray”(not written), and RBJ Ray http://www.pasteall.org/blend/21138

triggered by the “FaceProperty_” for the corresponding face being changed to “Parent” or “RBJ”

in order to assemble 3d logic systems in game,

RBJ ray = Make a Rigid body joint and save it’s target as a property in a item

Parent ray = Make a parent/child relationship where the object casting the ray is the child

Help?
I am not sure how to move forward, but sure of what I need to achieve,

Right now in pseudo code

If any "faceProperty !=“Empty”
then cast a ray from “faceIndex” to see if another “node” is there to pass the property to,
if there is , then remove the property from “faceProperty” and set the “Target faceProperty” to it’s own.

So
Example

Cube 1 FaceProperty_05 = “Power”
Cube 1’s script Checks FaceIndex_05, it’s Face_10
Cast ray from 10
If “Ray from 10” hits a “Indexed face” (a face with the material "Sensor_ " in the name) then pass property
“Ray from 10” hits CUBE 2’s Face_02

Cube 1’s FaceProperty_05 = “Empty”
Cube 2’s FaceProperty_02 = “Power”

and a “Raynode link?” has passed the data

I need this to work as well

Cube 1 FaceProperty_05 = “Parent”
Cube 1’s script Checks FaceIndex_05, it’s Face_10
Cast ray from 10
If “Ray from 10” hits a “Indexed face” (a face with the material "Sensor_ " in the name) then pass property
“Ray from 10” hits CUBE 2’s Face_02

Cube 1’s FaceProperty_05 = “Empty”
Cube 2’s FaceProperty_02 = “Empty”
Cube1 parents to Cube2

and a “Raynode Parent?” has been established,

I REALLY NEED SOME HELP
I can’t seem to wrap my head around it,