shuvit il y a 5 ans
Parent
révision
22db4e07a9
1 fichiers modifiés avec 246 ajouts et 235 suppressions
  1. 246
    235
      scripts/grindV2.py

+ 246
- 235
scripts/grindV2.py Voir le fichier

1
+"""controls grind physics and sends results to controller2.py for setting the grind animations."""
2
+
1
 import bge
3
 import bge
2
 import math
4
 import math
3
 
5
 
4
 def main():
6
 def main():
7
+
8
+
5
     cont = bge.logic.getCurrentController()
9
     cont = bge.logic.getCurrentController()
6
     own = cont.owner
10
     own = cont.owner
7
     player = cont.owner
11
     player = cont.owner
8
     scene = bge.logic.getCurrentScene()
12
     scene = bge.logic.getCurrentScene()
13
+    dict = bge.logic.globalDict
9
     #grindDar = cont.sensors['grindDar']
14
     #grindDar = cont.sensors['grindDar']
10
     grindEmpty = scene.objects['grindEmpty']
15
     grindEmpty = scene.objects['grindEmpty']
11
-    grindDar = grindEmpty.sensors['grindDar2']    
16
+    grindDar = grindEmpty.sensors['grindDar2']
12
     rGround = cont.sensors['r_Ground']
17
     rGround = cont.sensors['r_Ground']
13
     control_bottom = scene.objects['control_bottom']
18
     control_bottom = scene.objects['control_bottom']
14
-    #grindCol_bottom 
19
+    #grindCol_bottom
15
     grindTouch = control_bottom.sensors['grindCol_bottom']
20
     grindTouch = control_bottom.sensors['grindCol_bottom']
16
     #grindTouch = cont.sensors['grindCol']
21
     #grindTouch = cont.sensors['grindCol']
17
     invertCol = cont.sensors['invertCol']
22
     invertCol = cont.sensors['invertCol']
25
     test = own["test"]
30
     test = own["test"]
26
     grindold = own["grindOld"]
31
     grindold = own["grindOld"]
27
     lgobj = own["lGobj"]
32
     lgobj = own["lGobj"]
28
-    countdown = own['grindCountdown'] 
33
+    countdown = own['grindCountdown']
29
     #print(lgobj)
34
     #print(lgobj)
30
     ray = cont.sensors["GuardDuty"] # get the ray sensor attached to the controller named GuardDuty
35
     ray = cont.sensors["GuardDuty"] # get the ray sensor attached to the controller named GuardDuty
31
     gt_cd = own["gt_cd"]
36
     gt_cd = own["gt_cd"]
32
     pos = ray.hitPosition # get position where the game object hit by ray
37
     pos = ray.hitPosition # get position where the game object hit by ray
33
     linVelocity = own.getLinearVelocity(False)
38
     linVelocity = own.getLinearVelocity(False)
34
     linVelocity2 = own.getLinearVelocity(True)
39
     linVelocity2 = own.getLinearVelocity(True)
35
-    pos[2] = pos[2] + 1 
40
+    pos[2] = pos[2] + 1
36
     norm = ray.hitNormal
41
     norm = ray.hitNormal
37
     STANCE = own["stance"]
42
     STANCE = own["stance"]
38
     orientation = own.worldOrientation
43
     orientation = own.worldOrientation
39
     test = ray.hitObject
44
     test = ray.hitObject
40
     xyz = own.worldOrientation.to_euler()
45
     xyz = own.worldOrientation.to_euler()
41
     rotz = math.degrees(xyz[2])
46
     rotz = math.degrees(xyz[2])
42
-    roty = math.degrees(xyz[1]) 
47
+    roty = math.degrees(xyz[1])
43
     #print(roty)
48
     #print(roty)
44
-    roty = abs(roty) 
49
+    roty = abs(roty)
45
     sub = 0
50
     sub = 0
46
     align_strength = .1#.3
51
     align_strength = .1#.3
47
     align_strength2 = .2
52
     align_strength2 = .2
61
     last_grindDar = 0
66
     last_grindDar = 0
62
     last_manual = own["manual"]
67
     last_manual = own["manual"]
63
     joinit = 0
68
     joinit = 0
64
-    rot = own.getAxisVect( [0.0, 0.0, 1.0])
69
+    rot = own.getAxisVect([0.0, 0.0, 1.0])
65
     dropin = own['dropinTimer']
70
     dropin = own['dropinTimer']
66
     nearestObject = None
71
     nearestObject = None
67
     last_hit = own['grindDar_hit']
72
     last_hit = own['grindDar_hit']
72
     grindvect = None
77
     grindvect = None
73
     grindyvect = None
78
     grindyvect = None
74
     skipcol = 0
79
     skipcol = 0
75
-    skipconst = 0
76
     try:
80
     try:
77
         no_grind_pull = own['no_grind_pull']
81
         no_grind_pull = own['no_grind_pull']
78
-    except:    
82
+    except:
79
         own['no_grind_pull'] = 0
83
         own['no_grind_pull'] = 0
80
         no_grind_pull = 0
84
         no_grind_pull = 0
81
-        
82
-    since_jumped = framenum - own['last_jump_frame']    
85
+
86
+    since_jumped = framenum - own['last_jump_frame']
83
     #no grind
87
     #no grind
84
     no_grind = 1
88
     no_grind = 1
85
     if jump_timer > 50:
89
     if jump_timer > 50:
87
     if own['no_grind_timer'] > 0:
91
     if own['no_grind_timer'] > 0:
88
         no_grind = 0
92
         no_grind = 0
89
         own['no_grind_timer'] -= 1
93
         own['no_grind_timer'] -= 1
90
-        
94
+
91
     if grindold == 1:
95
     if grindold == 1:
92
-        no_grind = 0    
96
+        no_grind = 0
93
     #don't grind unless you were in the air recently or were on a ramp recently or were grinding.
97
     #don't grind unless you were in the air recently or were on a ramp recently or were grinding.
94
-    
98
+
95
     #if (own['onramp'] == 0 and frames_since_grind > 30):
99
     #if (own['onramp'] == 0 and frames_since_grind > 30):
96
         #no_grind = 1
100
         #no_grind = 1
97
-        
101
+
98
     #if frames_since_grind > 30:
102
     #if frames_since_grind > 30:
99
         #no_grind = 0
103
         #no_grind = 0
100
-        
104
+
101
     if frames_since_ground > 30 or since_jumped < 120:
105
     if frames_since_ground > 30 or since_jumped < 120:
102
-        no_grind = 0         
106
+        no_grind = 0
103
     if jump_timer > 50:
107
     if jump_timer > 50:
104
         no_grind = 1
108
         no_grind = 1
105
-        
106
-   
109
+    if grindold == 0 and  (dict['lUD'] < -.04 or dict['lUD'] > .04):
110
+        no_grind = 1
111
+
107
     #print('no grind timer', no_grind, own['no_grind_timer'])
112
     #print('no grind timer', no_grind, own['no_grind_timer'])
108
-    
109
-    
113
+
114
+
110
     if (own['fak_nmanual'] == 1 or own['reg_nmanual'] == 1 or own['fak_manual'] == 1 or own['reg_manual'] == 1):
115
     if (own['fak_nmanual'] == 1 or own['reg_nmanual'] == 1 or own['fak_manual'] == 1 or own['reg_manual'] == 1):
111
-        manual = 1    
116
+        manual = 1
112
     else:
117
     else:
113
         manual = 0
118
         manual = 0
114
     #manual = own['manual']
119
     #manual = own['manual']
115
     own["nogrindsound"] = 0
120
     own["nogrindsound"] = 0
116
-    
117
-#---------###########___###########-----------    
118
-#start new                     #######     
121
+    no_grind = 1
122
+    if (dict['rBump'] == 1 or own['vert'] == 0):
123
+    #print(own['last_vert_frame'])
124
+    #if (dict['rBump'] == 1 or (framenum - own['last_vert_frame'] < 10) and own['vert'] == 0):
125
+        no_grind = 0
126
+        #print('no_grind = 0')
127
+    if own['LAST_GRIND']:
128
+        no_grind = 0
129
+    # if (dict['lUD'] < -.04 or dict['lUD'] > .04):
130
+    #     no_grind = 0
131
+#---------###########___###########-----------
132
+#start new                     #######
119
 ##----------##############----------############
133
 ##----------##############----------############
120
 
134
 
121
 #grindvect func
135
 #grindvect func
124
     lastobj = own["grindTouchobj"]
138
     lastobj = own["grindTouchobj"]
125
     grindpos = own["grindpos"]
139
     grindpos = own["grindpos"]
126
     player_e = own.worldOrientation.to_euler()
140
     player_e = own.worldOrientation.to_euler()
127
-    player_rotz = math.degrees(player_e[2]) 
141
+    player_rotz = math.degrees(player_e[2])
128
     velxb = linVelocity2.x
142
     velxb = linVelocity2.x
129
     player_e = own.worldOrientation.to_euler()
143
     player_e = own.worldOrientation.to_euler()
130
-    
144
+
131
     ogrot = own.orientation
145
     ogrot = own.orientation
132
     ogrot = player_e
146
     ogrot = player_e
133
-    
147
+
148
+
149
+    #print(touched, 'touched')
150
+
134
     if (framenum - gsf) > 15:
151
     if (framenum - gsf) > 15:
135
         velx = linVelocity2.x
152
         velx = linVelocity2.x
136
         vely = linVelocity2.y
153
         vely = linVelocity2.y
137
         #print("limit speed")
154
         #print("limit speed")
138
-    else:    
139
-         velx = linVelocity2.x
140
-         vely = linVelocity2.y     
155
+    else:
156
+        velx = linVelocity2.x
157
+        vely = linVelocity2.y
141
     if abs(own['pregrind_vely']) > abs(vely) and own['LAST_GRIND'] == 0:
158
     if abs(own['pregrind_vely']) > abs(vely) and own['LAST_GRIND'] == 0:
142
         #convely = own['pregrind_vely']
159
         #convely = own['pregrind_vely']
143
         #print('changing convely')
160
         #print('changing convely')
144
         convely = vely
161
         convely = vely
145
     else:
162
     else:
146
-        convely = vely  
163
+        convely = vely
147
     def grindvect(obj):
164
     def grindvect(obj):
148
         STANCE = own['stance']
165
         STANCE = own['stance']
149
         if obj != None:
166
         if obj != None:
150
             grinder_e = obj.worldOrientation.to_euler()
167
             grinder_e = obj.worldOrientation.to_euler()
151
-            grinder_rotz = math.degrees(grinder_e[2])            
168
+            grinder_rotz = math.degrees(grinder_e[2])
152
             rot = player_rotz - grinder_rotz
169
             rot = player_rotz - grinder_rotz
153
-        if rot >= 0 and rot < 45: 
170
+        if rot >= 0 and rot < 45:
171
+            grindvect = "pos"
172
+        if rot >= 45 and rot < 90:
154
             grindvect = "pos"
173
             grindvect = "pos"
155
-        if rot >= 45 and rot < 90: 
156
-            grindvect = "pos" 
157
             grindyvect = "pos"
174
             grindyvect = "pos"
158
-        if rot >= 90 and rot < 135: 
175
+        if rot >= 90 and rot < 135:
159
             grindvect = "neg"
176
             grindvect = "neg"
160
             grindyvect = "neg"
177
             grindyvect = "neg"
161
-        if rot >= 135 and rot < 180: 
178
+        if rot >= 135 and rot < 180:
162
             grindvect = "neg"
179
             grindvect = "neg"
163
-        if rot >= 180 and rot < 225: 
180
+        if rot >= 180 and rot < 225:
164
             grindvect = "neg"
181
             grindvect = "neg"
165
-        if rot >= 225 and rot < 270: 
182
+        if rot >= 225 and rot < 270:
166
             grindvect = "neg"
183
             grindvect = "neg"
167
             grindyvect = "pos"
184
             grindyvect = "pos"
168
-        if rot >= 270 and rot < 315: 
169
-            grindvect = "pos" 
185
+        if rot >= 270 and rot < 315:
186
+            grindvect = "pos"
170
             grindyvect = "neg"
187
             grindyvect = "neg"
171
-        if rot >= 315: 
188
+        if rot >= 315:
172
             grindvect = "pos"
189
             grindvect = "pos"
173
-        if rot < 0 and rot >= -45: 
190
+        if rot < 0 and rot >= -45:
174
             grindvect = "pos"
191
             grindvect = "pos"
175
-        if rot < -45 and rot >= -90: 
192
+        if rot < -45 and rot >= -90:
176
             grindvect = "pos"
193
             grindvect = "pos"
177
             grindyvect = "neg"
194
             grindyvect = "neg"
178
-        if rot < -90 and rot >= -135: 
195
+        if rot < -90 and rot >= -135:
179
             grindvect = "neg"
196
             grindvect = "neg"
180
             grindyvect = "pos"
197
             grindyvect = "pos"
181
-        if rot < -135 and rot >= -180: 
182
-            grindvect = "neg"  
183
-        if rot < -180 and rot >= -225: 
184
-            grindvect = "neg" 
185
-        if rot < -225 and rot >= -270: 
198
+        if rot < -135 and rot >= -180:
199
+            grindvect = "neg"
200
+        if rot < -180 and rot >= -225:
201
+            grindvect = "neg"
202
+        if rot < -225 and rot >= -270:
186
             grindvect = "neg"
203
             grindvect = "neg"
187
             grindyvect = "neg"
204
             grindyvect = "neg"
188
-        if rot < -270 and rot >= -315: 
189
-            grindvect = "pos" 
205
+        if rot < -270 and rot >= -315:
206
+            grindvect = "pos"
190
             grindyvect = "pos"
207
             grindyvect = "pos"
191
-        if rot < -315: 
192
-            grindvect = "pos"   
208
+        if rot < -315:
209
+            grindvect = "pos"
193
 
210
 
194
         rot = round((rot * .01), 1)
211
         rot = round((rot * .01), 1)
195
         rot *= 100
212
         rot *= 100
196
 
213
 
197
         #print(own['inverting'])
214
         #print(own['inverting'])
198
-        if frames_grinding > 20 and own['inverting'] == False: 
199
-            #print("setting stance")       
215
+        if frames_grinding > 20 and own['inverting'] == False:
216
+            #print("setting stance")
200
             if (rot == 90 or rot == -270) and STANCE == True:
217
             if (rot == 90 or rot == -270) and STANCE == True:
201
                 #print("90 fak stance")
218
                 #print("90 fak stance")
202
                 own['stance'] = 1
219
                 own['stance'] = 1
210
                 own['stance'] = 0
227
                 own['stance'] = 0
211
                 STANCE = 0
228
                 STANCE = 0
212
             if (rot == -90 or rot == 270) and STANCE == False:
229
             if (rot == -90 or rot == 270) and STANCE == False:
213
-                #print("-90 reg stance")                        
230
+                #print("-90 reg stance")
214
                 own['stance'] = 0
231
                 own['stance'] = 0
215
                 STANCE = 0
232
                 STANCE = 0
216
-    def grindrotvel(obj):        
217
-        skipconst = 1              
233
+    def grindrotvel(obj):
218
         joinit = 0
234
         joinit = 0
219
         grinder_e = obj.worldOrientation.to_euler()
235
         grinder_e = obj.worldOrientation.to_euler()
220
-        grinder_rotz = math.degrees(grinder_e[2]) 
221
-        grinder_vect = obj.getAxisVect( [1, 0, 0]) 
222
-        grinder_vectz = obj.getAxisVect( [0, 0, 1]) 
223
-        rot = player_rotz - grinder_rotz        
236
+        grinder_rotz = math.degrees(grinder_e[2])
237
+        grinder_vect = obj.getAxisVect([1, 0, 0])
238
+        grinder_vectz = obj.getAxisVect([0, 0, 1])
239
+        rot = player_rotz - grinder_rotz
224
         rayhit = ray.hitObject
240
         rayhit = ray.hitObject
225
         own['grind_rot'] = rot
241
         own['grind_rot'] = rot
226
-        vect = obj.getAxisVect( [1.0, 0.0, 0.0])
242
+        vect = obj.getAxisVect([1.0, 0.0, 0.0])
227
         xyzb = obj.worldOrientation.to_euler()
243
         xyzb = obj.worldOrientation.to_euler()
228
-        rotzb = math.degrees(xyzb[2])   
229
-        grindpos = "None"         
244
+        rotzb = math.degrees(xyzb[2])
245
+        grindpos = "None"
230
         align = "None"
246
         align = "None"
231
         sub_converted = 0
247
         sub_converted = 0
232
         rotz = math.degrees(xyz[2])
248
         rotz = math.degrees(xyz[2])
233
         roty = math.degrees(xyz[1])
249
         roty = math.degrees(xyz[1])
234
-        bsrot = [ 0.0, 0.0, 1.570796327]    
235
-        negbsrot = [ 0.0, 0.0, -1.570796327]
250
+        bsrot = [0.0, 0.0, 1.570796327]
251
+        negbsrot = [0.0, 0.0, -1.570796327]
236
         zvel = own.linearVelocity
252
         zvel = own.linearVelocity
237
         zvel = zvel.z * .95
253
         zvel = zvel.z * .95
238
         if grindold == 0:
254
         if grindold == 0:
239
             if rotz < 0:
255
             if rotz < 0:
240
                 rotz = rotz + 360
256
                 rotz = rotz + 360
241
             if rotzb < 0:
257
             if rotzb < 0:
242
-                rotzb = rotzb + 360    
258
+                rotzb = rotzb + 360
243
             if rotz > rotzb:
259
             if rotz > rotzb:
244
                 sub_converted = rotz - rotzb
260
                 sub_converted = rotz - rotzb
245
             if rotz < rotzb:
261
             if rotz < rotzb:
246
                 sub_converted = rotzb - rotz
262
                 sub_converted = rotzb - rotz
247
 
263
 
248
         #z align
264
         #z align
249
-        #print("zalign") 
265
+        #print("zalign")
250
         stre = .15#.075#.15
266
         stre = .15#.075#.15
251
-        player.alignAxisToVect(grinder_vectz, 2, stre)                                                  
252
-        
267
+        player.alignAxisToVect(grinder_vectz, 2, stre)
268
+
253
         if rot >= 0 and rot < 45:
269
         if rot >= 0 and rot < 45:
254
             player.alignAxisToVect(grinder_vect, 0, align_strength)
270
             player.alignAxisToVect(grinder_vect, 0, align_strength)
255
             grindvect = "pos"
271
             grindvect = "pos"
256
-            #player.applyForce([0, 0, 0], True)            
257
-            player.setLinearVelocity([velxb, 0.0, zvel], 1)  
272
+            #player.applyForce([0, 0, 0], True)
273
+            player.setLinearVelocity([velxb, 0.0, zvel], 1)
258
             grindpos = "reg_5050"
274
             grindpos = "reg_5050"
259
             #print("50-1")
275
             #print("50-1")
260
 
276
 
261
 
277
 
262
-        elif rot >= 45 and rot < 90:  
278
+        elif rot >= 45 and rot < 90:
263
             player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
279
             player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
264
             grindvect = "pos"
280
             grindvect = "pos"
265
-            align = "pos"            
266
-            player.setLinearVelocity([0, convely, zvel], 1)   
267
-            grindpos = "reg_board"     
281
+            align = "pos"
282
+            player.setLinearVelocity([0, convely, zvel], 1)
283
+            grindpos = "reg_board"
268
             grindyvect = "pos"
284
             grindyvect = "pos"
269
-            #print("bs1, don't switch")       
270
-                           
271
-        elif rot >= 90 and rot < 135:  
272
-            grinder_vect = grinder_vect * -1                
273
-            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength) 
285
+            #print("bs1, don't switch")
286
+
287
+        elif rot >= 90 and rot < 135:
288
+            grinder_vect = grinder_vect * -1
289
+            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
274
             grindvect = "neg"
290
             grindvect = "neg"
275
             align = "neg"
291
             align = "neg"
276
             grindyvect = "neg"
292
             grindyvect = "neg"
277
             player.setLinearVelocity([0, convely, zvel], 1)
293
             player.setLinearVelocity([0, convely, zvel], 1)
278
-            grindpos = "reg_board"  
279
-            #print("-bs2, don't switch?")          
280
-                     
294
+            grindpos = "reg_board"
295
+            #print("-bs2, don't switch?")
296
+
281
         elif rot >= 135 and rot < 180:
297
         elif rot >= 135 and rot < 180:
282
             player.alignAxisToVect(-grinder_vect, 0, align_strength)
298
             player.alignAxisToVect(-grinder_vect, 0, align_strength)
283
             grindvect = "neg"
299
             grindvect = "neg"
284
-            player.setLinearVelocity([velxb, 0.0, zvel], 1) 
300
+            player.setLinearVelocity([velxb, 0.0, zvel], 1)
285
             grindpos = "reg_5050"
301
             grindpos = "reg_5050"
286
             #print("50-2")
302
             #print("50-2")
287
-           
303
+
288
         elif rot >= 180 and rot < 225:
304
         elif rot >= 180 and rot < 225:
289
             player.alignAxisToVect(-grinder_vect, 0, align_strength)
305
             player.alignAxisToVect(-grinder_vect, 0, align_strength)
290
             grindvect = "neg"
306
             grindvect = "neg"
291
             player.setLinearVelocity([velxb, 0.0, zvel], 1)
307
             player.setLinearVelocity([velxb, 0.0, zvel], 1)
292
-            grindpos = "reg_5050" 
308
+            grindpos = "reg_5050"
293
             #print("50-3")
309
             #print("50-3")
294
-            
310
+
295
         elif rot >= 225 and rot < 270:
311
         elif rot >= 225 and rot < 270:
296
             player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
312
             player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
297
             grindvect = "neg"
313
             grindvect = "neg"
299
             player.setLinearVelocity([0, convely, zvel], 1)
315
             player.setLinearVelocity([0, convely, zvel], 1)
300
             grindpos = "reg_board"
316
             grindpos = "reg_board"
301
             grindyvect = "pos"
317
             grindyvect = "pos"
302
-            #print("bs3")             
303
-           
318
+            #print("bs3")
319
+
304
         elif rot >= 270 and rot < 315:
320
         elif rot >= 270 and rot < 315:
305
-            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength) 
306
-            grindvect = "pos" 
321
+            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
322
+            grindvect = "pos"
307
             align = "neg"
323
             align = "neg"
308
             player.setLinearVelocity([0, convely, zvel], 1)
324
             player.setLinearVelocity([0, convely, zvel], 1)
309
-            grindpos = "reg_board"   
325
+            grindpos = "reg_board"
310
             grindyvect = "neg"
326
             grindyvect = "neg"
311
-            #print("-bs4")          
312
-            
327
+            #print("-bs4")
328
+
313
         elif rot >= 315:
329
         elif rot >= 315:
314
             player.alignAxisToVect(grinder_vect, 0, align_strength)
330
             player.alignAxisToVect(grinder_vect, 0, align_strength)
315
             grindvect = "pos"
331
             grindvect = "pos"
316
             player.setLinearVelocity([velxb, 0.0, zvel], 1)
332
             player.setLinearVelocity([velxb, 0.0, zvel], 1)
317
             grindpos = "reg_5050"
333
             grindpos = "reg_5050"
318
             #print("50-4")
334
             #print("50-4")
319
-                         
320
-#-------------------------------------------------------------            
335
+
336
+#-------------------------------------------------------------
321
         elif rot < 0 and rot >= -45:
337
         elif rot < 0 and rot >= -45:
322
             player.alignAxisToVect(grinder_vect, 0, align_strength)
338
             player.alignAxisToVect(grinder_vect, 0, align_strength)
323
             grindvect = "pos"
339
             grindvect = "pos"
324
-            player.setLinearVelocity([velxb, 0.0, zvel], 1)  
325
-            grindpos = "reg_5050" 
326
-            #print("50-5")                    
340
+            player.setLinearVelocity([velxb, 0.0, zvel], 1)
341
+            grindpos = "reg_5050"
342
+            #print("50-5")
327
         elif rot < -45 and rot >= -90:
343
         elif rot < -45 and rot >= -90:
328
             grinder_vect = grinder_vect * -1
344
             grinder_vect = grinder_vect * -1
329
             player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
345
             player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
330
             grindvect = "pos"
346
             grindvect = "pos"
331
             align = "neg"
347
             align = "neg"
332
             player.setLinearVelocity([0, convely, zvel], 1)
348
             player.setLinearVelocity([0, convely, zvel], 1)
333
-            grindpos = "reg_board"   
334
-            #print("-bs5")           
349
+            grindpos = "reg_board"
350
+            #print("-bs5")
335
             grindyvect = "neg"
351
             grindyvect = "neg"
336
         elif rot < -90 and rot >= -135:
352
         elif rot < -90 and rot >= -135:
337
             player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
353
             player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
338
             grindvect = "neg"
354
             grindvect = "neg"
339
             align = "pos"
355
             align = "pos"
340
             player.setLinearVelocity([0, convely, zvel], 1)
356
             player.setLinearVelocity([0, convely, zvel], 1)
341
-            grindpos = "reg_board"  
357
+            grindpos = "reg_board"
342
             grindyvect = "pos"
358
             grindyvect = "pos"
343
-            #print("bs6")                   
359
+            #print("bs6")
344
         elif rot < -135 and rot >= -180:
360
         elif rot < -135 and rot >= -180:
345
             player.alignAxisToVect(-grinder_vect, 0, align_strength)
361
             player.alignAxisToVect(-grinder_vect, 0, align_strength)
346
-            grindvect = "neg"   
347
-            player.setLinearVelocity([velxb, 0.0, zvel], 1)  
348
-            grindpos = "reg_5050" 
349
-            #print("50-6")       
362
+            grindvect = "neg"
363
+            player.setLinearVelocity([velxb, 0.0, zvel], 1)
364
+            grindpos = "reg_5050"
365
+            #print("50-6")
350
         elif rot < -180 and rot >= -225:
366
         elif rot < -180 and rot >= -225:
351
-            player.alignAxisToVect(-grinder_vect, 0, align_strength) 
352
-            grindvect = "neg"           
353
-            player.setLinearVelocity([velxb, 0.0, zvel], 1)  
354
-            grindpos = "reg_5050" 
367
+            player.alignAxisToVect(-grinder_vect, 0, align_strength)
368
+            grindvect = "neg"
369
+            player.setLinearVelocity([velxb, 0.0, zvel], 1)
370
+            grindpos = "reg_5050"
355
             #print("50-7")
371
             #print("50-7")
356
         elif rot < -225 and rot >= -270:
372
         elif rot < -225 and rot >= -270:
357
             grinder_vect = grinder_vect * -1
373
             grinder_vect = grinder_vect * -1
358
-            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength) 
374
+            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
359
             grindvect = "neg"
375
             grindvect = "neg"
360
             align = "neg"
376
             align = "neg"
361
             player.setLinearVelocity([0, convely, zvel], 1)
377
             player.setLinearVelocity([0, convely, zvel], 1)
362
-            grindpos = "reg_board"   
378
+            grindpos = "reg_board"
363
             grindyvect = "neg"
379
             grindyvect = "neg"
364
-            #print("-bs7")              
380
+            #print("-bs7")
365
         elif rot < -270 and rot >= -315:
381
         elif rot < -270 and rot >= -315:
366
-            player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength) 
382
+            player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
367
             grindvect = "pos"
383
             grindvect = "pos"
368
             align = "pos"
384
             align = "pos"
369
             player.setLinearVelocity([0, convely, zvel], 1)
385
             player.setLinearVelocity([0, convely, zvel], 1)
370
-            grindpos = "reg_board"    
386
+            grindpos = "reg_board"
371
             grindyvect = "pos"
387
             grindyvect = "pos"
372
-            #print("bs8")                                   
388
+            #print("bs8")
373
         elif rot < -315:
389
         elif rot < -315:
374
-            player.alignAxisToVect(grinder_vect, 0, align_strength) 
375
-            grindvect = "pos"                     
376
-            player.setLinearVelocity([velxb, 0.0, zvel], 1)  
377
-            grindpos = "reg_5050"  
390
+            player.alignAxisToVect(grinder_vect, 0, align_strength)
391
+            grindvect = "pos"
392
+            player.setLinearVelocity([velxb, 0.0, zvel], 1)
393
+            grindpos = "reg_5050"
378
             #print("50-8")
394
             #print("50-8")
379
 
395
 
380
         own['grindpos'] = grindpos
396
         own['grindpos'] = grindpos
381
         own['grindvect'] = grindvect
397
         own['grindvect'] = grindvect
382
         own['grindervect'] = grinder_vect
398
         own['grindervect'] = grinder_vect
383
-        try:   
399
+        try:
384
             own['grindyvect'] = grindyvect
400
             own['grindyvect'] = grindyvect
385
-            
401
+
386
         except:
402
         except:
387
-            pass 
388
-                
389
-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@        
403
+            pass
404
+
405
+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
390
     def grind(obj):
406
     def grind(obj):
391
         try:
407
         try:
392
             grindyvect = own['grindyvect']
408
             grindyvect = own['grindyvect']
393
         except:
409
         except:
394
-            grindyvect = 0 
395
-        grindvect = own['grindvect'] 
396
-        
410
+            grindyvect = 0
411
+        grindvect = own['grindvect']
412
+
397
         if 'rail' in obj:
413
         if 'rail' in obj:
398
-            own["grindSound"] = "rail" 
414
+            own["grindSound"] = "rail"
399
         else:
415
         else:
400
             own["grindSound"] = "concrete"
416
             own["grindSound"] = "concrete"
401
-        own['lGobj'] = obj         
402
-        
403
-        grinding = 1                
404
-        
417
+        own['lGobj'] = obj
418
+
419
+        grinding = 1
420
+
405
         framenum = own['framenum']
421
         framenum = own['framenum']
406
         lastairframe = own['lF_air_frame']
422
         lastairframe = own['lF_air_frame']
407
         jumpside = 0
423
         jumpside = 0
408
         if (framenum - lastairframe) < 10:
424
         if (framenum - lastairframe) < 10:
409
-            player_pos = own['jumpPos'] 
410
-            jumpside = 1   
411
-        else:    
425
+            player_pos = own['jumpPos']
426
+            jumpside = 1
427
+        else:
412
             player_pos = OG_PLAYER_POS
428
             player_pos = OG_PLAYER_POS
413
-        player_pos = own.worldPosition    
414
-        try:    
415
-            if 1 == 1:       
416
-                grinder_pos = obj.worldPosition 
429
+        player_pos = own.worldPosition
430
+        try:
431
+            if 1 == 1:
432
+                grinder_pos = obj.worldPosition
417
                 worldVect = [1, 0, 0]
433
                 worldVect = [1, 0, 0]
418
-                vect = obj.getAxisVect(worldVect)      
419
-                go = obj.worldOrientation
420
-                grinder_axis = [0,1,0]
421
-                try: 
434
+                vect = obj.getAxisVect(worldVect)
435
+                grinder_axis = [0, 1, 0]
436
+                try:
422
                     delta = player_pos - grinder_pos
437
                     delta = player_pos - grinder_pos
423
                 except:
438
                 except:
424
                     #print("delta broke: ", player_pos, grinder_pos)
439
                     #print("delta broke: ", player_pos, grinder_pos)
425
-                    pass 
440
+                    pass
426
                 delta = delta.cross(vect)
441
                 delta = delta.cross(vect)
427
                 if delta[2] >= 0:
442
                 if delta[2] >= 0:
428
                     grindside = "right"
443
                     grindside = "right"
431
                     grindside = "left"
446
                     grindside = "left"
432
                 edge = 0
447
                 edge = 0
433
                 if 'edge' in obj:
448
                 if 'edge' in obj:
434
-                    edge = 1    
449
+                    edge = 1
435
                 #print('grind on', grindside, edge)
450
                 #print('grind on', grindside, edge)
436
                 if (delta[2] > .00001 or delta[2] < -.00001) and (delta[2] < .8 or delta[2] < -.8):
451
                 if (delta[2] > .00001 or delta[2] < -.00001) and (delta[2] < .8 or delta[2] < -.8):
437
                     rotation = own.worldOrientation[2] - obj.worldOrientation[2]
452
                     rotation = own.worldOrientation[2] - obj.worldOrientation[2]
447
                         if (jumpside == 1 or jumpside == 0) and grindvect == "pos":
462
                         if (jumpside == 1 or jumpside == 0) and grindvect == "pos":
448
                             move = [0, deltamove, 0]
463
                             move = [0, deltamove, 0]
449
                             #print("1deltamove", deltamove)
464
                             #print("1deltamove", deltamove)
450
-                            own.applyMovement(move, True)    
465
+                            own.applyMovement(move, True)
451
                         if (jumpside == 1 or jumpside == 0) and grindvect == "neg":
466
                         if (jumpside == 1 or jumpside == 0) and grindvect == "neg":
452
                             move = [0, -deltamove, 0]
467
                             move = [0, -deltamove, 0]
453
                             #print("2deltamove -", deltamove)
468
                             #print("2deltamove -", deltamove)
454
-                            own.applyMovement(move, True)  
469
+                            own.applyMovement(move, True)
455
                     #board
470
                     #board
456
                     if own["grindpos"] == "reg_board":
471
                     if own["grindpos"] == "reg_board":
457
                         if grindvect == "neg":
472
                         if grindvect == "neg":
458
                             if (jumpside == 1 or jumpside == 0) and grindyvect == "pos":
473
                             if (jumpside == 1 or jumpside == 0) and grindyvect == "pos":
459
                                 move = [-deltamove, 0, 0]
474
                                 move = [-deltamove, 0, 0]
460
                                 #print("3deltamove", deltamove)
475
                                 #print("3deltamove", deltamove)
461
-                                own.applyMovement(move, True)        
476
+                                own.applyMovement(move, True)
462
                             if (jumpside == 1 or jumpside == 0) and grindyvect == "neg":
477
                             if (jumpside == 1 or jumpside == 0) and grindyvect == "neg":
463
                                 move = [deltamove, 0, 0]
478
                                 move = [deltamove, 0, 0]
464
                                 #print("4deltamove -", deltamove)
479
                                 #print("4deltamove -", deltamove)
465
-                                own.applyMovement(move, True)            
480
+                                own.applyMovement(move, True)
466
                         if grindvect == "pos":
481
                         if grindvect == "pos":
467
                             if (jumpside == 1 or jumpside == 0) and grindyvect == "pos":
482
                             if (jumpside == 1 or jumpside == 0) and grindyvect == "pos":
468
                                 move = [deltamove, 0, 0]
483
                                 move = [deltamove, 0, 0]
469
                                 #print("5deltamove", deltamove)
484
                                 #print("5deltamove", deltamove)
470
-                                own.applyMovement(move, True)        
485
+                                own.applyMovement(move, True)
471
                             if (jumpside == 1 or jumpside == 0) and grindyvect == "neg":
486
                             if (jumpside == 1 or jumpside == 0) and grindyvect == "neg":
472
                                 move = [-deltamove, 0, 0]
487
                                 move = [-deltamove, 0, 0]
473
-                                own.applyMovement(move, True)                    
474
-                own['grindside'] = grindside    
488
+                                own.applyMovement(move, True)
489
+                own['grindside'] = grindside
475
         except:
490
         except:
476
-            pass
477
-        #speed limit    
491
+            print('something in grinding is wrong')
492
+            #pass
493
+        #speed limit
478
         velo = own.getLinearVelocity(True)
494
         velo = own.getLinearVelocity(True)
479
         touchobj = obj
495
         touchobj = obj
480
-        if touchobj != None and gt_cd == 0:       
496
+        if touchobj != None and gt_cd == 0:
481
             if 'rail' in touchobj:
497
             if 'rail' in touchobj:
482
-                newvelx = velo.x * grindspeed_rail   
498
+                newvelx = velo.x * grindspeed_rail
483
                 newvely = velo.y * grindspeed_rail
499
                 newvely = velo.y * grindspeed_rail
484
             else:
500
             else:
485
-                newvelx = velo.x * grindspeed_cement  
486
-                newvely = velo.y * grindspeed_cement            
487
-            player.setLinearVelocity([newvelx, newvely, velo.z], 1)   
501
+                newvelx = velo.x * grindspeed_cement
502
+                newvely = velo.y * grindspeed_cement
503
+            player.setLinearVelocity([newvelx, newvely, velo.z], 1)
488
             player_rot = own.worldOrientation[2]
504
             player_rot = own.worldOrientation[2]
489
             grinder_rot = touchobj.worldOrientation[2]
505
             grinder_rot = touchobj.worldOrientation[2]
490
-            player_rot = own.getAxisVect( [0.0, 0.0, 1.0])
506
+            player_rot = own.getAxisVect([0.0, 0.0, 1.0])
491
             xyz3 = own.worldOrientation.to_euler()
507
             xyz3 = own.worldOrientation.to_euler()
492
             player_rot = math.degrees(xyz3[2])
508
             player_rot = math.degrees(xyz3[2])
493
             xyz4 = touchobj.worldOrientation.to_euler()
509
             xyz4 = touchobj.worldOrientation.to_euler()
494
-            grinder_rot = math.degrees(xyz4[2]) 
510
+            grinder_rot = math.degrees(xyz4[2])
495
             if player_rot < 0:
511
             if player_rot < 0:
496
                 player_rot = abs(player_rot) + 180
512
                 player_rot = abs(player_rot) + 180
497
             if grinder_rot < 0:
513
             if grinder_rot < 0:
498
-                grinder_rot = abs(grinder_rot) + 180                   
514
+                grinder_rot = abs(grinder_rot) + 180
499
             subtraction = player_rot - grinder_rot
515
             subtraction = player_rot - grinder_rot
500
-        
516
+
501
     def invertpos(detectedObjects):
517
     def invertpos(detectedObjects):
502
         minDist = None
518
         minDist = None
503
         nearestObject = None
519
         nearestObject = None
506
             if (minDist is None or dist < minDist):
522
             if (minDist is None or dist < minDist):
507
                 nearestObject = obj
523
                 nearestObject = obj
508
                 minDist = dist
524
                 minDist = dist
509
-        if nearestObject != None:                            
525
+        if nearestObject != None:
510
             own.linearVelocity.x = 0
526
             own.linearVelocity.x = 0
511
-            own.linearVelocity.y = 0            
512
-    
527
+            own.linearVelocity.y = 0
528
+
513
     if grindDar.positive == False and grindTouch.triggered 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 own['air_mover'] == False:
529
     if grindDar.positive == False and grindTouch.triggered 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 own['air_mover'] == False:
514
         #print("touching, no dar")
530
         #print("touching, no dar")
515
         pass
531
         pass
516
-    #print(grindold, "grindold")  
517
-    skipper = 0      
518
-    if (grindDar.positive or grindTouch.positive) and no_grind == 0:        
532
+    #print(grindold, "grindold")
533
+    skipper = 0
534
+    if (grindDar.positive or grindTouch.positive) and no_grind == 0:
519
         if grindDar.positive:
535
         if grindDar.positive:
520
             detectedObjects = grindDar.hitObjectList
536
             detectedObjects = grindDar.hitObjectList
521
-            dist = 0
537
+            dist = 0.0
522
             for obj in detectedObjects:
538
             for obj in detectedObjects:
523
                 dist = own.getDistanceTo(obj)
539
                 dist = own.getDistanceTo(obj)
524
                 if (minDist is None or dist < minDist):
540
                 if (minDist is None or dist < minDist):
525
                     nearestObject = obj
541
                     nearestObject = obj
526
-                    minDist = dist     
542
+                    minDist = dist
527
         elif grindTouch.positive:
543
         elif grindTouch.positive:
528
             nearestObject = grindTouch.hitObject
544
             nearestObject = grindTouch.hitObject
529
             dist = .7
545
             dist = .7
530
-            #print('using touch object')                    
531
-        
532
-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@        
546
+            #print('using touch object')
547
+
548
+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
533
         #init grind
549
         #init grind
534
-        
550
+
535
         if invert_on:
551
         if invert_on:
536
             invertpos(detectedObjects)
552
             invertpos(detectedObjects)
537
             own['inverting'] = True
553
             own['inverting'] = True
543
         if dist < grind_dist and dropin == 0 and manual == 0 and no_grind == 0 and own['grindoutturn'] == 0 and own['manual'] == 0 and own['gt_cd2'] < 40 and invert_on == False and own['air_mover'] == False and no_grind_pull == 0 and own['last_invert'] == False and own['grindjumpturn'] == 0 and grind_jump == 0 and own['airup'] == 0:
559
         if dist < grind_dist and dropin == 0 and manual == 0 and no_grind == 0 and own['grindoutturn'] == 0 and own['manual'] == 0 and own['gt_cd2'] < 40 and invert_on == False and own['air_mover'] == False and no_grind_pull == 0 and own['last_invert'] == False and own['grindjumpturn'] == 0 and grind_jump == 0 and own['airup'] == 0:
544
             #print("grinding")
560
             #print("grinding")
545
             grind_height_dif = (own.worldPosition[2] - nearestObject.worldPosition[2]) - .287
561
             grind_height_dif = (own.worldPosition[2] - nearestObject.worldPosition[2]) - .287
546
-            worldPos = own.worldPosition
562
+            #worldPos = own.worldPosition
547
             if grind_height_dif > -.05:#02:
563
             if grind_height_dif > -.05:#02:
548
 
564
 
549
                 if own['grinder_rot'] != None:
565
                 if own['grinder_rot'] != None:
550
-                    grot = nearestObject.getAxisVect( [1, 0.0, 0.0]).x
566
+                    grot = nearestObject.getAxisVect([1, 0.0, 0.0]).x
551
                     dif = (grot - own['grinder_rot'])
567
                     dif = (grot - own['grinder_rot'])
552
                     if dif > .8 or dif < - .8:
568
                     if dif > .8 or dif < - .8:
553
                         print('skipping grind, angle is', dif)
569
                         print('skipping grind, angle is', dif)
554
                         skipper = 1
570
                         skipper = 1
555
-                
556
-                
571
+
572
+
557
                     #print((grot - own['grinder_rot']), 'grinder_rot')
573
                     #print((grot - own['grinder_rot']), 'grinder_rot')
558
-                own['grinder_rot']  = nearestObject.getAxisVect([1,0,0]).x
574
+                own['grinder_rot'] = nearestObject.getAxisVect([1, 0, 0]).x
559
                 if skipper != 1:
575
                 if skipper != 1:
560
-
561
-                    grindvect(nearestObject)          
576
+                    grindvect(nearestObject)
562
                     grindrotvel(nearestObject)
577
                     grindrotvel(nearestObject)
563
                     grind(nearestObject)
578
                     grind(nearestObject)
564
                     grindold = True
579
                     grindold = True
565
                     own['grindold_timer'] = 0
580
                     own['grindold_timer'] = 0
566
                     own["grindHit"] = True
581
                     own["grindHit"] = True
567
                     own['grindnew_timer'] += 1
582
                     own['grindnew_timer'] += 1
568
-
569
-
570
                     if own['grindnew_timer'] < 1:
583
                     if own['grindnew_timer'] < 1:
571
                         if grindTouch.triggered:
584
                         if grindTouch.triggered:
572
                             nearpos = nearestObject.worldPosition
585
                             nearpos = nearestObject.worldPosition
573
                             if hitNormal != None:
586
                             if hitNormal != None:
574
                                 stre = .15
587
                                 stre = .15
575
-                                own.alignAxisToVect(hitNormal, 2, stre) 
576
-                                #print("align")                   
588
+                                own.alignAxisToVect(hitNormal, 2, stre)
589
+                                #print("align")
577
                             #own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
590
                             #own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
578
-                            #print('new moving world')                    
591
+                            print('new moving world')
579
 
592
 
580
     else:
593
     else:
581
-        #grindold = False 
594
+        #grindold = False
582
         own['grindold_timer'] += 1
595
         own['grindold_timer'] += 1
583
         own["grindHit"] = False
596
         own["grindHit"] = False
584
-        own['inverting'] = False   
585
-    
597
+        own['inverting'] = False
598
+
586
     if own['grindold_timer'] > 5:
599
     if own['grindold_timer'] > 5:
587
         grindold = False
600
         grindold = False
588
         own['grind_start_frame'] = framenum
601
         own['grind_start_frame'] = framenum
589
         own["grindSound"] = None
602
         own["grindSound"] = None
590
-    
603
+
591
     if own['grindHit'] == False:
604
     if own['grindHit'] == False:
592
-        own['grindnew_timer'] = 0  
593
- 
594
-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    
595
-       
605
+        own['grindnew_timer'] = 0
606
+
607
+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
608
+
596
 #if you are touching grinder and last_manual is off keep manual off
609
 #if you are touching grinder and last_manual is off keep manual off
597
     if (own['fak_nmanual'] == 1 or own['reg_nmanual'] == 1 or own['fak_manual'] == 1 or own['reg_manual'] == 1) and lastGround == True and grindold == False:
610
     if (own['fak_nmanual'] == 1 or own['reg_nmanual'] == 1 or own['fak_manual'] == 1 or own['reg_manual'] == 1) and lastGround == True and grindold == False:
598
         manual = 1
611
         manual = 1
604
     if abs(own['pregrind_vely']) > abs(vely) and own['LAST_GRIND'] == 0:
617
     if abs(own['pregrind_vely']) > abs(vely) and own['LAST_GRIND'] == 0:
605
         convely = own['pregrind_vely']
618
         convely = own['pregrind_vely']
606
     else:
619
     else:
607
-        convely = vely    
620
+        convely = vely
608
 
621
 
609
     off = 0
622
     off = 0
610
 
623
 
611
     if touched == True:
624
     if touched == True:
612
         own["grindTouchobj"] = grindTouch.hitObject
625
         own["grindTouchobj"] = grindTouch.hitObject
613
     else:
626
     else:
614
-        own["grindTouchobj"] = None  
615
- 
627
+        own["grindTouchobj"] = None
628
+
616
     if ray.triggered and dropin == 0:
629
     if ray.triggered and dropin == 0:
617
         lgobj = ray.hitObject
630
         lgobj = ray.hitObject
618
         own['lGobj'] = lgobj
631
         own['lGobj'] = lgobj
620
         #prop = obj.get("property", None)
633
         #prop = obj.get("property", None)
621
         linVelocity3 = own.getLinearVelocity(True)
634
         linVelocity3 = own.getLinearVelocity(True)
622
         grindpos2 = own["grindpos"]
635
         grindpos2 = own["grindpos"]
623
-        regboard = "reg_board"
624
-        fakboard = "fak_board"
625
-        if obj is not None:        
636
+        if obj is not None:
626
             if 'rail' in ray.hitObject:
637
             if 'rail' in ray.hitObject:
627
-                own["grindSound"] = "rail" 
638
+                own["grindSound"] = "rail"
628
             else:
639
             else:
629
                 own["grindSound"] = "concrete"
640
                 own["grindSound"] = "concrete"
630
-        own['lGobj'] = lgobj    
641
+        own['lGobj'] = lgobj
631
     else:
642
     else:
632
         lgobj = "empty"
643
         lgobj = "empty"
633
         own['lGobj'] = lgobj
644
         own['lGobj'] = lgobj
644
         if own['grindOld'] == 1 and ray.triggered == 1:
655
         if own['grindOld'] == 1 and ray.triggered == 1:
645
             own['aligntimer'] = own['aligntimer'] - 1
656
             own['aligntimer'] = own['aligntimer'] - 1
646
         if own['grindOld'] == 0 and ray.triggered == 0:
657
         if own['grindOld'] == 0 and ray.triggered == 0:
647
-            own['aligntimer'] = 0   
658
+            own['aligntimer'] = 0
648
 
659
 
649
     def invertpos():
660
     def invertpos():
650
         minDist = None
661
         minDist = None
654
             if (minDist is None or dist < minDist):
665
             if (minDist is None or dist < minDist):
655
                 nearestObject = obj
666
                 nearestObject = obj
656
                 minDist = dist
667
                 minDist = dist
657
-        vect = nearestObject.getAxisVect( [1.0, 0.0, 0.0])
668
+        vect = nearestObject.getAxisVect([1.0, 0.0, 0.0])
658
         #own.alignAxisToVect(vect, 0, 0)
669
         #own.alignAxisToVect(vect, 0, 0)
659
         own.worldPosition = [nearestObject.worldPosition.x, nearestObject.worldPosition.y, nearestObject.worldPosition.z +.1]
670
         own.worldPosition = [nearestObject.worldPosition.x, nearestObject.worldPosition.y, nearestObject.worldPosition.z +.1]
660
-       #own.setLinearVelocity([0, 0.0, 0], 1)                    
661
-            
671
+       #own.setLinearVelocity([0, 0.0, 0], 1)
672
+
662
     def set_pregrind_vel():
673
     def set_pregrind_vel():
663
         if grindDar.triggered == False and ray.triggered == False:
674
         if grindDar.triggered == False and ray.triggered == False:
664
             own['pregrind_velx'] = linVelocity2.x
675
             own['pregrind_velx'] = linVelocity2.x
665
             own['pregrind_vely'] = linVelocity2.y
676
             own['pregrind_vely'] = linVelocity2.y
666
             own['pregrind_velz'] = linVelocity2.z
677
             own['pregrind_velz'] = linVelocity2.z
667
-            
678
+
668
     def stop_bounce():
679
     def stop_bounce():
669
         if grindTouch.triggered and no_grind == 0 and grind_jump == 0 and jump_timer < 30:
680
         if grindTouch.triggered and no_grind == 0 and grind_jump == 0 and jump_timer < 30:
670
             linVelocity4 = own.getLinearVelocity(True)
681
             linVelocity4 = own.getLinearVelocity(True)
671
             if linVelocity4.z > 0:
682
             if linVelocity4.z > 0:
672
                 own.setLinearVelocity([linVelocity4.x, linVelocity4.y, 0], 1)
683
                 own.setLinearVelocity([linVelocity4.x, linVelocity4.y, 0], 1)
673
-                        
674
-    if jump_timer < 30 :
675
-        own['grind_jump'] = 0 
684
+
685
+    if jump_timer < 30:
686
+        own['grind_jump'] = 0
676
     if grindold == False and ray.triggered:
687
     if grindold == False and ray.triggered:
677
-        own['grind_start_frame'] = own['framenum']  
678
-        
688
+        own['grind_start_frame'] = own['framenum']
689
+
679
     if grindDar_timer > 0:
690
     if grindDar_timer > 0:
680
         grindDar_timer -= 1
691
         grindDar_timer -= 1
681
-    if ray.triggered == False and touched == True  and own['footplant_on'] == False and manual == 0 and own['gt_cd2'] < 55 and own['grindoutturn'] == 0 and own['grindjumpturn'] == 0 :        
682
-        obj = grindTouch.hitObject 
692
+    if ray.triggered == False and touched == True  and own['footplant_on'] == False and manual == 0 and own['gt_cd2'] < 55 and own['grindoutturn'] == 0 and own['grindjumpturn'] == 0:
693
+        obj = grindTouch.hitObject
683
         try:
694
         try:
684
             nearpos = obj.worldPosition
695
             nearpos = obj.worldPosition
685
         except:
696
         except:
686
-            pass    
687
-    if ray.triggered == False:
688
-        own["nogrindsound"] = 1 
697
+            pass
698
+    #if ray.triggered == False:
699
+        #own["nogrindsound"] = 1
689
     def slow_roty():
700
     def slow_roty():
690
       #print(abs(roty - own['last_roty']))
701
       #print(abs(roty - own['last_roty']))
691
-      #print(roty)                
692
-      
702
+      #print(roty)
703
+
693
       #if roted > 5:
704
       #if roted > 5:
694
         #pass
705
         #pass
695
-        #align slow  
706
+        #align slow
696
         constraint = cont.actuators['gConstraint']
707
         constraint = cont.actuators['gConstraint']
697
         if (own['framenum'] - own['grind_start_frame'] < 40) and touched == 1:
708
         if (own['framenum'] - own['grind_start_frame'] < 40) and touched == 1:
698
-          #print('limit rot')              
709
+          #print('limit rot')
699
           #constraint.damp = 80
710
           #constraint.damp = 80
700
         #else:
711
         #else:
701
           #constraint.damp = 30
712
           #constraint.damp = 30
702
         #constraint.rotDamp = 80
713
         #constraint.rotDamp = 80
703
-            cont.activate(constraint) 
714
+            cont.activate(constraint)
704
         else:
715
         else:
705
-            cont.deactivate(constraint)      
706
-    timer()    
716
+            cont.deactivate(constraint)
717
+    timer()
707
     aligntimer()
718
     aligntimer()
708
-    stop_bounce() 
719
+    stop_bounce()
709
     slow_roty()
720
     slow_roty()
710
-      
711
-                   
712
-    own['grindOld'] = grindold 
721
+
722
+
723
+    own['grindOld'] = grindold
713
     own['test'] = test
724
     own['test'] = test
714
     own['grindTrackObj'] = nearestObject
725
     own['grindTrackObj'] = nearestObject
715
     own['grindDar_hit'] = grindDar.positive
726
     own['grindDar_hit'] = grindDar.positive

Loading…
Annuler
Enregistrer