Advertisement
Guest User

actor_main()

a guest
Oct 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.17 KB | None | 0 0
  1. def main():
  2.     #debug readout
  3.     own.parent['ReadA']= str(own.parent['Act'])  
  4.     if 'init' not in own:
  5.         init()
  6.    
  7.     #update aiming rig  
  8.     arm = bpy.data.objects[cont.owner.name]
  9.     pose = arm.pose        
  10.     matrix = pose.bones['Spine1'].matrix    
  11.     posAR = own.parent.worldTransform  @ matrix @ Vector([0,.25,-.5])
  12.     own['AR'].worldPosition = posAR
  13.     if own.parent['Cam']==True:
  14.         own.scene.active_camera.worldPosition = own.worldTransform @ own['CR']['orig']
  15.         own.scene.active_camera.worldPosition =own.scene.active_camera.worldPosition.lerp(own['CR'].worldPosition,.25)
  16.         own.scene.active_camera.worldOrientation = own.parent.worldOrientation @ own['CR']['oRot']
  17.        
  18.         own.scene.active_camera.worldOrientation = own.scene.active_camera.worldOrientation.lerp(own['CR'].worldOrientation,.5)
  19.        
  20.    
  21.    
  22.     #proccess states if you have them do basic movement if you dont'
  23.     if 'actStrip' not in own:
  24.         if str(own.parent['Act']) not in actions:
  25.             own['d'] = "normal"
  26.             own.parent.alignAxisToVect([0,0,1],2,.15)
  27.             fall = fallCheck()
  28.             if fall==None:
  29.                 proccessAim(arm)
  30.                 proccessMovementForces()
  31.                 proccessIdle()
  32.                 restTimer()
  33.             if 'Weapon' in own:
  34.                 proccessEquipment()
  35.                 if 'Aimer' in own['Weapon'] and 'AimL' in own.parent['Act']:
  36.                    
  37.                     laserAim()
  38.                 elif 'Line1' in own and 'AimL' not in own.parent['Act']:
  39.                     own['Line1'].endObject()
  40.                     del own['Line1']
  41.                    
  42.             elif 'Line1' in own:
  43.                 own['Line1'].endObject()
  44.                 del own['Line1']        
  45.         else:
  46.             #call states using input
  47.             own['actStrip'] = [ actions[str(own.parent['Act'])]    ]
  48.        
  49.     #proccess states in actstrip
  50.     else:
  51.         if len(own['actStrip'])>0:
  52.             own['d'] = str(own['actStrip'])
  53.             #do 1 single thing and move on when it's done
  54.             if type(own['actStrip'][0]) is tuple:
  55.                 function =  StateDict[own['actStrip'][0][0]]
  56.                 function(own['actStrip'][0][1], -1)
  57.                 #print('called')
  58.             #do multiple things and move on when all done
  59.             elif type(own['actStrip'][0]) is list:
  60.                 popList = []
  61.                 index =0
  62.                 if len(own['actStrip'][0])>0:
  63.                     for entry in own['actStrip'][0]:
  64.                        function =  StateDict[entry[0][0]]
  65.                        a = function(entry[0][1],index )
  66.                        if a!=None:
  67.                             #if there is return it's a index to pop
  68.                             popList.append(a)
  69.                        index+=1
  70.                 else:
  71.                     own['ActStrip'].pop(0)
  72.                 if len(popList)>0:
  73.                     ret = multi_delete(own['ActStrip'][0], popList)
  74.                     own['ActStrip'][0] = ret
  75.         else:
  76.             del own['actStrip']
  77.     own.parent['Move']=[]
  78.     own.parent['Act']=[]
  79. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement