|
@@ -116,7 +116,9 @@ def main():
|
116
|
116
|
velx = linVelocity2.x
|
117
|
117
|
vely = linVelocity2.y
|
118
|
118
|
if abs(own['pregrind_vely']) > abs(vely) and own['LAST_GRIND'] == 0:
|
119
|
|
- convely = own['pregrind_vely']
|
|
119
|
+ #convely = own['pregrind_vely']
|
|
120
|
+ #print('changing convely')
|
|
121
|
+ convely = vely
|
120
|
122
|
else:
|
121
|
123
|
convely = vely
|
122
|
124
|
def grindvect(obj):
|
|
@@ -478,22 +480,25 @@ def main():
|
478
|
480
|
minDist = dist
|
479
|
481
|
if nearestObject != None:
|
480
|
482
|
own.linearVelocity.x = 0
|
481
|
|
- own.linearVelocity.y = 0
|
482
|
|
-
|
483
|
|
-
|
|
483
|
+ own.linearVelocity.y = 0
|
484
|
484
|
|
485
|
|
- if grindDar.positive == False and grindTouch.positive 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:
|
|
485
|
+ 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:
|
486
|
486
|
#print("touching, no dar")
|
487
|
487
|
pass
|
488
|
488
|
#print(grindold, "grindold")
|
489
|
|
- if grindDar.positive:
|
490
|
|
- detectedObjects = grindDar.hitObjectList
|
491
|
|
- dist = 0
|
492
|
|
- for obj in detectedObjects:
|
493
|
|
- dist = own.getDistanceTo(obj)
|
494
|
|
- if (minDist is None or dist < minDist):
|
495
|
|
- nearestObject = obj
|
496
|
|
- minDist = dist
|
|
489
|
+ if grindDar.positive or grindTouch.positive:
|
|
490
|
+ if grindDar.positive:
|
|
491
|
+ detectedObjects = grindDar.hitObjectList
|
|
492
|
+ dist = 0
|
|
493
|
+ for obj in detectedObjects:
|
|
494
|
+ dist = own.getDistanceTo(obj)
|
|
495
|
+ if (minDist is None or dist < minDist):
|
|
496
|
+ nearestObject = obj
|
|
497
|
+ minDist = dist
|
|
498
|
+ elif grindTouch.positive:
|
|
499
|
+ nearestObject = grindTouch.hitObject
|
|
500
|
+ dist = .7
|
|
501
|
+ #print('using touch object')
|
497
|
502
|
|
498
|
503
|
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
499
|
504
|
#init grind
|
|
@@ -504,18 +509,12 @@ def main():
|
504
|
509
|
else:
|
505
|
510
|
own['inverting'] = False
|
506
|
511
|
grind_dist = .8#.6
|
507
|
|
- 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 and own['air_mover'] == False and no_grind_pull == 0:
|
508
|
|
- #print("new grind trigger")
|
509
|
|
- npos = nearestObject.worldPosition
|
510
|
|
-
|
511
|
|
-
|
512
|
|
- #grind
|
513
|
|
- #print(dist)
|
514
|
|
- 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'] < 55 and invert_on == False and own['air_mover'] == False and no_grind_pull == 0 and own['last_invert'] == False:
|
515
|
|
- #print("grind")
|
|
512
|
+
|
|
513
|
+ 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:
|
|
514
|
+ #print('grind')
|
516
|
515
|
hitObject, hitPoint, hitNormal = own.rayCast(nearestObject.worldPosition, own.worldPosition, .0, 'grind')
|
517
|
516
|
if grindold == 0:
|
518
|
|
- if grindTouch.positive:
|
|
517
|
+ if grindTouch.triggered:
|
519
|
518
|
nearpos = nearestObject.worldPosition
|
520
|
519
|
if hitNormal != None:
|
521
|
520
|
stre = .05
|
|
@@ -523,8 +522,6 @@ def main():
|
523
|
522
|
#print("align")
|
524
|
523
|
own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
|
525
|
524
|
#print('moving world')
|
526
|
|
-
|
527
|
|
-
|
528
|
525
|
#print("grinding")
|
529
|
526
|
grind_height_dif = (own.worldPosition[2] - nearestObject.worldPosition[2]) - .287
|
530
|
527
|
worldPos = own.worldPosition
|
|
@@ -534,8 +531,18 @@ def main():
|
534
|
531
|
grind(nearestObject)
|
535
|
532
|
grindold = True
|
536
|
533
|
own['grindold_timer'] = 0
|
537
|
|
- own["grindHit"] = True
|
538
|
|
-
|
|
534
|
+ own["grindHit"] = True
|
|
535
|
+ own['grindnew_timer'] += 1
|
|
536
|
+
|
|
537
|
+ if own['grindnew_timer'] < 1:
|
|
538
|
+ if grindTouch.triggered:
|
|
539
|
+ nearpos = nearestObject.worldPosition
|
|
540
|
+ if hitNormal != None:
|
|
541
|
+ stre = .05
|
|
542
|
+ own.alignAxisToVect(hitNormal, 2, stre)
|
|
543
|
+ #print("align")
|
|
544
|
+ own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
|
|
545
|
+ print('new moving world')
|
539
|
546
|
|
540
|
547
|
else:
|
541
|
548
|
#grindold = False
|
|
@@ -548,7 +555,9 @@ def main():
|
548
|
555
|
own['grind_start_frame'] = framenum
|
549
|
556
|
own["grindSound"] = None
|
550
|
557
|
|
551
|
|
-
|
|
558
|
+ if own['grindHit'] == False:
|
|
559
|
+ own['grindnew_timer'] = 0
|
|
560
|
+
|
552
|
561
|
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
553
|
562
|
|
554
|
563
|
#if you are touching grinder and last_manual is off keep manual off
|
|
@@ -616,9 +625,6 @@ def main():
|
616
|
625
|
#own.alignAxisToVect(vect, 0, 0)
|
617
|
626
|
own.worldPosition = [nearestObject.worldPosition.x, nearestObject.worldPosition.y, nearestObject.worldPosition.z +.1]
|
618
|
627
|
#own.setLinearVelocity([0, 0.0, 0], 1)
|
619
|
|
-
|
620
|
|
-
|
621
|
|
-
|
622
|
628
|
|
623
|
629
|
def set_pregrind_vel():
|
624
|
630
|
if grindDar.triggered == False and ray.triggered == False:
|
|
@@ -639,9 +645,12 @@ def main():
|
639
|
645
|
|
640
|
646
|
if grindDar_timer > 0:
|
641
|
647
|
grindDar_timer -= 1
|
642
|
|
- if grindDar_timer > 0 and ray.triggered == False and touched == True and own['footplant_on'] == False and manual == 0:
|
|
648
|
+ 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 :
|
643
|
649
|
obj = grindTouch.hitObject
|
644
|
|
- own.worlPosition = obj.worldPosition
|
|
650
|
+ try:
|
|
651
|
+ nearpos = obj.worldPosition
|
|
652
|
+ except:
|
|
653
|
+ pass
|
645
|
654
|
if ray.triggered == False:
|
646
|
655
|
own["nogrindsound"] = 1
|
647
|
656
|
timer()
|