Browse Source

z123 - sat stuff

shuvit 6 years ago
parent
commit
2ef583da8b
3 changed files with 59 additions and 21 deletions
  1. 12
    9
      co_ActionState.py
  2. 24
    9
      controller2.py
  3. 23
    3
      grindV2.py

+ 12
- 9
co_ActionState.py
File diff suppressed because it is too large
View File


+ 24
- 9
controller2.py View File

@@ -3483,12 +3483,12 @@ def invert():
3483 3483
         if own['invert_on'] == 1 and own['last_invert'] == False:
3484 3484
             #killall()
3485 3485
             cont.activate(own.actuators['invertOn_sound'])
3486
-            if STANCE == False:
3486
+            if STANCE == True:
3487 3487
                 own['invert_type'] = "reg_back_invert_in"
3488 3488
             #     skater.playAction("reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1) 
3489 3489
             #     deck.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
3490 3490
             #     trucks.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1) 
3491
-            if STANCE == True:
3491
+            if STANCE == False:
3492 3492
                 own['invert_type'] = "fak_fr_invert"
3493 3493
             #     skater.playAction("fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1) 
3494 3494
             #     deck.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
@@ -3533,6 +3533,9 @@ def invert():
3533 3533
     lif = own['last_invert_frame'] 
3534 3534
     if frame - lif > 3 and invert_on == 0:
3535 3535
         own['invert_type'] = None
3536
+        
3537
+    if grindHit == False:
3538
+        own['invert_on'] = False    
3536 3539
 invert() 
3537 3540
 footplant()
3538 3541
     
@@ -3577,11 +3580,22 @@ def reset_pos():
3577 3580
 
3578 3581
 
3579 3582
    
3580
-#start button    
3583
+#start button
3584
+#print(own['last_stBut'])
3585
+#print(own['pause_on'])    
3581 3586
 if stBut == True:
3582 3587
     own.actuators["sroll"].volume = .0001
3583 3588
     cont.deactivate(own.actuators["sroll"])
3584 3589
     own.actuators["sroll"].stopSound()
3590
+if stBut == False and own['last_stBut'] == True:
3591
+    if own['pause_on'] == True:
3592
+        own['pause_on'] = False
3593
+        own.restoreDynamics()     
3594
+    else:
3595
+        own['pause_on'] = True
3596
+        own.suspendDynamics()            
3597
+    
3598
+own['last_stBut'] = stBut
3585 3599
      
3586 3600
 def ylimit():
3587 3601
     lgf = own['last_grind_frame']
@@ -3905,7 +3919,8 @@ def grind_turn():
3905 3919
     jumping = None
3906 3920
     gotcd = 25
3907 3921
     force = [0,0,0]
3908
-    grindHit = own['grindTouch']      
3922
+    grindHit = own['grindTouch'] 
3923
+    #print("grindHit: ", grindHit)     
3909 3924
     sincegrinding = own['framenum']  - own['grindstartFrame']
3910 3925
     STANCE = own['stance']
3911 3926
     if rUD > turnsens or rLR > turnsens or rUD < -turnsens or rLR < -turnsens:
@@ -3913,7 +3928,7 @@ def grind_turn():
3913 3928
     if grindHit == False:
3914 3929
         cont.deactivate(own.actuators['grindoutRight'])
3915 3930
         cont.deactivate(own.actuators['grindoutLeft'])   
3916
-    if grindHit == True and jumping == None and sincegrinding > 20:
3931
+    if (grindHit == True and jumping == None and sincegrinding > 20)or own['invert_on'] == True:
3917 3932
     #if grindHit == True and jumping == None:
3918 3933
         outloc = 0.022
3919 3934
         bsoutloc = .07
@@ -3971,13 +3986,13 @@ def grind_turn():
3971 3986
             if lq5on == 1:
3972 3987
                 if own['gt_cd2'] == 0:
3973 3988
                     own['gt_cd2'] = 60                 
3974
-                if own['grind_stance'] == True:
3989
+                if STANCE == True:
3975 3990
                     if own['footplant_on'] == True:
3976 3991
                         own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
3977 3992
                         cont.activate(own.actuators["grindoutRight"])                   
3978 3993
                     if own['grind_out_type'] == None:
3979 3994
                          own['grind_out_type'] = 'bs fak back'                     
3980
-                if own['grind_stance'] == False:
3995
+                if STANCE == False:
3981 3996
                     if own['footplant_on'] == True:
3982 3997
                         own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
3983 3998
                         cont.activate(own.actuators["grindoutRight"]) 
@@ -3988,13 +4003,13 @@ def grind_turn():
3988 4003
             if lq1on == 1:
3989 4004
                 if own['gt_cd2'] == 0:
3990 4005
                     own['gt_cd2'] = 60                 
3991
-                if own['grind_stance'] == True:
4006
+                if STANCE == True:
3992 4007
                     if own['footplant_on'] == True:                   
3993 4008
                         own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
3994 4009
                         cont.activate(own.actuators["grindoutRight"])
3995 4010
                     if own['grind_out_type'] == None:
3996 4011
                          own['grind_out_type'] = 'bs fak forward'                                            
3997
-                if own['grind_stance'] == False:
4012
+                if STANCE == False:
3998 4013
                     if own['footplant_on'] == True:                    
3999 4014
                         own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
4000 4015
                         cont.activate(own.actuators["grindoutRight"])

+ 23
- 3
grindV2.py View File

@@ -16,6 +16,7 @@ def main():
16 16
     #grindTouch = cont.sensors['grindCol']
17 17
     invertCol = cont.sensors['invertCol']
18 18
     invertObjs = invertCol.hitObjectList
19
+    invert_on = own['invert_on']
19 20
     detectedObjects = grindDar.hitObjectList
20 21
     lastObject = own['grindTrackObj']
21 22
     nearestObject = None
@@ -217,7 +218,7 @@ def main():
217 218
 
218 219
 
219 220
         if rot >= 45 and rot < 90:  
220
-                             
221
+            #90 degrees CW about z-axis: (x, y, z) -> (y, -x, z)                 
221 222
             player.alignAxisToVect(grinder_vect, 0, align_strength) 
222 223
             grindvect = "pos"
223 224
             player.applyRotation(bsrot, 1)
@@ -507,6 +508,21 @@ def main():
507 508
             
508 509
     #else:
509 510
         #own['grind_rot'] = None 
511
+        
512
+    def invertpos(detectedObjects):
513
+        minDist = None
514
+        nearestObject = None
515
+        for obj in detectedObjects:
516
+            dist = own.getDistanceTo(obj)
517
+            if (minDist is None or dist < minDist):
518
+                nearestObject = obj
519
+                minDist = dist
520
+        if nearestObject != None:        
521
+            vect = nearestObject.getAxisVect( [1.0, 0.0, 0.0])
522
+        #own.alignAxisToVect(vect, 0, 0)
523
+            own.worldPosition = [nearestObject.worldPosition.x, nearestObject.worldPosition.y, nearestObject.worldPosition.z +.1]
524
+            #own.setLinearVelocity([0, 0.0, 0], 1)                    
525
+        
510 526
                
511 527
             
512 528
     
@@ -525,9 +541,13 @@ def main():
525 541
         
526 542
 #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@        
527 543
         #init grind
544
+        
545
+        if invert_on:
546
+            invertpos(detectedObjects)
547
+            print('invertOn')
528 548
 
529 549
         grind_dist = .8#.6
530
-        if dist < grind_dist and grindold == 0 and dropin == 0 and grind_jump == 0 and own["grindoutturn"] == 0 and gt_cd == 0 and manual == 0 and no_grind == 0 and nearestObject != lastObject and own['grindjumpturn'] == 0 and own['gt_cd2'] == 0:
550
+        if dist < grind_dist and grindold == 0 and dropin == 0 and grind_jump == 0 and own["grindoutturn"] == 0 and gt_cd == 0 and manual == 0 and no_grind == 0 and nearestObject != lastObject and own['grindjumpturn'] == 0 and own['gt_cd2'] == 0 and invert_on == False:
531 551
         #if grindold == 0 and dropin == 0 and grind_jump == 0 and manual == 0 and no_grind == 0 and nearestObject != lastObject:    
532 552
             print("new grind trigger")           
533 553
             npos = nearestObject.worldPosition
@@ -545,7 +565,7 @@ def main():
545 565
 
546 566
         #grind
547 567
         #print(dist)
548
-        if dist < grind_dist and dropin == 0 and grind_jump == 0 and manual == 0 and no_grind == 0 and own['airup'] == 0 and own['grindoutturn'] == 0 and own['grindjumpturn'] == 0 and own['manual'] == 0 and own['gt_cd2'] < 50:
568
+        if dist < grind_dist and dropin == 0 and grind_jump == 0 and manual == 0 and no_grind == 0 and own['airup'] == 0 and own['grindoutturn'] == 0 and own['grindjumpturn'] == 0 and own['manual'] == 0 and own['gt_cd2'] < 50 and invert_on == False:
549 569
             #print("grind")    
550 570
             hitObject, hitPoint, hitNormal = own.rayCast(nearestObject.worldPosition, own.worldPosition, .0, 'grind')
551 571
             if grindold == 0:

Loading…
Cancel
Save