-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
2009 lines (1929 loc) · 76 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
local TimeSplice = RegisterMod("KingCrimson",1.0)
local item = Isaac.GetItemIdByName("Tape splicer")
local moveX = {0,0,0,0} -- 1 for right, -1 for left
local moveY = {0,0,0,0} -- 1 for down, -1 for up
local shootX = {0,0,0,0} -- 1 for right, -1 for left
local shootY = {0,0,0,0} -- 1 for down, -1 for up
local rockstuckcooldown = {0,0,0,0}
local lastplayerpos = {Vector(0,0),Vector(0,0),Vector(0,0),Vector(0,0)}
local aroundrockdirection = {0,0,0,0}
local incorner = {-1,-1,-1,-1}
local avoidrange = 15
local firerange = 60
local pickupdistance = 0
local enemydistance = 0
local chaserange = 0
local shoottolerance = 25
local bossroom = false
local ignoreenemiesitems = false
local bombcooldown = 0
local highestshopprice = 0
local visitedcrawlspace = false
local greedmodecooldown = 0
local greedmodebuttonpos = Vector(320,400)
local greedexitopen = false
local rockavoidwarmup = 0
local rockavoidcooldowndefault = 35
local playerID = 0
local avoidDangers = true
local shootEnemies = true
local shootFires = true
local shootPoops = true
local avoidCorners = true
local goaroundrockspits = true
local avoidotherplayers = true
local followplayer1 = true
--0 for off, 1 for player1 only, 2 for all ais
local getPickups = 2
local usePillsCards = 0
local getItems = 0
local getTrinkets = 0
local useItems = 0
local pressButtons = 2
local moveToDoors = 2
local bombThings = 2
local usebeggarsandmachines = 0
local goesshopping = 0
local takesdevildeals = 0
local multisettingmin = 0 --setting needs to be higher than this to be applied
local clone = nil
local cloneSig = Vector(0, 0)
local counter = 0
local effect = nil
local sfx = SFXManager()
local music = MusicManager()
local customSfx = {
["WINDUP_1"] = Isaac.GetSoundIdByName("KCWindup1"),
["WINDUP_2"] = Isaac.GetSoundIdByName("KCWindup2"),
["START_SKIP_1"] = Isaac.GetSoundIdByName("KCIntro1"),
["START_SKIP_2"] = Isaac.GetSoundIdByName("KCIntro2"),
["END_SKIP"] = Isaac.GetSoundIdByName("KCOutro")
}
local bd = nil
local roomIndex = 0
local weaponType = {1, 1, 1, 1} -- 1 tear, 2 laser, 3 knife, 4 bomb, 5 rockets, 6 mlung
local canShootCharged = {false, false, false, false} -- lasers
local canShootChargedLong = {false, false, false, false} -- rockets, knives
local lastShotLaser = { }
local laserRange = {0, 0, 0, 0}
local updateLaserRange = {false, false, false, false}
local entColClass = nil
local gridColClass = nil
local closestEnemy = nil
local shotmultiplier = 1
local gridEntOnCol = { }
local correctionFactor = 20
local activeItemIds = {0, 0, 0, 0}
local activeItemCharges = {0, 0, 0, 0}
--local toggledTCS = false
function TimeSplice:tick()
--[[if Input.IsActionPressed(26, 0) then
toggledTCS = not toggledTCS
end--]]
if counter == 0 then return end
if counter == 1 then
effect:Remove()
TimeSplice:resetVals(Isaac.GetPlayer(playerID))
music:Resume()
Isaac.GetPlayer(playerID):AddCacheFlags(CacheFlag.CACHE_DAMAGE)
Isaac.GetPlayer(playerID):EvaluateItems()
return
end
counter = counter - 1
if counter == 15 then
Game():ShowHallucination(0, bd)
sfx:Stop(SoundEffect.SOUND_DEATH_CARD)
-- restore grid entities
local room = Game():GetRoom()
for i = 0, room:GetGridSize() - 1 do
local curr = room:GetGridEntity(i)
if curr then
local sprite = curr:GetSprite()
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
end
end
return
end
if counter < 30 then return end
-- remove effect if leaving the currnet room
if roomIndex ~= Game():GetLevel():GetCurrentRoomIndex() and counter > 30 then
bd = Game():GetRoom():GetBackdropType()
counter = 30
end
local player = Isaac.GetPlayer(playerID)
for i, v in pairs(gridEntOnCol) do
if v == 0 then
gridEntOnCol[i] = nil
local ent = Game():GetRoom():GetGridEntity(i)
ent:GetSprite().Color = Color(1, 1, 1, 0, 0, 0, 0)
else gridEntOnCol[i] = v - 1 end
end
if counter == 399 then
player:AnimateCollectible(item, "LiftItem", "PlayerPickup")
elseif counter == 380 then
player:AddControlsCooldown(110)
player:AddEntityFlags(EntityFlag.FLAG_NO_TARGET)
cloneSig = player.Position
clone.Position = cloneSig
bd = Game():GetRoom():GetBackdropType()
for _,v in pairs(Isaac.GetRoomEntities()) do
-- freeze all enemies during windup
if v.Index ~= effect.Index and
v.Type ~= EntityType.ENTITY_TEAR and v.Type ~= EntityType.ENTITY_PROJECTILE then
v:AddEntityFlags(EntityFlag.FLAG_FREEZE)
v:AddEntityFlags(EntityFlag.FLAG_NO_KNOCKBACK)
if v:IsBoss() then v:AddEntityFlags(EntityFlag.FLAG_NO_SPRITE_UPDATE) end
elseif v.Type == EntityType.ENTITY_TEAR or v.Type == EntityType.ENTITY_PROJECTILE then
local data = v:GetData()
local tear = v:ToTear()
if not tear then tear = v:ToProjectile() end
data.StoredVel = tear.Velocity
data.StoredFall = tear.FallingSpeed
tear.Velocity = Vector(0, 0)
tear.FallingSpeed = 0
if v.Type == EntityType.ENTITY_TEAR then
data.StoredAccel = tear.FallingAcceleration
tear.FallingAcceleration = -0.1
else
data.StoredAccel = tear.FallingAccel
tear.FallingAccel = -0.1
end
end
if v:IsEnemy() and v.Type ~= EntityType.ENTITY_PLAYER and v.Type ~= EntityType.ENTITY_EFFECT then
-- set to target clone
--TimeSplice:SetTarget(v, clone)
v.Target = clone
-- brighten color
local brightnessFactor = 2.5
if v.Type == EntityType.ENTITY_THE_HAUNT then brightnessFactor = 2 end
v:SetColor(Color(1, 1, 1, brightnessFactor, 0, 0, 0), 0, 0, false, false)
end
if v.Type == EntityType.ENTITY_KNIFE then
v.Visible = false
end
end
elseif counter == 370 then
sfx:Play(customSfx["START_SKIP_"..math.random(2)], 1, 0, false, 1, 0)
elseif counter == 345 then
player:AnimateCollectible(item, "HideItem", "PlayerPickup")
-- change room backdrop for cosmo effect
Game():ShowHallucination(0, 35)
sfx:Stop(SoundEffect.SOUND_DEATH_CARD)
-- unfreeze enemies
for _,v in pairs(Isaac.GetRoomEntities()) do
v:ClearEntityFlags(EntityFlag.FLAG_FREEZE)
v:ClearEntityFlags(EntityFlag.FLAG_NO_SPRITE_UPDATE)
v:ClearEntityFlags(EntityFlag.FLAG_NO_KNOCKBACK)
if v.Type == EntityType.ENTITY_TEAR or v.Type == EntityType.ENTITY_PROJECTILE then
local data = v:GetData()
local tear = v:ToTear()
if not tear then tear = v:ToProjectile() end
tear.Velocity = data.StoredVel
tear.FallingSpeed = data.StoredFall
if v.Type == EntityType.ENTITY_TEAR then tear.FallingAcceleration = data.StoredAccel
else tear.FallingAccel = data.StoredAccel end
end
end
-- hide grid entities
local room = Game():GetRoom()
for i = 0, room:GetGridSize() - 1 do
local curr = room:GetGridEntity(i)
if curr then
local sprite = curr:GetSprite()
sprite.Color = Color(1, 1, 1, 0, 0, 0, 0)
end
end
elseif counter == 30 then
--(re-)loading or setting to frame 0 apparently doesn't work for me, so we create a new entity...
effect:Remove()
local w = Isaac.GetScreenWidth()
local h = Isaac.GetScreenHeight()
effect = Isaac.Spawn(1000, 1000, 100, Vector(
math.min(430 - w, w - 530), math.min(260 - h, h - 280)), Vector(0,0), nil)
local idx = Game():GetRoom():GetRoomShape()
effect:GetSprite().Scale = Vector(
((idx >= 6 and idx <= 12) and 2 or 1)*Isaac.GetScreenWidth()/480,
((idx == 4 or idx == 5 or (idx >= 8 and idx <= 12)) and 2 or 1)*Isaac.GetScreenHeight()/270)
sfx:Stop(customSfx["START_SKIP_1"])
sfx:Stop(customSfx["START_SKIP_2"])
sfx:Play(customSfx["END_SKIP"], 1, 0, false, 1, 0)
-- restore color
for _,v in pairs(Isaac.GetRoomEntities()) do
v:SetColor(Color(1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0), 0, 0, false, false)
if v.Type == EntityType.ENTITY_KNIFE then
v.Visible = true
end
if v.Type == EntityType.ENTITY_FAMILIAR then
--v:ToFamiliar().FireCooldown = 0
end
end
player:AddCacheFlags(CacheFlag.CACHE_DAMAGE)
player:EvaluateItems()
player:ClearEntityFlags(EntityFlag.FLAG_NO_TARGET)
return
end
-- play red flash effect
if counter >= 359 and counter <= 370 then TimeSplice:redFlash() end
-- dont conrol ai if still during windup
if counter > 345 then return end
-- get room
local currentRoom = Game():GetLevel():GetCurrentRoom()
-- make player intangible
player.EntityCollisionClass = EntityCollisionClass.ENTCOLL_PLAYERONLY
player.GridCollisionClass = EntityGridCollisionClass.GRIDCOLL_WALLS
-- move clone to new pos
local sData = Game():GetLevel():GetCurrentRoomDesc().Data
local currPos = cloneSig
local currVel = Vector(player.MoveSpeed * moveX[playerID + 1] * 6, player.MoveSpeed * moveY[playerID + 1] * 6)
if goaroundrockspits and currentRoom:GetGridEntityFromPos(currPos + currVel) then
cloneSig = currPos
else cloneSig = currPos + currVel end
-- position bound
cloneSig = Vector(
math.min(math.max(cloneSig.X, 70), 70 + sData.Width * 38.5),
math.min(math.max(cloneSig.Y, 150), 150 + sData.Height * 38.5))
clone.Position = cloneSig
-- move laser
local fc = Game():GetFrameCount()
if fc % 2 == 0 and #lastShotLaser ~= 0 then
for _,v in pairs(lastShotLaser) do
v.Position = cloneSig
end
end
-- shoot with clone
local frate = player.MaxFireDelay
if player:GetSubPlayer() then frate = math.min(player.MaxFireDelay, player:GetSubPlayer().MaxFireDelay) end
if fc % math.floor(frate * 3) == 0 then canShootCharged[playerID + 1] = true end
if fc % math.floor(frate * 6) == 0 then canShootChargedLong[playerID + 1] = true end
local xShoot = shootX[playerID + 1]
local yShoot = shootY[playerID + 1]
if (xShoot ~= 0 or yShoot ~= 0) and (fc % math.floor(frate) == 0) and counter <= 345 then
local chargeFlag = false
local longChargeFlag = false
local spread = player:HasCollectible(CollectibleType.COLLECTIBLE_20_20) and 5 or 10
for i = 1, shotmultiplier do
local projectile = nil
if weaponType[playerID + 1] == 1 then -- regular tears
local dir = Vector(0, 0)
local spawnPos = currPos
if xShoot ~= 0 then
dir = Vector(xShoot * player.ShotSpeed * 10,
(shotmultiplier % 2 == 0 and (i - shotmultiplier / 2 == 1 or i == shotmultiplier / 2)) and 0
or TimeSplice:pow((i - math.floor((shotmultiplier + 1) / 2)) * player.ShotSpeed * 5,
spread / (100 * shotmultiplier)))
spawnPos = spawnPos + Vector(0, (i - (shotmultiplier + 1) / 2) * spread)
else
dir = Vector((shotmultiplier % 2 == 0 and (i - shotmultiplier / 2 == 1 or i == shotmultiplier / 2)) and 0
or TimeSplice:pow((i - math.floor((shotmultiplier + 1) / 2)) * player.ShotSpeed * 5,
spread / (100 * shotmultiplier)),
yShoot * player.ShotSpeed * 10)
spawnPos = spawnPos + Vector((i - (shotmultiplier + 1) / 2) * spread, 0)
end
projectile = Isaac.Spawn(EntityType.ENTITY_TEAR, 0, 0, spawnPos, dir, nil):ToTear()
projectile.FallingAcceleration = player.TearFallingAcceleration
projectile.FallingSpeed = player.TearFallingSpeed
projectile.Height = player.TearHeight
projectile.CollisionDamage = player.Damage
elseif weaponType[playerID + 1] == 2 then -- lasers
local laserType = TimeSplice:getLaserVariant(player)
if canShootCharged[playerID + 1] or not TimeSplice:hasChargeWeapon(player) then
projectile = Isaac.Spawn(EntityType.ENTITY_LASER, laserType,
0, currPos, Vector(0, 0), nil):ToLaser()
projectile.Angle = TimeSplice:rotate(xShoot, yShoot) + (i - (shotmultiplier + 1) / 2) * 8
projectile:SetTimeout(laserType == 2 and 5 or 20)
--projectile:SetColor(Color(1, 1, 1, 2, 100, 0, 0), 0, 0, false, false)
projectile.CollisionDamage = player.Damage
projectile:SetMaxDistance(laserRange[playerID + 1])
lastShotLaser[i] = projectile
chargeFlag = true
end
elseif weaponType[playerID + 1] == 3 then -- knives
local f = false
for _,v in pairs(Isaac.GetRoomEntities()) do
if v:IsEnemy() then
if canShootChargedLong[playerID + 1] then
local entPos = v.Position
if ((xShoot == 1 and entPos.X > currPos.X) or (xShoot == -1 and entPos.X < currPos.X)) and
math.abs(entPos.Y - currPos.Y) < 20 then
v:TakeDamage(player.Damage * 5, 0, EntityRef(player), 0)
f = true
elseif ((yShoot == 1 and entPos.Y > currPos.Y) or (yShoot == -1 and entPos.Y < currPos.Y)) and
math.abs(entPos.X - currPos.X) < 20 then
v:TakeDamage(player.Damage * 5, 0, EntityRef(player), 0)
f = true
end
end
if v.Position:Distance(currPos) < firerange then
v:TakeDamage(player.Damage * 10, 0, EntityRef(player), 0)
end
end
end
if f then longChargeFlag = true end
elseif weaponType[playerID + 1] == 4 then -- bombs
if canShootCharged[playerID + 1] then
projectile = Isaac.Spawn(EntityType.ENTITY_BOMB, 0, 0, currPos +
Vector((i - (shotmultiplier + 1) / 2) * 5, (i - (shotmultiplier + 1) / 2) * 5),
Vector(xShoot * player.ShotSpeed * 10, yShoot * player.ShotSpeed * 10), nil):ToBomb()
projectile:SetExplosionCountdown(30)
projectile.ExplosionDamage = player.Damage * 10
chargeFlag = true
end
elseif weaponType[playerID + 1] == 5 then -- rockets (+epic fetus)
if closestEnemy == nil then
local temp = nil
for _,v in pairs(Isaac.GetRoomEntities()) do
local dist = v.Position:Distance(currPos)
if v.Index ~= clone.Index and v:IsEnemy() and
(not temp or dist < temp.Position:Distance(currPos)) then
temp = v
end
end
closestEnemy = temp
end
if canShootChargedLong[playerID + 1] then
projectile = Isaac.Spawn(EntityType.ENTITY_BOMB, 0, 0, closestEnemy.Position,
Vector(0, 0), nil):ToBomb()
projectile.ExplosionDamage = player.Damage * 20
projectile:SetExplosionCountdown(0)
longChargeFlag = true
if not closestEnemy:Exists() then closestEnemy = nil end
end
end
if projectile then
projectile:AddTearFlags(player.TearFlags)
if correctionFactor > 60 then projectile:AddTearFlags(TearFlags.TEAR_SPECTRAL) end
end
end
if chargeFlag then canShootCharged[playerID + 1] = false end
if longChargeFlag then canShootChargedLong[playerID + 1] = false end
end
---------------------------------------------
-----------------AI CODE---------------------
---------------------------------------------
--check if the current player is set to AI enabled
multisettingmin = 0
--workaround for tainted soul/forgotten
if REPENTANCE then
if player:GetPlayerType() == 40 and playerID == 1 then
moveX[playerID+1] = 0
moveY[playerID+1] = 0
shootX[playerID+1] = 0
shootY[playerID+1] = 0
return
end
end
--prevent AI from trying to do stuff that isn't possible (co-op babies are limited)
local activecharacter = true
if not InfinityTrueCoopInterface and not REPENTANCE then
activecharacter = false
end
if REPENTANCE and player.Variant == 1 then
activecharacter = false
end
if playerID == 0 then
activecharacter = true
end
if activecharacter == false then
if getPickups > 1 then
getPickups = 1
end
if usePillsCards > 1 then
usePillsCards = 1
end
if getItems > 1 then
getItems = 1
end
if getTrinkets > 1 then
getTrinkets = 1
end
if useItems > 1 then
useItems = 1
end
if moveToDoors > 1 then
moveToDoors = 1
end
if bombThings > 1 then
bombThings = 1
end
if usebeggarsandmachines > 1 then
usebeggarsandmachines = 1
end
if goesshopping > 1 then
goesshopping = 1
end
if takesdevildeals > 1 then
takesdevildeals = 1
end
end
--check for player1 only settings
if playerID > 0 then
multisettingmin = 1
end
--handle AI behaviour
ignoreenemiesitems = false
currentRoom:InvalidatePickupVision()
--get entity positions and determine actions
pickupdistance = 9999999999
enemydistance = 9999999999
highestshopprice = -1
moveX[playerID+1] = 0
moveY[playerID+1] = 0
shootX[playerID+1] = 0
shootY[playerID+1] = 0
local topleft = currentRoom:GetTopLeftPos()
local bottomright = currentRoom:GetBottomRightPos()
local topright = Vector(bottomright.X,topleft.Y)
local bottomleft = Vector(topleft.X,bottomright.Y)
local tilecount = currentRoom:GetGridSize()
local keycount = player:GetNumKeys()
local bombcount = player:GetNumBombs()
if keycount == 0 and player:HasGoldenKey() then
keycount = 1
end
if player:HasCollectible(380) then
keycount = player:GetNumCoins()
end
if bombcount == 0 and player:HasGoldenBomb() then
bombcount = 1
end
--if in mega satan room move up to start the battle
if Game():GetLevel():GetCurrentRoomDesc().GridIndex == -1 and currentRoom:GetType() == 5 and currPos.Y > currentRoom:GetCenterPos().Y then
moveY[playerID+1] = -1
end
--go to another room when clear
if moveToDoors > multisettingmin then
if currentRoom:IsClear() and ignoreenemiesitems == false then
--go through doors
local angelroom = false
local roomcheckcount = 9999999999
for i = 0, 7 do
local door = currentRoom:GetDoor(i)
if not door then
--no door at this position
elseif door:IsRoomType(RoomType.ROOM_CURSE) and currentRoom:GetType() ~= RoomType.ROOM_CURSE and (Game():GetLevel():GetRoomByIdx(door.TargetRoomIndex).VisitedCount > 0 or player:GetHearts() + player:GetSoulHearts() < 6) then
--dont waste health on curse doors
elseif door:IsOpen() == false and (door:IsRoomType(RoomType.ROOM_SECRET) or door:IsRoomType(RoomType.ROOM_SUPERSECRET)) then
--dont go for hidden secret room doors
else
if door:IsOpen() or ((door:IsRoomType(RoomType.ROOM_TREASURE) or door:IsRoomType(RoomType.ROOM_LIBRARY) or (goesshopping > multisettingmin and door:IsRoomType(RoomType.ROOM_SHOP))) and keycount > 0) or (door:IsRoomType(RoomType.ROOM_ARCADE) and player:GetNumCoins() > 0) then
--get door to room visited the least times
if Game():GetLevel():GetRoomByIdx(door.TargetRoomIndex).VisitedCount <= roomcheckcount or (Game():IsGreedMode() and Game():GetLevel():GetCurrentRoomDesc().GridIndex == 84 and door:IsOpen() and i == 3) or (Game():GetLevel():GetRoomByIdx(door.TargetRoomIndex).VisitedCount == 0 and (door:IsRoomType(RoomType.ROOM_DEVIL) or door:IsRoomType(RoomType.ROOM_ANGEL) or ((door:IsRoomType(RoomType.ROOM_TREASURE) or (goesshopping > multisettingmin and door:IsRoomType(RoomType.ROOM_SHOP))) and (door:IsOpen() or keycount > 0)) or (door:IsRoomType(RoomType.ROOM_ARCADE) and (door:IsOpen() or player:GetNumCoins() > 0)))) then
roomcheckcount = Game():GetLevel():GetRoomByIdx(door.TargetRoomIndex).VisitedCount
--go for angel rooms
if roomcheckcount == 0 and (door:IsRoomType(RoomType.ROOM_ANGEL) or door:IsRoomType(RoomType.ROOM_DEVIL)) then
roomcheckcount = -5
angelroom = true
end
--go for treasure rooms
if roomcheckcount == 0 and door:IsRoomType(RoomType.ROOM_TREASURE) and (door:IsOpen() or keycount > 0) then
roomcheckcount = -5
end
--go for arcade rooms
if roomcheckcount == 0 and door:IsRoomType(RoomType.ROOM_ARCADE) and (door:IsOpen() or player:GetNumCoins() > 0) then
roomcheckcount = -5
end
--go for shops and libraries
if roomcheckcount == 0 and ((door:IsRoomType(RoomType.ROOM_SHOP) and goesshopping > multisettingmin) or door:IsRoomType(RoomType.ROOM_LIBRARY)) and (door:IsOpen() or keycount > 0) then
roomcheckcount = -5
end
--go for secret rooms
if roomcheckcount == 0 and (door:IsRoomType(RoomType.ROOM_SECRET) or door:IsRoomType(RoomType.ROOM_SUPERSECRET)) and door:IsOpen() then
roomcheckcount = -5
end
--go for mega satans room
if roomcheckcount == 0 and Game():GetLevel():GetStage() == 11 and Game():GetLevel():GetCurrentRoomDesc().GridIndex == 84 and door:IsRoomType(RoomType.ROOM_BOSS) then
roomcheckcount = -5
end
--go for greed mode floor exit
if Game():IsGreedMode() and Game():GetLevel():GetCurrentRoomDesc().GridIndex == 84 and door:IsOpen() and i == 3 and greedmodecooldown < 1 then
roomcheckcount = -5
greedexitopen = true
end
--move towards chosen door
local doorpos = door.Position
local leeway = door.Position:Distance(currPos)*0.5
if leeway > 40 then
leeway = 40
end
moveX[playerID+1] = 0
moveY[playerID+1] = 0
TimeSplice:simplemovetowards(currPos, doorpos, leeway)
end
end
end
end
--check for crawlspace exit
if currentRoom:GetType() == 16 then
visitedcrawlspace = true
moveX[playerID+1] = -1
moveY[playerID+1] = -1
end
--check for hush door
if (Game():GetLevel():GetCurrentRoomDesc().VisitedCount > 3 or keycount < 1) and Game():GetLevel():GetStage() == 9 and currentRoom:GetType() ~= RoomType.ROOM_TREASURE then
TimeSplice:simplemovetowards(currPos, currentRoom:GetCenterPos().X, 0)
moveY[playerID+1] = -1
end
--go for trapdoor
if (currentRoom:GetType() == RoomType.ROOM_BOSS and angelroom == false) or (Game():IsGreedMode() and Game():GetLevel():GetCurrentRoomDesc().GridIndex == 110) then
local trapdooristhere = false
for g = 1, tilecount do
if currentRoom:GetGridEntity(g) ~= nil then
local gridEntity = currentRoom:GetGridEntity(g)
if gridEntity:GetType() == 17 then
trapdooristhere = true
end
end
end
if trapdooristhere then
local trapdoorpos = currentRoom:GetCenterPos()
local leeway = trapdoorpos:Distance(currPos)*0.5
if leeway > 40 then
leeway = 40
end
moveX[playerID+1] = 0
TimeSplice:simplemovetowards(currPos, trapdoorpos, leeway)
moveY[playerID+1] = 1
if trapdoorpos.Y < currPos.Y then
bossroom = true
end
if trapdoorpos.Y > currPos.Y + 60 then
bossroom = false
end
if bossroom then
moveY[playerID+1] = -1
end
end
else
bossroom = false
end
--take trapdoor in black market
if currentRoom:GetType() == RoomType.ROOM_BLACK_MARKET then
for g = 1, tilecount do
if currentRoom:GetGridEntity(g) ~= nil then
local gridEntity = currentRoom:GetGridEntity(g)
if gridEntity:GetType() == 17 then
moveX[playerID+1] = 0
moveY[playerID+1] = 0
TimeSplice:simplemovetowards(currPos, gridEntity.Position, 0)
end
end
end
end
end
end
--check room for poops, rocks and buttons
if bombcooldown > 0 then
bombcooldown = bombcooldown - 1
end
if (shootPoops and currentRoom:IsClear()) or (bombThings > multisettingmin and bombcount > 0 and currentRoom:IsClear()) or (pressButtons > multisettingmin and currentRoom:HasTriggerPressurePlates() and currentRoom:IsClear() == false) or (moveToDoors > multisettingmin and currentRoom:IsClear()) then
for i = 1, tilecount do
if currentRoom:GetGridEntity(i) ~= nil then
local gridEntity = currentRoom:GetGridEntity(i)
local gridReact = -1
if currentRoom:IsClear() and shootPoops and gridEntity:GetType() == 14 and gridEntity.State ~= 4 and gridEntity.State ~= 1000 and gridEntity:GetVariant() ~= 1 then
gridReact = 0
elseif currentRoom:IsClear() and bombThings > multisettingmin and bombcount > 0 and (gridEntity:GetType() == 4 or gridEntity:GetType() == 22) and gridEntity:ToRock() ~= nil and gridEntity.State ~= 2 then
gridReact = 1
elseif currentRoom:IsClear() == false and pressButtons > multisettingmin and gridEntity:GetType() == 20 and gridEntity.State ~= 3 then
gridReact = 2
elseif currentRoom:IsClear() and moveToDoors > multisettingmin and gridEntity:GetType() == 18 and visitedcrawlspace == false then
gridReact = 3
end
if gridReact > -1 then
moveX[playerID+1] = 0
moveY[playerID+1] = 0
local xdiff = math.abs(gridEntity.Position.X - currPos.X)
local ydiff = math.abs((gridEntity.Position.Y+5) - currPos.Y)
if xdiff > 45 or ydiff > 45 or gridReact == 3 then
local temppooppos = gridEntity.Position
temppooppos.Y = temppooppos.Y+5
TimeSplice:simplemovetowards(currPos, temppooppos, 5)
elseif xdiff < 30 and ydiff < 30 then --dont stand right on top of it
if xdiff > ydiff then
if gridEntity.Position.X < currPos.X then
moveX[playerID+1] = 1
else
moveX[playerID+1] = -1
end
else
if gridEntity.Position.Y+5 < currPos.Y then
moveY[playerID+1] = 1
else
moveY[playerID+1] = -1
end
end
end
if gridReact == 0 then --shoot at poops
if ydiff < shoottolerance and ydiff < xdiff then
if gridEntity.Position.X > currPos.X then
shootX[playerID+1] = 1
else
shootX[playerID+1] = -1
end
end
if xdiff < shoottolerance and xdiff < ydiff then
if gridEntity.Position.Y > currPos.Y then
shootY[playerID+1] = 1
else
shootY[playerID+1] = -1
end
end
--aim ludovico
if player:HasWeaponType(WeaponType.WEAPON_LUDOVICO_TECHNIQUE) and player:GetActiveWeaponEntity() ~= nil then
local ludotear = player:GetActiveWeaponEntity()
if gridEntity.Position.X > ludotear.Position.X then
shootX[playerID+1] = 1
else
shootX[playerID+1] = -1
end
if gridEntity.Position.Y > ludotear.Position.Y then
shootY[playerID+1] = 1
else
shootY[playerID+1] = -1
end
end
--if at a tinted rock bomb it
elseif gridReact == 1 and bombcooldown < 1 and bombcount > 3 and gridEntity:ToRock() ~= nil and gridEntity.State ~= 2 and gridEntity.Position:Distance(currPos) < 60 then
TimeSplice:bomb(player)
end
end
end
end
end
--go for greed button
if Game():IsGreedMode() and Game():GetLevel():GetCurrentRoomDesc().GridIndex == 84 then
if currentRoom:GetAliveEnemiesCount() == 0 and currentRoom:GetAliveBossesCount() == 0 then
greedmodecooldown = greedmodecooldown - 1
if pressButtons > multisettingmin and greedmodecooldown < 1 and greedexitopen == false then
TimeSplice:simplemovetowards(currPos, greedmodebuttonpos, 10)
end
end
end
--check room for relevant entities (enemies, projectiles and pickups)
local entities = Isaac.GetRoomEntities()
for ent = 1, #entities do
local entity = entities[ent]
------------------------------------------------
if (entity.Type == EntityType.ENTITY_TEAR or entity.Type == EntityType.ENTITY_BOMB) then
if currentRoom:GetGridCollisionAtPos(entity.Position) == GridCollisionClass.COLLISION_SOLID then
local gridEnt = currentRoom:GetGridEntityFromPos(entity.Position)
if gridEnt and gridEnt:ToPoop() == nil then
local idx = gridEnt:GetGridIndex()
local val = gridEntOnCol[idx]
if not val then
val = 10
gridEntOnCol[idx] = 10
local correction = (entity.Position - clone.Position)
if correction:Length() < firerange then
cloneSig = cloneSig + correction:Resized(correctionFactor)
correctionFactor = correctionFactor + 10
end
end
end
end
end
-- set target to newly spawned enemies
if entity:IsEnemy() and entity.Type ~= EntityType.ENTITY_FIREPLACE and entity.Target ~= clone then
--TimeSplice:SetTarget(entity, clone)
entity.Target = clone
end
if entity.Type == EntityType.ENTITY_FAMILIAR then
--entity:ToFamiliar().FireCooldown = 1000
end
------------------------------------------------
if (entity:IsDead() == false or entity.Type == 7) and (entity.Type == 231 and entity.Variant == 700 and entity.SubType == 700) == false then
local xdiff = math.abs(entity.Position.X - currPos.X)
local ydiff = math.abs(entity.Position.Y - currPos.Y)
--shoot poops
if shootPoops and entity.Type == 245 and entity.HitPoints > 1 then
TimeSplice:simplemovetowards(currPos, entity.Position, 0)
if ydiff < shoottolerance and ydiff < xdiff then
if entity.Position.X > currPos.X then
shootX[playerID+1] = 1
else
shootX[playerID+1] = -1
end
end
if xdiff < shoottolerance and xdiff < ydiff then
if entity.Position.Y > currPos.Y then
shootY[playerID+1] = 1
else
shootY[playerID+1] = -1
end
end
--aim ludovico
if player:HasWeaponType(WeaponType.WEAPON_LUDOVICO_TECHNIQUE) and player:GetActiveWeaponEntity() ~= nil then
local ludotear = player:GetActiveWeaponEntity()
if entity.Position.X > ludotear.Position.X then
shootX[playerID+1] = 1
else
shootX[playerID+1] = -1
end
if entity.Position.Y > ludotear.Position.Y then
shootY[playerID+1] = 1
else
shootY[playerID+1] = -1
end
end
end
--pick up items
if getPickups > multisettingmin and entity.Type == 5 and ignoreenemiesitems == false and (entity.Variant == 10 and (entity.SubType < 3 or entity.SubType == 5 or entity.SubType == 9) and player:GetHearts() == player:GetEffectiveMaxHearts()) == false and entity:ToPickup():IsShopItem() == false then
if (entity.Variant == 100 and entity.SubType == 0) == false and (entity.Variant == 50 and entity.SubType == 0) == false and (entity.Variant ~= 51 or (bombThings > multisettingmin and entity.Variant == 51 and bombcount > 0 and entity.SubType == 1)) and entity.Variant ~= 52 and entity.Variant ~= 53 and entity.Variant ~= 54 and entity.Variant ~= 58 and (entity.Variant ~= 60 or (entity.Variant == 60 and player:GetNumKeys() > 0 and entity.SubType == 1)) and (entity.Variant == 360 and entity.SubType == 0) == false then
if (usePillsCards <= multisettingmin or player:GetCard(0) > 0) and entity.Variant == 300 then
--dont get cards or runes
if entity.Position:Distance(currPos) < 70 then
TimeSplice:goaround(currPos, entity.Position, 35)
end
elseif entity.Variant == 300 and entity.SubType == 46 then
--dont pick up suicide king
if entity.Position:Distance(currPos) < 70 then
TimeSplice:goaround(currPos, entity.Position, 35)
end
elseif (usePillsCards <= multisettingmin or player:GetPill(0) > 0) and entity.Variant == 70 then
--dont get pills
if entity.Position:Distance(currPos) < 70 then
TimeSplice:goaround(currPos, entity.Position, 35)
end
elseif getItems <= multisettingmin and entity.Variant == 100 then
--dont get passive items
if entity.Position:Distance(currPos) < 70 then
TimeSplice:goaround(currPos, entity.Position, 35)
end
elseif entity.Variant == 90 and (entity.SubType == BatterySubType.BATTERY_GOLDEN or
player:NeedsCharge() == false or player:GetActiveCharge() == activeItemCharges[playerID + 1]) then
--dont get batteries
elseif getItems > multisettingmin and (useItems <= multisettingmin or player:GetActiveItem() > 0) and entity.Variant == 100 and Isaac.GetItemConfig():GetCollectible(entity.SubType).Type == 3 then
--dont get active items
if entity.Position:Distance(currPos) < 70 then
TimeSplice:goaround(currPos, entity.Position, 35)
end
elseif entity.Variant == 20 and entity.SubType == 6 and (bombcount < 1 or bombThings <= multisettingmin) then
--dont get stuck on sticky nickels
elseif entity.Variant == 350 and (player:GetTrinket(0) > 0 or getTrinkets <= multisettingmin) then
--dont go for trinkets if already have one
if entity.Position:Distance(currPos) < 70 then
TimeSplice:goaround(currPos, entity.Position, 35)
end
elseif entity.Variant == 10 and player:CanPickSoulHearts() == false and (entity.SubType == 3 or entity.SubType == 6 or entity.SubType == 8) then
--dont grab health if full
elseif entity.Variant == 10 and player:CanPickBoneHearts() == false and entity.SubType == 11 then
--dont grab health if full
elseif entity.Variant == 380 and (entity:ToPickup().Touched or (player:CanPickRedHearts() == false and player:GetEffectiveMaxHearts() > 0) or (player:CanPickSoulHearts() == false and player:GetEffectiveMaxHearts() == 0)) then
--dont go for beds if they cant be used
elseif entity.Variant == 99 and (player:GetNumCoins() < 1 or entity.SubType == 0) then
--dont go for paychests if not enough coins
------------------------------------------------
elseif entity.Variant >= 51 and entity.Variant <= 60 and entity.Variant ~= 56 then
-- dont go for any chest but regular and wooden chest
elseif entity.Variant == PickupVariant.PICKUP_THROWABLEBOMB then
-- dont go for throwables
elseif entity.Variant == PickupVariant.PICKUP_GRAB_BAG then
-- dont go for sacks (unintended)
------------------------------------------------
else
local distance = entity.Position:Distance(currPos)
--get closest item
if distance < pickupdistance then
if currentRoom:IsClear() then
moveX[playerID+1] = 0
moveY[playerID+1] = 0
end
pickupdistance = distance
if distance > 15 then
TimeSplice:simplemovetowards(currPos, entity.Position, 10)
else
TimeSplice:takePickup(entity:ToPickup(), player)
end
--let ai move away from paychest to be able to pay more
if entity.Variant == 99 and entity:GetSprite():IsPlaying("Pay") and entity.Position:Distance(currPos) < 70 then
TimeSplice:simplemoveaway(currPos, entity.Position, 10)
end
--bomb stone chests and sticky nickels
if bombThings > multisettingmin and ((entity.Variant == 51 and entity.SubType == 1) or (entity.Variant == 20 and entity.SubType == 6)) and bombcount > 3 and bombcooldown < 1 and distance < 40 then
TimeSplice:bomb(player)
end
end
end
end
end
--buy stuff at shops
if goesshopping > multisettingmin and entity.Type == 5 and entity:ToPickup():IsShopItem() and entity:ToPickup().Price > -1 then
local itemprice = entity:ToPickup().Price
--get most expensive item player can afford
if entity.Variant == 100 and getItems <= multisettingmin then
--dont buy items if take items is false
if entity.Position:Distance(currPos) < 70 then
TimeSplice:goaround(currPos, entity.Position, 35)
break
end
elseif (getItems <= multisettingmin or useItems <= multisettingmin or player:GetActiveItem() > 0) and entity.Variant == 100 and Isaac.GetItemConfig():GetCollectible(entity.SubType).Type == 3 then
--dont buy active items
if entity.Position:Distance(currPos) < 70 then
TimeSplice:goaround(currPos, entity.Position, 35)
break
end
elseif entity.Variant == 10 and player:CanPickSoulHearts() == false and (entity.SubType == 3 or entity.SubType == 6 or entity.SubType == 8) then
--dont buy soul hearts if no room
elseif entity.Variant == 10 and player:CanPickRedHearts() == false and (entity.SubType < 3 or entity.SubType == 5 or entity.SubType == 9) then
--dont buy red hearts if no room
elseif entity.Variant == 90 and player:GetActiveCharge() == activeItemCharges[playerID + 1] then
--dont buy batteries if no active or active fully charged
elseif itemprice > highestshopprice and itemprice <= player:GetNumCoins() then
if currentRoom:IsClear() then
moveX[playerID+1] = 0
moveY[playerID+1] = 0
end
highestshopprice = itemprice
TimeSplice:simplemovetowards(currPos, entity.Position, 0)
end
end
--take devil deals
if entity.Type == 5 and entity:ToPickup().Price < 0 then
--check for active items
local takeactiveitem = true
if entity.Variant == 100 and getItems <= multisettingmin then
takeactiveitem = false --dont take items if disabled
elseif entity.Variant == 100 and Isaac.GetItemConfig():GetCollectible(entity.SubType).Type == 3 and (useItems <= multisettingmin or player:GetActiveItem() > 0) then
takeactiveitem = false --dont take actives if cant use them or already has one
end
local itemprice = 0-entity:ToPickup().Price
if takesdevildeals > multisettingmin and itemprice == 3 and player:GetSoulHearts() > 20 and takeactiveitem then
TimeSplice:simplemovetowards(currPos, entity.Position, 0)
if pickupdistance == 9999999999 then
pickupdistance = 999999
end
elseif takesdevildeals > multisettingmin and player:GetMaxHearts() > itemprice*4 + 2 and takeactiveitem then
TimeSplice:simplemovetowards(currPos, entity.Position, 0)
if pickupdistance == 9999999999 then
pickupdistance = 999999
end
elseif entity.Position:Distance(currPos) < 70 then
--avoid the item to not lose health accidentally
TimeSplice:goaround(currPos, entity.Position, 35)
end
end
--use beggars/machines
if entity.Type == 6 and entity:GetSprite():IsPlaying("Broken") == false and entity:GetSprite():IsFinished("Broken") == false and entity:GetSprite():IsPlaying("CoinJam") == false and entity:GetSprite():IsFinished("CoinJam") == false and entity:GetSprite():IsPlaying("CoinJam2") == false and entity:GetSprite():IsFinished("CoinJam2") == false and entity:GetSprite():IsPlaying("CoinJam3") == false and entity:GetSprite():IsFinished("CoinJam3") == false and entity:GetSprite():IsPlaying("CoinJam4") == false and entity:GetSprite():IsFinished("CoinJam4") == false then
if entity.Variant == 93 and (entity:GetSprite():IsPlaying("PayPrize") or entity:GetSprite():IsPlaying("PayNothing")) and entity:GetSprite():GetFrame() < 9 then
--check for dead beggar
else
--machines/beggard to avoid
if entity.Position:Distance(currPos) < 80 then
if entity.Variant == 2 or entity.Variant == 5 or entity.Variant == 10 or entity.Variant == 94 then
TimeSplice:goaround(currPos, entity.Position, 35)
end
end
--machines/beggars to move towards
if ((entity.Variant == 1 or entity.Variant == 4 or entity.Variant == 6 or entity.Variant == 8 or entity.Variant == 11) and usebeggarsandmachines > multisettingmin and player:GetNumCoins() > 0) or ((entity.Variant == 2 or entity.Variant == 3 or entity.Variant == 5 or entity.Variant == 12) and bombcount > 0 and bombThings > multisettingmin) or (usebeggarsandmachines > multisettingmin and entity.Variant == 7 and player:GetNumKeys() > 0) or (usebeggarsandmachines > multisettingmin and entity.Variant == 9 and player:GetNumBombs() > 0) or (usebeggarsandmachines > multisettingmin and entity.Variant == 93 and player:GetSoulHearts() > 0) then
TimeSplice:simplemovetowards(currPos, entity.Position, 0)
if pickupdistance == 9999999999 then
pickupdistance = 999999
end
end
--give shell game beggar space to spawn flies
if entity.Position:Distance(currPos) < 70 then
if entity:GetSprite():IsPlaying("Shell1Prize") or entity:GetSprite():IsPlaying("Shell2Prize") or entity:GetSprite():IsPlaying("Shell3Prize") then
TimeSplice:simplemoveaway(currPos, entity.Position, 0)
end
end
end
end
--shoot at fires and tnt barrels
if shootFires and entity.Type == 33 and entity.HitPoints > 1 and entity.Variant < 2 then
if currentRoom:IsClear() then
moveX[playerID+1] = 0
moveY[playerID+1] = 0
end
local distance = entity.Position:Distance(currPos)
if currentRoom:IsClear() and distance > firerange then
TimeSplice:simplemovetowards(currPos, entity.Position, 10)
end
if distance < firerange+10 then
if ydiff < shoottolerance then
if entity.Position.X > currPos.X then
shootX[playerID+1] = 1
else
shootX[playerID+1] = -1
end
end
if xdiff < shoottolerance then
if entity.Position.Y > currPos.Y then
shootY[playerID+1] = 1
else
shootY[playerID+1] = -1
end
end
end
--aim ludovico
if enemydistance == 9999999999 and player:HasWeaponType(WeaponType.WEAPON_LUDOVICO_TECHNIQUE) and player:GetActiveWeaponEntity() ~= nil then
local ludotear = player:GetActiveWeaponEntity()
if entity.Position.X > ludotear.Position.X then
shootX[playerID+1] = 1
else
shootX[playerID+1] = -1
end
if entity.Position.Y > ludotear.Position.Y then
shootY[playerID+1] = 1
else
shootY[playerID+1] = -1
end
end
end
--bomb blue/purple fires
if bombThings > multisettingmin and entity.Type == 33 and entity.HitPoints > 1 and entity.Variant > 1 and entity.Variant ~= 4 and bombcooldown < 1 and bombcount > 3 then
if currentRoom:IsClear() then
moveX[playerID+1] = 0
moveY[playerID+1] = 0
end
local distance = entity.Position:Distance(currPos)
if currentRoom:IsClear() and distance > firerange-20 then
TimeSplice:simplemovetowards(currPos, entity.Position, 10)
end
if distance < firerange then
TimeSplice:bomb(player)
end
end
--dont run into fires
if avoidDangers and entity.Type == 33 and entity.HitPoints > 1 then
local distance = entity.Position:Distance(currPos)
if distance < firerange then
ignoreenemiesitems = true
if math.abs(entity.Position.X - currPos.X) > math.abs(entity.Position.Y - currPos.Y) then
moveY[playerID+1] = 0
if entity.Position.X < currPos.X then
moveX[playerID+1] = 1
else
moveX[playerID+1] = -1
end
else
moveX[playerID+1] = 0
if entity.Position.Y < currPos.Y then
moveY[playerID+1] = 1
else
moveY[playerID+1] = -1
end
end
end
end