Browse Source

sit and dropin sensors fix

shuvit 5 years ago
parent
commit
3cc89e4d5f
1 changed files with 43 additions and 40 deletions
  1. 43
    40
      scripts/walk.py

+ 43
- 40
scripts/walk.py View File

@@ -426,18 +426,21 @@ def main(cont):
426 426
                     own['walk_jump_timer'] = 20
427 427
             own['lastx'] = 1
428 428
         else:
429
-            own['lastx'] = 0
430
-    def dropin():
431
-        if dropinCol.positive == True:
432
-            pass       
429
+            own['lastx'] = 0  
433 430
             
434
-    def getonboard(dict):
435
-        #print(dict['kb_q'])
431
+    def getonboard(dict, cont):
432
+        grindDar = cont.sensors['grindDar2']
436 433
         getonboard = own['getonboard']
437 434
         fliplay2 = 50#8560
438 435
         if ((yBut == True and dict['last_yBut'] == False) or dict['kb_q'] == 2):# and (cont.sensors["vehicleNear"].positive == False and own['throw_deck'] == False):
439
-            fliplay3 = fliplay2 + 1 
440
-            if dropinCol.positive == True: 
436
+            fliplay3 = fliplay2 + 1
437
+            dar = 0 
438
+            if grindDar.hitObjectList != None:
439
+                for x in grindDar.hitObjectList:
440
+                    to_grinder = (x.worldPosition - own.worldPosition).length
441
+                    if 'coping' in x and to_grinder < .36:
442
+                        dar = 1
443
+            if dropinCol.positive == True or dar == 1: 
441 444
                 nearestObject = None
442 445
                 grindEmpty = scene.objects['grindEmpty']
443 446
                 grindDar = grindEmpty.sensors['grindDar2']
@@ -450,36 +453,36 @@ def main(cont):
450 453
                         if (minDist is None or dist < minDist):
451 454
                             nearestObject = obj
452 455
                             minDist = dist
453
-                if nearestObject != None:
454
-                    #print(nearestObject)
455
-                    obj = nearestObject
456
-                    player_e = own.worldOrientation.to_euler()
457
-                    player_pos = own.worldPosition
458
-                    player_rotz = math.degrees(player_e[2])                
459
-                    grinder_e = obj.worldOrientation.to_euler()
460
-                    grinder_rotz = math.degrees(grinder_e[2])            
461
-                    rot = player_rotz - grinder_rotz  
462
-                    grinder_pos = obj.worldPosition 
463
-                    worldVect = [1, 0, 0]
464
-                    vect = obj.getAxisVect(worldVect)      
465
-                    go = obj.worldOrientation
466
-                    grinder_axis = [1,0,0] 
467
-                    try: 
468
-                        delta = player_pos - grinder_pos
456
+                # if nearestObject != None:
457
+                #     #print(nearestObject)
458
+                #     obj = nearestObject
459
+                #     player_e = own.worldOrientation.to_euler()
460
+                #     player_pos = own.worldPosition
461
+                #     player_rotz = math.degrees(player_e[2])                
462
+                #     grinder_e = obj.worldOrientation.to_euler()
463
+                #     grinder_rotz = math.degrees(grinder_e[2])            
464
+                #     rot = player_rotz - grinder_rotz  
465
+                #     grinder_pos = obj.worldPosition 
466
+                #     worldVect = [1, 0, 0]
467
+                #     vect = obj.getAxisVect(worldVect)      
468
+                #     go = obj.worldOrientation
469
+                #     grinder_axis = [1,0,0] 
470
+                #     try: 
471
+                #         delta = player_pos - grinder_pos
469 472
                         
470
-                        delta = delta.cross(vect)
471
-                        if delta[2] >= 0:
472
-                            grindside = "right"
473
-                        else:
474
-                            grindside = "left"                    
475
-                        deltamove = delta[2] * .1#.25
476
-                        if STANCE == 0:
477
-                            move = [-deltamove, 0, 0]
478
-                        else:
479
-                            move = [deltamove, 0, 0]                            
480
-                        own.applyMovement(move, True)                    
481
-                    except:
482
-                        pass 
473
+                #         delta = delta.cross(vect)
474
+                #         if delta[2] >= 0:
475
+                #             grindside = "right"
476
+                #         else:
477
+                #             grindside = "left"                    
478
+                #         deltamove = delta[2] * .1#.25
479
+                #         if STANCE == 0:
480
+                #             move = [-deltamove, 0, 0]
481
+                #         else:
482
+                #             move = [deltamove, 0, 0]                            
483
+                #         own.applyMovement(move, True)                    
484
+                #     except:
485
+                #         pass 
483 486
 
484 487
                 if STANCE == 0: 
485 488
                     own['requestAction'] ='reg_dropin_pos' 
@@ -804,7 +807,7 @@ def main(cont):
804 807
                 killact(299)
805 808
             own['sit'] = 0
806 809
 
807
-        if aBut == False and lasta == True:
810
+        if aBut == True and lasta == False:
808 811
             try:
809 812
                 if 'sit' in r_ground.hitObject:
810 813
                     #print("sit")
@@ -1240,12 +1243,12 @@ def main(cont):
1240 1243
 
1241 1244
     onboard() 
1242 1245
     jump()
1243
-    dropin()
1246
+    #dropin()
1244 1247
     throwdeck_trigger()
1245 1248
 
1246 1249
     nextframe()
1247 1250
     checkidle()
1248
-    getonboard(dict)
1251
+    getonboard(dict, cont)
1249 1252
     reset_pos()
1250 1253
     switchcam()
1251 1254
     move_flycam()

Loading…
Cancel
Save