-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmr.lua
2259 lines (1867 loc) · 60.7 KB
/
mr.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
if not game:IsLoaded() then game.Loaded:Wait() end
if game.PlaceId ~= 4490140733 then return end
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local Library = require(game:GetService("ReplicatedStorage"):WaitForChild("Framework"):WaitForChild("Library"))
assert(Library, "Oopps! Library has not been loaded. Maybe try re-joining?")
while not Library.Loaded do wait() end
function GetPath(...)
local path = {...}
local oldPath = Library
if path and #path > 0 then
for _,v in ipairs(path) do
oldPath = oldPath[v]
end
end
return oldPath
end
-------
-------------------------//
--// Libraries
-------------------------//
local Food = GetPath("Food")
local Entity = GetPath("Entity")
local Customer = GetPath("Customer")
local Waiter = GetPath("Waiter")
local Appliance = GetPath("Appliance")
local Bakery = GetPath("Bakery")
local Gamepasses = GetPath("Gamepasses")
local Network = GetPath("Network")
------------------//
--// Variables
-------------------------//
local StartTick = tick()
local Player = Players.LocalPlayer
local StoreTeleports = {}
local PlayerTeleports = {}
local Wells = {"101","49","50"}
local Slots = {"57"}
local FurnituresCooldowns = {}
-- Settings Variables
local FastWaiter = false
local GoldFood = false
local AutoGift = false
local FastOrder = false
local FastNPC = false
local TeleportNPC = false
local NPCSpeed = 100
local AutoInteract = false
local AutoBuyWorkers = false
local AutoBlacklist = false
local AutoCloseRestaurant = false
local AutoCloseEvery = 600
local LastTimeClose = 0
--// Force better customer
local ForceCustomers = false
local ForceVIP = false
local ForcePirate = false
local ForceYoutuber = false
local ForceHeadless = false
local ForceCorruptedVIP = false
local ForceSanta = false
local ForceElf = false
local ForceLifeguard = false
local ForceAlien = false
local ForcePrincess = false
local ForceSuperHero = false
local InstantCook = false
local InstantEat = false
local InstantWash = false
local IS_DEV_MODE = true
local PRINT_NETWORK = false
local OptimizedMode = false
-------------------------//
--// Overwrite Functions
-------------------------//
local Original_EntityNew = Entity.new
Entity.new = function(id, uid, entityType, p4, p5)
local entity = Original_EntityNew(id, uid, entityType, p4, p5)
-- if entityType == "Customer" then
-- entity.model:Destroy()
-- end
if entityType == "Customer" and OptimizedMode then
pcall(function()
if entity and entity.model and entity.model:FindFirstChild("Humanoid") then
entity.model.Humanoid:RemoveAccessories()
end
end)
end
--print(id, uid, entityType, p4, p5)
return entity
end
local Original_StartWashingDishes = Appliance.StartWashingDishes
Appliance.StartWashingDishes = function(appliance)
if not InstantWash then Original_StartWashingDishes(appliance) return end
if appliance.stateData.isWashingDishes then
return
end
appliance.stateData.isWashingDishes = true
coroutine.wrap(function()
while not appliance.isDeleted and appliance.stateData.numberDishes > 0 do
appliance.stateData.dishStartTime = tick()
appliance.stateData.dishwasherUI.Enabled = true
wait(0.05)
appliance:RemoveDish()
end
if appliance.isDeleted then
return
end
if not appliance.isDeleted then
appliance.stateData.dishwasherUI.Frame.DishProgress.Bar.Size = UDim2.new(0, 0, 1, 0)
appliance.stateData.dishwasherUI.Enabled = false
end
appliance.stateData.isWashingDishes = false
if appliance.stateData.washingLoopSound then
appliance.stateData.washingLoopSound:Destroy()
appliance.stateData.washingLoopSound = nil
end
end)()
end
local Original_ChangeToReadyToExitState = Customer.ChangeToReadyToExitState
Customer.ChangeToReadyToExitState = function(customer, forceToLeaveATip)
if InstantEat then
Original_ChangeToReadyToExitState(customer, true)
else
Original_ChangeToReadyToExitState(customer, forceToLeaveATip)
end
end
local Original_AddCustomersToQueueIfNecessary = Bakery.AddCustomersToQueueIfNecessary
Bakery.AddCustomersToQueueIfNecessary = function(bakery, kickCustomerIfNecessary, UIDBatch)
if not ForceCustomers then return Original_AddCustomersToQueueIfNecessary(bakery, kickCustomerIfNecessary, UIDBatch) end
if #bakery.customerQueue >= 4 then
return 0
end
local firstFloor = bakery.floors[1]
local selectedTable, selectedSeatGroup
local indices = Library.Functions.RandomIndices(Library.Variables.MyBakery.floors)
for _, index in ipairs(indices) do
if index and tonumber(index) and index > 0 then
local floor = bakery.floors[index]
selectedTable, selectedSeatGroup = floor:GetAvailableSeatGroupings()
if selectedTable and selectedSeatGroup then
break
end
end
end
if not (selectedTable and selectedSeatGroup) then
if kickCustomerIfNecessary then
local didKickCustomer = false
for _, floor in ipairs(bakery.floors) do
for _, customer in ipairs(floor.customers) do
if customer.state ~= "ReadyToExit" then
customer:ForcedToLeave()
didKickCustomer = true
break
end
end
if didKickCustomer then
break
end
end
end
return 0
end
local queueEntry = {}
local didPlayVIPCustomerSound = false
local vipOverride = {}
local pirateOverride = {}
local youtuberOverride = {}
local shadowOverride = {}
local corruptedVIPOverride = {}
local santaOverride = {}
local elfOverride = {}
local treeTable = {}
local lifeguardOverride = {}
local alienOverride = {}
local princessOverride = {}
local superheroOverride = {}
-- create customers to fill this seat grouping
local containsGhostOrSpecial = false
for i, seatGroup in pairs(selectedSeatGroup) do
local seat = seatGroup
local tabl = selectedTable
local hasAlreadyBeenForced = false
local floor = bakery.floors[seat.floorLevel]
for _, entity in ipairs(floor:GetEntitiesFromClassAndSubClass("Furniture", "ChristmasTree")) do
local dist = math.sqrt(math.pow(entity.xVoxel - seat.xVoxel, 2) + math.pow(entity.zVoxel - seat.zVoxel, 2))
if dist < 4*math.sqrt(2)+0.1 then
treeTable[i] = true
break
end
end
local overrideUID = nil
--// ROYAL TABLE
if not hasAlreadyBeenForced and ForceVIP then
if seat.ID == "43" and tabl.ID == "44" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "43" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif tabl.ID == "44" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "13"
vipOverride[i] = overrideUID
end
end
--// ROYAL HALLOWEEN TABLE
if not hasAlreadyBeenForced and ForceHeadless then
if seat.ID == "98" and tabl.ID == "99" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "98" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif tabl.ID == "99" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "26"
corruptedVIPOverride[i] = overrideUID
end
end
--// LIFEGUARD
if not hasAlreadyBeenForced and ForceLifeguard then
if seat.ID == "118" and tabl.ID == "119" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "118" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif tabl.ID == "119" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "29"
lifeguardOverride[i] = overrideUID
end
end
--// ALIEN
if not hasAlreadyBeenForced and ForceAlien then
if seat.ID == "120" and tabl.ID == "121" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "120" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif tabl.ID == "121" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "30"
alienOverride[i] = overrideUID
end
end
if not hasAlreadyBeenForced and ForcePrincess then
if seat.ID == "124" and tabl.ID == "125" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "124" then
hasAlreadyBeenForced = true
overrideUID = v219.UID
elseif tabl.ID == "125" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "31"
princessOverride[i] = overrideUID
end
end
if not hasAlreadyBeenForced then
if seat.ID == "127" and tabl.ID == "128" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "127" then
hasAlreadyBeenForced = true
overrideUID = v219.UID
elseif tabl.ID == "128" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "32"
superheroOverride[i] = overrideUID
end
end
-- PIRATE
if not hasAlreadyBeenForced and ForcePirate then
if seat.ID == "74" and tabl.ID == "75" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "74" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif tabl.ID == "75" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "21"
pirateOverride[i] = overrideUID
end
end
--// YOUTUBER
if not hasAlreadyBeenForced and ForceYoutuber then
if seat.ID == "84" and tabl.ID == "85" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "84" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif tabl.ID == "85" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "22"
youtuberOverride[i] = overrideUID
end
end
-- SANTA
if not hasAlreadyBeenForced and ForceSanta then
if seat.ID == "108" and true then
hasAlreadyBeenForced = true
overrideUID = seat.UID
UIDBatch[i].ID = "27"
santaOverride[i] = overrideUID
end
end
-- ELF
if not hasAlreadyBeenForced and ForceElf then
if seat.ID == "110" and tabl.ID == "111" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif seat.ID == "110" then
hasAlreadyBeenForced = true
overrideUID = seat.UID
elseif tabl.ID == "111" then
hasAlreadyBeenForced = true
overrideUID = tabl.UID
end
if hasAlreadyBeenForced then
UIDBatch[i].ID = "28"
elfOverride[i] = overrideUID
end
end
end
local originalResponse = {Original_AddCustomersToQueueIfNecessary(bakery, kickCustomerIfNecessary, UIDBatch)}
--// EDIT THE ORIGINAL RESPONSE
originalResponse[1] = #selectedSeatGroup
originalResponse[2] = vipOverride
originalResponse[3] = pirateOverride
originalResponse[4] = youtuberOverride
originalResponse[5] = shadowOverride
originalResponse[6] = corruptedVIPOverride
originalResponse[7] = santaOverride
originalResponse[8] = elfOverride
originalResponse[9] = treeTable
originalResponse[10] = lifeguardOverride
originalResponse[11] = alienOverride
originalResponse[12] = princessOverride
originalResponse[13] = superheroOverride
return unpack(originalResponse)
end
local Original_NetworkInvoke = Network.Invoke
Network.Invoke = function(...)
local args = {...}
if args[1] then
if args[1] == "WaitForCookTime" and InstantCook then
coroutine.wrap(function() Original_NetworkInvoke(unpack(args)) end)()
return true
elseif args[1] == "WaitForEatTime" and InstantEat then
coroutine.wrap(function() Original_NetworkInvoke(unpack(args)) end)()
return true
end
end
if IS_DEV_MODE and PRINT_NETWORK then
local stringBuilder = "Network.Invoke: "
for _, n in pairs(args) do
stringBuilder = stringBuilder .. " | " .. tostring(n)
end
print(stringBuilder)
end
return Original_NetworkInvoke(unpack(args))
end
Waiter.StartActionLoop = function(waiter)
coroutine.wrap(function()
while not waiter.isDeleted do
Waiter.PerformAction(waiter)
-- Wait for next waiter action
if FastWaiter then
wait()
else
wait(1.5)
end
end
end)()
end
local Original_UpdateCustomerQueuePositioning = Bakery.UpdateCustomerQueuePositioning
Bakery.UpdateCustomerQueuePositioning = function(bakery)
Original_UpdateCustomerQueuePositioning(bakery)
if not FastWaiter then return end
-- this fix stuck on door problem?
wait(0.05)
if bakery:IsMyBakery() then
for _, groupQueue in ipairs(bakery.customerQueue) do
if groupQueue and groupQueue[1] then
local entity = groupQueue[1]
entity:StopGroupEmoji()
entity:CleanupGroupInteract()
bakery:SeatQueuedCustomerGroup(entity)
bakery:UpdateCustomerQueuePositioning()
end
end
end
end
local Original_PerformAction = Waiter.PerformAction
Waiter.PerformAction = function(waiter)
if not FastWaiter then Original_PerformAction(waiter) return end
if waiter.state == "Idle" then
--waiter.humanoid.WalkSpeed = waiter.data.walkSpeed * (waiter.boost and 1)
local waiterFunctions = { Waiter.CheckForCustomerOrder, Waiter.CheckForFoodDelivery, Waiter.CheckForDishPickup }
for _, action in ipairs(Library.Functions.RandomizeTable(waiterFunctions)) do
if action(waiter) then
break
end
end
end
end
local Original_CheckForDishPickup = Waiter.CheckForDishPickup
Waiter.CheckForDishPickup = function(waiter)
if not FastWaiter then return Original_CheckForDishPickup(waiter) end
local myFloor = waiter:GetMyFloor()
local selectedDishChair, selectedDishChairFloor = nil
local indices = Library.Functions.RandomIndices(Library.Variables.MyBakery.floors)
if true then
for i, index in ipairs(indices) do
if index == myFloor.floorLevel then
table.remove(indices, i)
table.insert(indices, 1, myFloor.floorLevel)
break
end
end
end
for _, index in ipairs(indices) do
local thisFloor = Library.Variables.MyBakery.floors[index]
local dishIndices = Library.Functions.RandomIndices(thisFloor.dishChairs)
for _, dishIndex in ipairs(dishIndices) do
local dishChair = thisFloor.dishChairs[dishIndex]
if dishChair.isDeleted or dishChair.stateData.flaggedByWaiterForDishPickup or not dishChair.stateData.dish or dishChair.stateData.dish.isDeleted then
continue
end
selectedDishChair = dishChair
selectedDishChairFloor = dishChair:GetMyFloor()
break
end
if selectedDishChair then
break
end
end
if not selectedDishChair then
return false
end
local dishwashers = myFloor:GatherDishwashersOnAnyFloor()
if #dishwashers == 0 then return false end
local dishChair = selectedDishChair
dishChair.stateData.flaggedByWaiterForDishPickup = true
local dishwasher = dishwashers[math.random(#dishwashers)]
dishwasher.stateData.dishWasherTargetCount += 1
dishChair.stateData.dish.flaggedDishwasherUID = dishwasher.UID
waiter.state = "WalkingToPickupDish"
waiter:WalkToNewFloor(dishChair:GetMyFloor(), function()
if dishChair.isDeleted or not dishChair.stateData.dish then
dishwasher.stateData.dishWasherTargetCount -= 1
waiter.state = "Idle"
return
end
waiter:WalkToPoint(dishChair.xVoxel, dishChair.yVoxel, dishChair.zVoxel, function()
if dishChair.isDeleted or not dishChair.stateData.dish then
dishwasher.stateData.dishWasherTargetCount -= 1
waiter.state = "Idle"
return
end
dishChair.stateData.flaggedByWaiterForDishPickup = false
if not dishChair.stateData.dish or dishChair.stateData.dish.isDeleted then
dishwasher.stateData.dishWasherTargetCount -= 1
waiter.state = "Idle"
return
end
if dishChair.stateData.dish and dishChair.stateData.dish.model then
for i, dishChairEntry in ipairs(selectedDishChairFloor.dishChairs) do
if dishChairEntry == selectedDishChair then
table.remove(selectedDishChairFloor.dishChairs, i)
break
end
end
dishChair.stateData.dish:CleanupInteract()
if dishChair.stateData.dish.model and dishChair.stateData.dish.model.PrimaryPart then
local dishSounds = {5205173686, 5205173942}
Library.SFX.Play(dishSounds[math.random(#dishSounds)], dishChair.stateData.dish.model:GetPrimaryPartCFrame().p)
end
dishChair.stateData.dish:MoneyPickedUp()
dishChair.stateData.dish:DestroyModel()
dishChair.stateData.dish = nil
waiter:HoldDirtyDish()
end
waiter:FaceEntity(dishChair)
if dishwasher.isDeleted then
waiter:StopLoadedAnimation("hold")
if waiter.stateData.heldDish then
waiter.stateData.heldDish = waiter.stateData.heldDish:Destroy()
end
waiter.state = "Idle"
return
end
waiter:WalkToNewFloor(dishwasher:GetMyFloor(), function()
if dishwasher.isDeleted then
waiter:StopLoadedAnimation("hold")
if waiter.stateData.heldDish then
waiter.stateData.heldDish = waiter.stateData.heldDish:Destroy()
end
waiter.state = "Idle"
return
end
waiter:WalkToPoint(dishwasher.xVoxel, dishwasher.yVoxel, dishwasher.zVoxel, function()
waiter:DropFood()
if dishwasher.isDeleted then
waiter.state = "Idle"
return
end
dishwasher:AddDish()
waiter:FaceEntity(dishwasher)
waiter:ResetAllStates()
end)
end)
end)
end)
return true
end
local Original_CheckForCustomerOrder = Waiter.CheckForCustomerOrder
Waiter.CheckForCustomerOrder = function(waiter)
if not FastWaiter then return Original_CheckForCustomerOrder(waiter) end
local myFloor = waiter:GetMyFloor()
local waitingCustomer = myFloor:GetCustomerWaitingToOrder()
if not waitingCustomer then
local indices = Library.Functions.RandomIndices(Library.Variables.MyBakery.floors)
for _, index in ipairs(indices) do
local floor = Library.Variables.MyBakery.floors[index]
if floor ~= myFloor then
if not floor:HasAtLeastOneIdleStateOfClass("Waiter") then
waitingCustomer = floor:GetCustomerWaitingToOrder()
if waitingCustomer then
break
end
end
end
end
if not waitingCustomer then
return false
end
end
waiter.state = "WalkingToTakeOrder"
local customerGroup = {waitingCustomer}
for _, customerPartner in ipairs(waitingCustomer.stateData.queueGroup) do
if customerPartner.state == "WaitingToOrder" and not customerPartner.waiterIsAttendingToFoodOrder then
table.insert(customerGroup, customerPartner)
end
end
for _, seatedCustomer in ipairs(customerGroup) do
seatedCustomer.waiterIsAttendingToFoodOrder = true
end
local function untagGroup()
for _, seatedCustomer in ipairs(customerGroup) do
seatedCustomer.waiterIsAttendingToFoodOrder = false
end
end
local firstCustomer = customerGroup[1]
local groupTable = waiter:EntityTable()[firstCustomer.stateData.tableUID]
if not groupTable or groupTable.isDeleted then
waiter.state = "Idle"
return
end
local tx, ty, tz = groupTable.xVoxel, groupTable.yVoxel, groupTable.zVoxel
local customerFloor = firstCustomer:GetMyFloor()
waiter:WalkToNewFloor(customerFloor, function()
if firstCustomer.leaving or firstCustomer.isDeleted then
waiter.state = "Idle"
return
end
waiter:WalkToPoint(tx, ty, tz, function()
if firstCustomer.isDeleted or firstCustomer.leaving then
waiter.state = "Idle"
return
end
local orderStand = customerFloor:FindOrderStandOnAnyFloor()
if not orderStand then
Library.Print("CRITICAL: NO ORDER STAND FOUND!", true)
untagGroup()
waiter.state = "Idle"
waiter:TimedEmoji("ConcernedEmoji", 2)
return
end
local firstCustomer = customerGroup[1]
if firstCustomer then
firstCustomer:StopGroupEmoji()
firstCustomer:CleanupGroupInteract()
end
local groupOrder = {}
local tookOrdersFrom = {}
for _, seatedCustomer in ipairs(customerGroup) do
if seatedCustomer.state == "WaitingToOrder" then
table.insert(tookOrdersFrom, seatedCustomer)
groupOrder[seatedCustomer.UID] = Library.Food.RandomFoodChoice(seatedCustomer.UID, seatedCustomer.ID, seatedCustomer:IsRichCustomer(), seatedCustomer:IsPirateCustomer(), seatedCustomer.isNearTree)
seatedCustomer.state = "WaitingForFood"
seatedCustomer:StopChat()
end
end
-- if no orders are taken, abort
if #tookOrdersFrom == 0 then
waiter.state = "Idle"
return
end
-- take order animation
waiter:PlayLoadedAnimation("write")
for _, customer in ipairs(customerGroup) do
waiter:FaceEntity(customer)
end
waiter:StopLoadedAnimation("write")
waiter.state = "WalkingToDropoffOrder"
waiter:WalkToNewFloor(orderStand:GetMyFloor(), function()
if orderStand.isDeleted then
for _, customer in ipairs(customerGroup) do
customer:ForcedToLeave()
end
waiter.state = "Idle"
return
end
waiter:WalkToPoint(orderStand.xVoxel, orderStand.yVoxel, orderStand.zVoxel, function()
if orderStand.isDeleted then
for _, customer in ipairs(customerGroup) do
customer:ForcedToLeave()
end
waiter.state = "Idle"
return
end
-- deposit each of the orders
for _, orderedCustomer in ipairs(tookOrdersFrom) do
if orderedCustomer.isDeleted then
continue
end
orderedCustomer:ChangeToWaitingForFoodState(groupOrder[orderedCustomer.UID])
orderStand:AddFoodToQueue(groupOrder[orderedCustomer.UID])
end
Library.Network.Fire("AwardWaiterExperienceForTakingOrderWithVerification", waiter.UID)
waiter:FaceEntity(orderStand)
waiter.state = "Idle"
end)
end)
end)
end)
return true
end
local Original_RandomFoodChoice = Food.RandomFoodChoice
Food.RandomFoodChoice = function(customerOwnerUID, customerOwnerID, isRichCustomer, isPirateCustomer, isNearTree)
if GoldFood then
local spoof = Food.new("45", customerOwnerUID, customerOwnerID, true, true)
spoof.IsGold = true
return spoof
end
return Original_RandomFoodChoice(customerOwnerUID, customerOwnerID, isRichCustomer, isPirateCustomer, isNearTree)
end
local Original_DropPresent = Customer.DropPresent
Customer.DropPresent = function(gift)
if AutoGift then
local character = Player.Character or Player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local UID = Library.Network.Invoke("Santa_RequestPresentUID", gift.UID)
Library.Network.Fire("Santa_PickUpGift", UID, humanoidRootPart.Position + Vector3.new(1,0,0))
else
Original_DropPresent(gift)
end
end
local Original_CheckForFoodDelivery = Waiter.CheckForFoodDelivery
Waiter.CheckForFoodDelivery = function(waiter)
if not GoldFood then
return Original_CheckForFoodDelivery(waiter)
end
local myFloor = waiter:GetMyFloor()
local readyStands = myFloor:GatherOrderStandsWithDeliveryReady()
if #readyStands == 0 then
local indices = Library.Functions.RandomIndices(Library.Variables.MyBakery.floors)
for _, index in ipairs(indices) do
local floor = Library.Variables.MyBakery.floors[index]
if floor ~= myFloor and not floor:HasAtLeastOneIdleStateOfClass("Waiter") then
readyStands = floor:GatherOrderStandsWithDeliveryReady()
if #readyStands > 0 then break end
end
end
if #readyStands == 0 then
return false
end
end
local orderStand = readyStands[math.random(#readyStands)]
if not orderStand then
return false
end
orderStand.stateData.foodReadyTargetCount = orderStand.stateData.foodReadyTargetCount + 1
waiter.state = "WalkingToPickupFood"
waiter:WalkToNewFloor(orderStand:GetMyFloor(), function()
if orderStand.isDeleted then
waiter.state = "Idle"
return
end
waiter:WalkToPoint(orderStand.xVoxel, orderStand.yVoxel, orderStand.zVoxel, function()
if orderStand.isDeleted then
waiter.state = "Idle"
return
end
orderStand.stateData.foodReadyTargetCount = orderStand.stateData.foodReadyTargetCount - 1
if #orderStand.stateData.foodReadyList == 0 then
waiter.state = "Idle"
return
end
local selectedFoodOrder = orderStand.stateData.foodReadyList[1]
selectedFoodOrder.isGold = true
table.remove(orderStand.stateData.foodReadyList, 1)
selectedFoodOrder:DestroyPopupListItemUI()
local customerOfOrder = waiter:EntityTable()[selectedFoodOrder.customerOwnerUID]
if not customerOfOrder then
Library.Print("CRITICAL: customer owner of food not found", true)
waiter.state = "Idle"
return false
end
waiter:FaceEntity(orderStand)
waiter:HoldFood(selectedFoodOrder.ID, selectedFoodOrder.isGold)
waiter.state = "WalkingToDeliverFood"
if not customerOfOrder.isDeleted then
waiter:WalkToNewFloor(customerOfOrder:GetMyFloor(), function()
waiter:WalkToPoint(customerOfOrder.xVoxel, customerOfOrder.yVoxel, customerOfOrder.zVoxel, function()
waiter:DropFood()
if customerOfOrder.isDeleted then
Library.Print("CRITICAL: walked to customer, but they were forced to leave. aborting", true)
waiter.state = "Idle"
return
end
customerOfOrder:ChangeToEatingState()
waiter:FaceEntity(customerOfOrder)
Library.Network.Fire("AwardWaiterExperienceForDeliveringOrderWithVerification", waiter.UID)
waiter.state = "Idle"
end)
end)
return
end
waiter.state = "Idle"
waiter.stateData.heldDish = waiter.stateData.heldDish:Destroy()
end)
end)
return true
end
local Original_ChangeToWaitForOrderState = Customer.ChangeToWaitForOrderState
Customer.ChangeToWaitForOrderState = function(customer)
if not FastOrder then
Original_ChangeToWaitForOrderState(customer)
return
end
if customer.state ~= "WalkingToSeat" then return end
local seatLeaf = customer:EntityTable()[customer.stateData.seatUID]
local tableLeaf = customer:EntityTable()[customer.stateData.tableUID]
if seatLeaf.isDeleted or tableLeaf.isDeleted then
customer:ForcedToLeave()
return
end
customer:SetCustomerState("ThinkingAboutOrder")
customer:SitInSeat(seatLeaf).Completed:Connect(function()
customer.humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, true)
customer.xVoxel = seatLeaf.xVoxel
customer.zVoxel = seatLeaf.zVoxel
coroutine.wrap(function()
wait(0.05)
customer:ReadMenu()
wait(0.1)
if customer.isDeleted or customer.state ~= "ThinkingAboutOrder" then return end
customer:StopReadingMenu()
customer:SetCustomerState("DecidedOnOrder")
local myGroup = {customer}
for _, partner in ipairs(customer.stateData.queueGroup) do
if not partner.isDeleted then
table.insert(myGroup, partner)
end
end
local foundUndecidedMember = false
for _, groupMember in ipairs(myGroup) do
if groupMember.state ~= "DecidedOnOrder" then
foundUndecidedMember = true
break
end
end
if not foundUndecidedMember then
for _, groupMember in ipairs(myGroup) do
groupMember:ReadyToOrder()
end
end
end)()
end)
end
local Original_WalkThroughWaypoints = Entity.WalkThroughWaypoints
Entity.WalkThroughWaypoints = function(entity, voxelpoints, waypoints, undefined1, undefined2)
if entity:BelongsToMyBakery() then
if TeleportNPC then
TeleportThroughWaypoints(entity, voxelpoints, waypoints)
return
elseif FastNPC and entity.humanoid then
entity.humanoid.WalkSpeed = NPCSpeed
elseif not FastNPC and entity.humanoid and entity.data and entity.data.walkSpeed then
entity.humanoid.WalkSpeed = entity.data.walkSpeed
end
end
Original_WalkThroughWaypoints(entity, voxelpoints, waypoints, undefined1, undefined2)
end
function TeleportThroughWaypoints(entity, voxelpoints, waypoints)
entity:PlayLoadedAnimation("walking")
if #voxelpoints == 0 then
return
end