shuvit 6 years ago
parent
commit
eb58766561
2 changed files with 45 additions and 13 deletions
  1. 42
    10
      co_ActionState.py
  2. 3
    3
      controller2.py

+ 42
- 10
co_ActionState.py View File

30
         actionState = own['actionState']
30
         actionState = own['actionState']
31
         l_actionState = own['l_actionState']
31
         l_actionState = own['l_actionState']
32
         requestAction = own['requestAction']
32
         requestAction = own['requestAction']
33
+        og_request = requestAction
33
         l_requestAction = own['l_requestAction']
34
         l_requestAction = own['l_requestAction']
34
         queueAction = own['queueAction']
35
         queueAction = own['queueAction']
35
         actionTimer = own['actionTimer']
36
         actionTimer = own['actionTimer']
36
     except:
37
     except:
37
         own['actionState'] = 'reg_walk'
38
         own['actionState'] = 'reg_walk'
38
-        own['l_actionState'] = 'empty'        
39
+        own['l_actionState'] = 'empty'  
40
+        og_request = 'empty'              
39
         own['requestAction'] = 'reg_walk'    
41
         own['requestAction'] = 'reg_walk'    
40
         own['l_requestAction'] = 'empty'
42
         own['l_requestAction'] = 'empty'
41
         own['queueAction'] = 'empty'
43
         own['queueAction'] = 'empty'
109
             own['l_actionState'] = requestAction
111
             own['l_actionState'] = requestAction
110
             actionState = requestAction
112
             actionState = requestAction
111
             own['actionTimer'] = 0
113
             own['actionTimer'] = 0
112
-            actionTimer = 0            
114
+            actionTimer = 0 
115
+    #print(own['manual_v2_timer'], 'man_timer###@!')                   
113
     if (own['l_requestAction'] == 'reg_air_nose' or own['l_requestAction'] == 'reg_air_tail' or own['l_requestAction'] == 'fak_air_nose' or own['l_requestAction'] == 'fak_air_tail') and (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
116
     if (own['l_requestAction'] == 'reg_air_nose' or own['l_requestAction'] == 'reg_air_tail' or own['l_requestAction'] == 'fak_air_nose' or own['l_requestAction'] == 'fak_air_tail') and (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
114
     #if (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
117
     #if (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
115
         requestAction = own['l_requestAction']
118
         requestAction = own['l_requestAction']
494
         if l_actionState in ('reg_air_tail', 'reg_air_nose') and requestAction in ('fak_opos', 'fak_nopos'):
497
         if l_actionState in ('reg_air_tail', 'reg_air_nose') and requestAction in ('fak_opos', 'fak_nopos'):
495
             requestAction = 'reg_land'
498
             requestAction = 'reg_land'
496
         if l_actionState in ('fak_air_tail', 'fak_air_nose') and requestAction in ('reg_opos', 'reg_nopos'):
499
         if l_actionState in ('fak_air_tail', 'fak_air_nose') and requestAction in ('reg_opos', 'reg_nopos'):
497
-            requestAction = 'fak_land'            
498
-                                                                                                                                                                                        
500
+            requestAction = 'fak_land'    
501
+            
502
+            
503
+        if l_actionState == 'reg_air' and requestAction == 'fak_air':
504
+            requestAction = 'reg_air'
505
+        if l_actionState == 'fak_air' and requestAction == 'reg_air':
506
+            requestAction = 'fak_air'   
507
+        if l_actionState == 'reg_air' and requestAction == 'fak_land':
508
+            requestAction = 'reg_land'
509
+        if l_actionState == 'fak_air' and requestAction == 'reg_land':
510
+            requestAction = 'fak_land'
511
+            
512
+        
513
+        if l_actionState == 'fak_5050-roll' and requestAction == 'reg_land':
514
+            requestAction = 'fak_land'
515
+        if l_actionState == 'reg_5050-roll' and requestAction == 'fak_land':
516
+            requestAction = 'reg_land'            
517
+        
518
+        
519
+        if requestAction in ('reg_pump', 'reg_opos', 'reg_nopos', 'reg_turnL', 'reg_turnR') and l_actionState in ('fak_nmanual_out', 'fak_manual_out'):
520
+            requestAction = 'fak-reg_roll'  
521
+        if requestAction in ('fak_pump', 'fak_opos', 'fak_nopos', 'fak_turnL', 'fak_turnR') and l_actionState in ('fak_nmanual_out', 'fak_manual_out'):
522
+            requestAction = 'reg-fak_roll'             
523
+                                             
524
+                                             
525
+        if l_actionState in ('reg_noseslide_out', 'regtailslide_out') and requestAction == ' fak_roll':
526
+            requestAction = 'reg-fak_roll'
527
+        if l_actionState in ('fak_noseslide_out', 'faktailslide_out') and requestAction == ' reg_roll':
528
+            requestAction = 'fak-reg_roll'            
529
+                                                                                                                                                        
499
     else:
530
     else:
500
         print("action over written")               
531
         print("action over written")               
501
     def updateAction(requestAction, actionState):
532
     def updateAction(requestAction, actionState):
1053
                     skater.playAction("reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1084
                     skater.playAction("reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1054
                     deck.playAction("a_reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1085
                     deck.playAction("a_reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1055
                     trucks.playAction("a_reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1086
                     trucks.playAction("a_reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1056
-                    own['actionTimer'] = cur_frame
1087
+                    #own['actionTimer'] = cur_frame
1057
                 else:                      
1088
                 else:                      
1058
                     skater.playAction("reg_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1089
                     skater.playAction("reg_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1059
                     deck.playAction("a_reg_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1090
                     deck.playAction("a_reg_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1070
                     skater.playAction("fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1101
                     skater.playAction("fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1071
                     deck.playAction("a_fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1102
                     deck.playAction("a_fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1072
                     trucks.playAction("a_fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1103
                     trucks.playAction("a_fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1073
-                    own['actionTimer'] = cur_frame
1104
+                    #own['actionTimer'] = cur_frame
1074
                 else:                      
1105
                 else:                      
1075
                     skater.playAction("fak_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1106
                     skater.playAction("fak_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1076
                     deck.playAction("a_fak_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1107
                     deck.playAction("a_fak_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1086
                     skater.playAction("reg_nmanual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1117
                     skater.playAction("reg_nmanual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1087
                     deck.playAction("a_fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1118
                     deck.playAction("a_fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1088
                     trucks.playAction("a_fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1119
                     trucks.playAction("a_fak_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1089
-                    own['actionTimer'] = cur_frame
1120
+                    #own['actionTimer'] = cur_frame
1090
                 else:                      
1121
                 else:                      
1091
                     skater.playAction("reg_nmanual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1122
                     skater.playAction("reg_nmanual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1092
                     deck.playAction("a_fak_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1123
                     deck.playAction("a_fak_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1103
                     skater.playAction("fak_nmanual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1134
                     skater.playAction("fak_nmanual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1104
                     deck.playAction("a_reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1135
                     deck.playAction("a_reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1105
                     trucks.playAction("a_reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1136
                     trucks.playAction("a_reg_manual", cur_frame,1, layer=trans_layer, play_mode=0, speed=1)
1106
-                    own['actionTimer'] = cur_frame
1137
+                    #own['actionTimer'] = cur_frame
1107
                 else:                      
1138
                 else:                      
1108
                     skater.playAction("fak_nmanual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1139
                     skater.playAction("fak_nmanual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1109
                     deck.playAction("a_reg_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
1140
                     deck.playAction("a_reg_manual", 10,1, layer=trans_layer, play_mode=0, speed=1)
3672
     cur_frame = -1
3703
     cur_frame = -1
3673
     trans_playing = skater.isPlayingAction(trans_layer)
3704
     trans_playing = skater.isPlayingAction(trans_layer)
3674
     if trans_playing:
3705
     if trans_playing:
3675
-        cur_frame = skater.getActionFrame(trans_layer)       
3676
-    #print("rA:", requestAction, "|aS:", own['actionState'], "q", queueAction, own['actionTimer'], 'cf', cur_frame)
3706
+        cur_frame = skater.getActionFrame(trans_layer)  
3707
+        cur_frame = round(cur_frame, 2)     
3708
+    print("oG: ", og_request, "rA:", requestAction, "|aS:", own['actionState'], "q", queueAction, own['actionTimer'], 'cf', cur_frame)
3677
     cur_frame = skater.getActionFrame(trans_layer)
3709
     cur_frame = skater.getActionFrame(trans_layer)
3678
     #print(cur_frame)
3710
     #print(cur_frame)
3679
     def printplaying():
3711
     def printplaying():

+ 3
- 3
controller2.py View File

947
         lF_air_frame = own['lF_air_frame']
947
         lF_air_frame = own['lF_air_frame']
948
         frames_since_ground = own['framenum'] - own['lF_air_frame']     
948
         frames_since_ground = own['framenum'] - own['lF_air_frame']     
949
 
949
 
950
-        if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False and frames_since_ground > 30:            
950
+        if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:            
951
             countdown = COUNTDOWN
951
             countdown = COUNTDOWN
952
             yvel = linVelocity.x + SPEEDPUMP
952
             yvel = linVelocity.x + SPEEDPUMP
953
             yvel2 = linVelocity.x + SPEEDPUMPFAST
953
             yvel2 = linVelocity.x + SPEEDPUMPFAST
960
                 own.setLinearVelocity(force2, local)
960
                 own.setLinearVelocity(force2, local)
961
             own['requestAction'] = 'fak_pump'
961
             own['requestAction'] = 'fak_pump'
962
         #switch
962
         #switch
963
-        if linVelocity.x > -MAX_VEL and linVelocity.x <= 0 and STANCE == 0 and grindHit == False and frames_since_ground > 30:
963
+        if linVelocity.x > -MAX_VEL and linVelocity.x <= 0 and STANCE == 0 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:
964
             countdown = COUNTDOWN
964
             countdown = COUNTDOWN
965
             yvel = linVelocity.x - SPEEDPUMP
965
             yvel = linVelocity.x - SPEEDPUMP
966
             yvel2 = linVelocity.x - SPEEDPUMPFAST
966
             yvel2 = linVelocity.x - SPEEDPUMPFAST
2739
     #34567
2739
     #34567
2740
     own['set_revert_timer'] = 0
2740
     own['set_revert_timer'] = 0
2741
     ground_since = own["framenum"] - own['lF_air_frame']
2741
     ground_since = own["framenum"] - own['lF_air_frame']
2742
-    if ground_since > 40 and frames_since_grinding > 40:
2742
+    if ground_since > 80 and frames_since_grinding > 40:
2743
 
2743
 
2744
         if q3oncdl < q4oncdl < q5oncdl < q6oncdl < q7oncdl:
2744
         if q3oncdl < q4oncdl < q5oncdl < q6oncdl < q7oncdl:
2745
             if r_ground.triggered == True:
2745
             if r_ground.triggered == True:

Loading…
Cancel
Save