Paste #10188: Diff note for paste #10187

Date: 2014/09/30 18:57:56 UTC-07:00
Type: Diff Report

View Raw Paste Download This Paste
Copy Link


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


 ################################################################################
 #
-#                          M a s t e r C h e f   N P C 
+#                          M a s t e r  C h e f   N P C 
 #                           Feed those hungry denizens
 #
 #
 #   Author: |Anthony|
 #   Version: 0.1
 #   dScript Version: 0.9.5-b1522
 #
 # 
 #
 ################################################################################
 #
 MasterChefNPC:
   type: assignment
   speed: 1t
   debug: true
 
   actions:
     on assignment:
       - run locally assignment instantly
     on spawn:
       - run locally spawn instantly
     on despawn:
-      - run locally despawn instantly
+      - run locally despawn instantly delay:5s
     on click:
       - if <player.has_permission[chef.admin]> {
         - run locally click instantly
         }
         else {
         - chat "<&7>You can tell me to find the <&f>sink<&7>, <&f>prep<&7>, <&f>oven<&7>, <&f>stove<&7>, <&f>grill<&7>, <&f>basicfridge<&7>, or <&f>fancyfridge<&7> and I will find it."
         - chat "<&7>Or I can cook a <&f>potato<&7> or <&f>steak<&7> for you."
         }
     on damage:
       - run locally damage instantly
     on chat:
       - wait 10t
       - run locally chat instantly def:<c.message>
+
+    on order:
+    # Custom action sent from the waitress. When a player places an order with
+    #  the waitress, each menu item should come in as an individual order.
+    # Orders should be queued in a FIFO manner.
+      - define order '<c.order>'
+      - define waitress '<c.waitress.as_npc>'
+      # Should write a utility that checks if the kitchen has the required food
+      # items for the order.
+      # - inject locally checkStock
+      - if <npc.flag[cooking]> flag npc orderQueue:->:%order%/%waitress%
+        else run s@MasterChef_%order% p:%order%
+      
 
   assignment:
     - trigger name:chat state:true radius:5 cooldown:5s
     - trigger name:click state:true radius:5 cooldown:5s
     - trigger name:proximity state:false
     - trigger name:damage state:true radius:5 cooldown:5s
     - vulnerable state:false
     - lookclose true range:5 realistic
     - flag npc respawn_location:<npc.location>
     - flag npc Pathfind.FidgetRadius:5
     - flag npc Pathfind.FidgetSpeed:0.7
     - flag npc Pathfind.FidgetWait:10
     - flag npc Pathfind.FidgetLocation:<npc.location>
     - flag npc Pathfind.FidgetHeight:1
     - flag npc Pathfind.FidgetPathMaterial:<npc.location.standing_on.material.name>
     - inject locally spawn instantly
 
 
   spawn:
     - chat "Alright, time to start work..." no_target
 #    - run s@Fidget id:fidgetQueue_<npc.id>
 
 
   despawn:
     - chat "Phew... I<&sq>m glad to be done work for the day!" no_target
 
 
   damage:
     - chat "Why would you do that?" no_target
 
 
   click:
     - if <npc.has_flag[following]> {
       - if <npc.flag[following].as_player.is[==].to[<player>]> {
         - follow stop
         - if <queue.exists[Following_<npc.id>]> queue queue:Following_<npc.id> stop
         - chat "Ok. I<&sq>ll wait right here..."
         - flag npc following:!
 #        - run s@Fidget id:fidgetQueue_<npc.id>
         - queue stop
         }
         else {
         - chat "I<&sq>m a little busy right now..."
         - queue stop
         }
       }
       else {
       - if <queue.exists[fidgetQueue_<npc.id>]> queue queue:fidgetQueue_<npc.id> stop
       - flag npc following:<player>
       - run locally follow id:Following_<npc.id>
       }
 
   follow:
     - if !<npc.flag[following].as_player.is_online> {
       - flag npc following:!
       - follow stop
       - run s@Fidget id:fidgetQueue_<npc.id>
       - queue stop
       }
     - follow target:<npc.flag[following].as_player>
     - wait 5s
     - inject locally follow
 
   chat:
     - ^if <npc.has_flag[following]> {
       - chat "I<&sq>m a little busy right now following <npc.flag[following].as_player.name>..."
       - queue stop
       }
     - ^define foodItems li@potato|steak|stew
     - ^define food '<def[1].split[ ].get[1].escaped||null>'
     - ^if <def[foodItems].contains[%food%]> {
       - chat "Ok, one %food% coming up!"
       - inject locally %food%
+      - action "order" context:order|%food%|waitress|none
       - queue stop
       }
     - ^define options li@basicFridge|fancyFridge|grill|sink|prep|oven|stove|window
     - ^define equipment '<def[1].split[ ].get[1].escaped||null>'
     - ^define range '<def[1].split[ ].get[2].escaped||15>'
     - ^if !<def[range].is[MATCHES].to[number]> {
       - chat "Hey, that<&sq> s not a number!"
       }
     - ^if !<def[options].contains[%equipment%]> {
       - chat "I don<&sq>t know anything about that."
       - queue stop
       }
     - ^if <queue.exists[fidgetQueue_<npc.id>]> queue queue:fidgetQueue_<npc.id> stop
     - ^inject locally find%equipment% instantly
     - ^if <def[locations].as_list.is_empty> {
       - chat "I couldn<&sq>t find the %equipment%."
       - queue stop
       }
     - ^chat "I found <def[locations].size.as_int> %equipment%."
     - ^define destination <def[locations].random>
     - ^showfake glowstone '<def[destination].split[/].get[2].as_location>' d:5s
     - ~walkto '<def[destination].split[/].get[2].as_location>' speed:0.7
     - ^chat "Ok, I made it to the %equipment%."
     - ^wait 5s
     - ^run s@Fidget id:fidgetQueue_<npc.id>
 
 
 ################################################################################
 #
 #  Kitchen Equipment Locators
 #
 # These are the mechanics we use to find the various kitchen equipment
 # End users don't need to concern themselves with this.
 #
 #  TODO
 #
 #    - Pantry
 #    - Walkin Freezer
 #    - Various Bar stuffs
 #    - Frying station
 #    - Fancy Grill?
 #
 #
   findBasicFridge:
   # The BasicFridge is 2 ironblocks tall with a stone button on the front of the top block
     - define ironBlocks <npc.location.find.blocks[iron_block].within[%range%]||null>
     - if <def[ironBlocks].is[!=].to[null]>
       && !<def[ironBlocks].is_empty> {
       - define locations li@
       - foreach %ironBlocks% {
         - define iron '%value%'
         - if <def[iron].below.material.name.is[!=].to[iron_block]||true> foreach next
 
         - define east '<def[iron].add[1,0,0]>'
         - define west '<def[iron].add[-1,0,0]>'
         - define north '<def[iron].add[0,0,1]>'
         - define south '<def[iron].add[0,0,-1]>'
         - define cardinals li@east|west|north|south
 
         - foreach %cardinals% {
           - define location '<def[%value%]>'
 
           - if <def[location].material.name.is[==].to[stone_button]>
             && <def[location].sub[0,1,0].material.name.is[==].to[air]>
             && <def[location].sub[0,2,0].material.is_solid> {
             - define locations <def[locations].include[%iron%/<def[location].below>]>
             }
           }
         }
       }
-
 
   findFancyFridge:
   # The FancyFridge is 2 ironblocks tall with an iron door on the front
     - define ironBlocks <npc.location.find.blocks[iron_block].within[%range%]||null>
     - if <def[ironBlocks].is[!=].to[null]>
       && !<def[ironBlocks].is_empty> {
       - define locations li@
       - foreach %ironBlocks% {
         - define iron '%value%'
         - if <def[iron].below.material.name.is[!=].to[iron_block]||true> foreach next
 
         - define east '<def[iron].add[1,0,0]>'
         - define west '<def[iron].add[-1,0,0]>'
         - define north '<def[iron].add[0,0,1]>'
         - define south '<def[iron].add[0,0,-1]>'
         - define cardinals li@east|west|north|south
 
         - foreach %cardinals% {
           - define location '<def[%value%]>'
 
           - if <def[location].material.name.is[==].to[iron_door_block]>
             && <def[location].sub[0,1,0].material.name.is[==].to[iron_door_block]>
             && <def[location].sub[0,2,0].material.is_solid> {
             - define locations <def[locations].include[%iron%/<def[location].below>]>
             }
           }
         }
       }
 
-
   findGrill:
   # The Grill is a trapdoor over fire
   # This currently sets the location to walk to as the solid block the player
   #  would stand on. This differs from all of the other equipment search
   #  functions since they all return the air block in front of the equipment.
   #  I want to keep this just to see if there is a noticeable difference. As in
   #  does the NPC get closer to the target block.
     - define fireBlocks <npc.location.find.blocks[fire].within[%range%]||null>
     - if <def[fireBlocks].is[!=].to[null]>
       && !<def[fireBlocks].is_empty> {
       - define locations li@
       - foreach %fireBlocks% {
         - define fire '%value%'
         - if <def[fire].above.material.name.is[!=].to[trap_door]||true> foreach next
 
         - define east '<def[fire].add[1,0,0]>'
         - define west '<def[fire].add[-1,0,0]>'
         - define north '<def[fire].add[0,0,1]>'
         - define south '<def[fire].add[0,0,-1]>'
         - define cardinals li@east|west|north|south
 
         - foreach %cardinals% {
           - define location '<def[%value%]>'
 
           - if <def[location].material.is_solid>
             && <def[location].above.material.name.is[==].to[air]>
             && <def[location].add[0,2,0].material.name.is[==].to[air]> {
             - define locations <def[locations].include[<def[fire].above>/%location%]>
             }
           }
         }
       }
 
-
   findSink:
   # The sink is a Cauldron full of water with a tripwire hook above
     - define cauldronBlocks <npc.location.find.blocks[cauldron,3].within[%range%]||null>
     - if <def[cauldronBlocks].is[!=].to[null]>
       && !<def[cauldronBlocks].is_empty> {
       - define locations li@
       - foreach %cauldronBlocks% {
         - define cauldron '%value%'
         - if <def[cauldron].above.material.name.is[!=].to[tripwire_hook]||true> foreach next
 
         - define east '<def[cauldron].add[1,0,0]>'
         - define west '<def[cauldron].add[-1,0,0]>'
         - define north '<def[cauldron].add[0,0,1]>'
         - define south '<def[cauldron].add[0,0,-1]>'
         - define cardinals li@east|west|north|south
 
         - foreach %cardinals% {
           - define location '<def[%value%]>'
 
           - if <def[location].material.name.is[==].to[air]>
             && <def[location].above.material.name.is[==].to[air]>
             && <def[location].below.material.is_solid> {
             - define locations <def[locations].include[%cauldron%/%location%]>
             }
           }
         }
       }
 
-
   findPrep:
   # The Prep station is the top half stone slab with a wood pressure plate on top
     - define prepBlocks <npc.location.find.blocks[stone_slab_up].within[%range%]||null>
     - if <def[prepBlocks].is[!=].to[null]>
       && !<def[prepBlocks].is_empty> {
       - define locations li@
       - foreach %prepBlocks% {
         - define prep '%value%'
         - if <def[prep].above.material.name.is[!=].to[wood_plate]||true> foreach next
 
         - define east '<def[prep].add[1,0,0]>'
         - define west '<def[prep].add[-1,0,0]>'
         - define north '<def[prep].add[0,0,1]>'
         - define south '<def[prep].add[0,0,-1]>'
         - define cardinals li@east|west|north|south
 
         - foreach %cardinals% {
           - define location '<def[%value%]>'
 
           - if <def[location].material.name.is[==].to[air]>
             && <def[location].above.material.name.is[==].to[air]>
             && <def[location].below.material.is_solid> {
             - define locations <def[locations].include[%prep%/%location%]>
             }
           }
         }
       }
-
 
   findOven:
   # The oven is a 2 tall by 2 wide set of furnaces.
   # We will accept furnaces that are on or off
+  # For some reason i'm getting duplicate results, so for now i'm purging the
+  #  dupes with:    - define locations '<def[locations].deduplicate>'
     - define furnaceBlocks <npc.location.find.blocks[furnace|burning_furnace].within[%range%]||null>
     - if <def[furnaceBlocks].is[!=].to[null]>
       && !<def[furnaceBlocks].is_empty> {
       - define locations li@
       - foreach %furnaceBlocks% {
         - define furnace1 '%value%'
         - if <def[furnace1].below.material.name.is[!=].to[furnace]||true>
           && <def[furnace1].below.material.name.is[!=].to[burning_furnace]||true> foreach next
 
         - define east '<def[furnace1].add[1,0,0]>'
         - define west '<def[furnace1].add[-1,0,0]>'
         - define north '<def[furnace1].add[0,0,1]>'
         - define south '<def[furnace1].add[0,0,-1]>'
         - define cardinals li@east|west|north|south
 
         - foreach %cardinals% {
           - define furnace2 '<def[%value%]>'
 
           - if <el@val[<def[furnace2].material.name.is[!=].to[furnace]>].and[<def[furnace2].material.name.is[!=].to[burning_furnace]>]>
             && <el@val[<def[furnace2].below.material.name.is[!=].to[furnace]>].and[<def[furnace2].below.material.name.is[!=].to[burning_furnace]>]> foreach next
 
           - define east '<def[furnace2].add[1,0,0]>'
           - define west '<def[furnace2].add[-1,0,0]>'
           - define north '<def[furnace2].add[0,0,1]>'
           - define south '<def[furnace2].add[0,0,-1]>'
           - define cardinals li@east|west|north|south
 
           - foreach %cardinals% {
             - define location '<def[%value%]>'
 
             - if <def[location].material.name.is[==].to[air]>
               && <def[location].sub[0,1,0].material.name.is[==].to[air]>
               && <def[location].sub[0,2,0].material.is_solid> {
               - define locations <def[locations].include[%furnace2%/<def[location].sub[0,1,0]>]>
               - define locations <def[locations].include[<def[furnace2].sub[0,1,0]>/<def[location].sub[0,1,0]>]>
               }
             }
           }
         }
       }
     - define locations '<def[locations].deduplicate>'
 
-
   findStove:
   # The Stove is a furnace with a stone pressure plate on top
     - define stoveBlocks <npc.location.find.blocks[furnace|burning_furnace].within[%range%]||null>
     - if <def[stoveBlocks].is[!=].to[null]>
       && !<def[stoveBlocks].is_empty> {
       - define locations li@
       - foreach %stoveBlocks% {
         - define stove '%value%'
         - if <def[stove].above.material.name.is[!=].to[stone_plate]||true> foreach next
 
         - define east '<def[stove].add[1,0,0]>'
         - define west '<def[stove].add[-1,0,0]>'
         - define north '<def[stove].add[0,0,1]>'
         - define south '<def[stove].add[0,0,-1]>'
         - define cardinals li@east|west|north|south
 
         - foreach %cardinals% {
           - define location '<def[%value%]>'
 
           - if <def[location].material.name.is[==].to[air]>
             && <def[location].above.material.name.is[==].to[air]>
             && <def[location].below.material.is_solid> {
             - define locations <def[locations].include[%stove%/%location%]>
             }
           }
         }
       }
-
-
 
   findWindow:
   # The Window is an upside down stair block with a carpet on top and a
   # redstone_lamp_on above that
+  # The Window is where the chef delivers cooked food
+  # Be sure to have something on the floor in front of the window (outside the
+  #  kitchen) like carpet so the locator doesn't return those blocks as valid
+  #  locations!
     - define stairs 'li@acacia_stairs,4|birch_wood_stairs,4|brick_stairs,4|cobblestone_stairs,4|dark_oak_stairs,4|jungle_wood_stairs,4|nether_brick_stairs,4|quartz_stairs,4|sandstone_stairs,4|smooth_stairs,4|spruce_wood_stairs,4|wood_stairs,4|acacia_stairs,5|birch_wood_stairs,5|brick_stairs,5|cobblestone_stairs,5|dark_oak_stairs,5|jungle_wood_stairs,5|nether_brick_stairs,5|quartz_stairs,5|sandstone_stairs,5|smooth_stairs,5|spruce_wood_stairs,5|wood_stairs,5|acacia_stairs,6|birch_wood_stairs,6|brick_stairs,6|cobblestone_stairs,6|dark_oak_stairs,6|jungle_wood_stairs,6|nether_brick_stairs,6|quartz_stairs,6|sandstone_stairs,6|smooth_stairs,6|spruce_wood_stairs,6|wood_stairs,6|acacia_stairs,7|birch_wood_stairs,7|brick_stairs,7|cobblestone_stairs,7|dark_oak_stairs,7|jungle_wood_stairs,7|nether_brick_stairs,7|quartz_stairs,7|sandstone_stairs,7|smooth_stairs,7|spruce_wood_stairs,7|wood_stairs,7'
     - define windowBlocks '<npc.location.find.blocks[%stairs%].within[%range%]||null>'
     - if <def[windowBlocks].is[!=].to[null]>
       && !<def[windowBlocks].is_empty> {
       - define locations li@
       - foreach %windowBlocks% {
         - define window '%value%'
         - if <def[window].above.material.bukkit_enum.is[!=].to[CARPET]||true> foreach next
         - if <def[window].add[0,2,0].material.name.is[!=].to[redstone_lamp_on]||true> foreach next
 
         - define east '<def[window].add[1,0,0]>'
         - define west '<def[window].add[-1,0,0]>'
         - define north '<def[window].add[0,0,1]>'
         - define south '<def[window].add[0,0,-1]>'
         - define cardinals li@east|west|north|south
 
         - foreach %cardinals% {
           - define location '<def[%value%]>'
 
           - if <def[location].material.name.is[==].to[air]>
             && <def[location].above.material.name.is[==].to[air]>
             && <def[location].below.material.is_solid> {
             - define locations <def[locations].include[%window%/%location%]>
             }
           }
         }
       }
 
 
 ################################################################################
 #
 #  Animations
 #
 # These are the animations we provide to the end users. All they have to do is
 # inject them from their recipe scripts and have the right definitions available
 #
 #  TODO
 #
 #    - Figure out a way to have unattended cooking operations
 #    - Add a cookTime option to baking
 #    - Animations for any new equipment
 #    - Figure out a way to notify Watress when chef delivers food
 #    - 
 #
 #
   getFood_FancyFridge:
   # Walk to the FancyFridge and get the %foodItems%
     - ^inject locally findFancyFridge instantly
     - ^define destination '<def[locations].random>'
     - ^define door '<def[destination].split[/].get[2].as_location>'
     - ~walkto %door% speed:0.7
     - ^look <npc> '<def[destination].split[/].get[1].as_location>'
     - ^playsound %door% sound:door_open
     - ^animate <npc> animation:ARM_SWING
     - ^switch %door% state:toggle
     - ^wait 15t
     - foreach %foodItems% {
       - animate <npc> animation:ARM_SWING
       - ~equip <npc> hand:<def[value].as_item>
       - wait 15t
       }
     - ^animate <npc> animation:ARM_SWING
     - ^switch %door% state:toggle
     - ^playsound %door% sound:door_close
     - ^wait 10t
 
   getFood_BasicFridge:
   # Walk to the BancyFridge and get the %foodItems%
     - ^inject locally findBasicFridge instantly
     - ^define destination '<def[locations].random>'
     - ^define door '<def[destination].split[/].get[2].as_location>'
     - ~walkto %door% speed:0.7
     - ^look <npc> '<def[destination].split[/].get[1].as_location>'
     - ^playsound %door% sound:door_open
     - ^animate <npc> animation:ARM_SWING
     - ^switch %door% state:toggle
     - ^wait 15t
     - foreach %foodItems% {
       - animate <npc> animation:ARM_SWING
       - ~equip <npc> hand:<def[value].as_item>
       - wait 15t
       }
     - ^animate <npc> animation:ARM_SWING
     - ^switch %door% state:toggle
     - ^playsound %door% sound:door_close
     - ^wait 10t
 
   washFood:
   # Walk to sink and wash the %foodItems%
     - ^inject locally findSink instantly
     - ^define destination '<def[locations].random>'
     - ^define sinkLoc '<def[destination].split[/].get[1].as_location>'
     - ~walkto '<def[destination].split[/].get[2].as_location>' speed:0.7
     - ^look <npc> %sinkLoc%
     - ^wait 5t
     - ~equip <npc> hand:<i@air>
     - ^animate <npc> animation:SNEAK
     - ^animate <npc> animation:ARM_SWING
     - ^playsound %sinkLoc% sound:splash2
     - ^define displayItems li@
     - ^foreach %foodItems% {
       - displayitem <def[value].as_item> '%sinkLoc%' save:displayItem_%loop_index%
       - define displayItems '<def[displayItems].include[<entry[displayItem_%loop_index%].dropped>]>'
       }
     - ^foreach %foodItems% {
       - define food <def[value].as_item>
       - ^repeat 5 {
         - ~equip <npc> hand:%food%
         - animate <npc> animation:ARM_SWING
         - playsound %sinkLoc% sound:swim
         - wait <util.random.int[5].to[15]>t
         }
       }
     - ^playsound %sinkLoc% sound:splash2
     - ^animate <npc> animation:STOP_SNEAKING
     - ^remove %displayItems%
     - ^animate <npc> animation:ARM_SWING
     - ~equip <npc> hand:<def[foodItems].random.as_item>
     - ^wait 10t
 
   prepFood:
   # Walk to prep area and prep the %foodItems%
     - ^inject locally findPrep instantly
     - ^define destination '<def[locations].random>'
     - ^define prepLoc '<def[destination].split[/].get[1].as_location>'
     - ~walkto '<def[destination].split[/].get[2].as_location>' speed:0.7
     - ^look <npc> %prepLoc%
     - ^animate <npc> animation:SNEAK
     - ^animate <npc> animation:ARM_SWING
     - ~equip <npc> hand:<i@air>
     - ^define displayItems li@
     - ^foreach %foodItems% {
       - displayitem <def[value].as_item> '%prepLoc%' save:displayItem_%loop_index%
       - define displayItems '<def[displayItems].include[<entry[displayItem_%loop_index%].dropped>]>'
       }
     - ^repeat 5 {
       - animate <npc> animation:ARM_SWING
       - ^define sound 'li@step_ladder|lava_pop'
       - playsound %prepLoc% sound:<def[sound].random>
       - wait 5t
       }
     - ^remove %displayItems%
     - ^animate <npc> animation:STOP_SNEAKING
     - ~equip <npc> hand:<def[foodItems].random.as_item>
     - ^wait 10t
 
   bakeFood_Attended:
   # Walk to oven and bake the %foodItem%
   # Items should be baked one at a time in my opinion, but idk.
     - ^inject locally findOven instantly
     - ^define destination '<def[locations].random>'
     - ~walkto '<def[destination].split[/].get[2].as_location>' speed:0.7
     - ^define furnace '<def[destination].split[/].get[1].as_location>'
     - ^look <npc> %furnace%
     - ~equip <npc> hand:<i@air>
     - ^animate <npc> animation:ARM_SWING
     - ^wait 5t
     - ^playsound %furnace% sound:ghast_fireball
     - ^showfake m@burning_furnace,<def[furnace].material.data> %furnace% to:<def[furnace].find.players.within[10]> d:200t
     - ^repeat 20 {
       - ^define sound 'li@fuse|fire.random|fire.random|fire.random'
       - ^playsound %furnace% sound:<def[sound].random>
       - ^wait 5t
       }
     - ^animate <npc> animation:ARM_SWING
     - ~equip <npc> hand:%foodItem%
     - ^wait 10t
 
   bakeFood_Unattended:
   # I have to figure out a method for making some cook processes be unattended
     - ^inject locally findOven instantly
     - ^define destination '<def[locations].random>'
     - ~walkto '<def[destination].split[/].get[2].as_location>' speed:0.7
     - ^define furnace '<def[destination].split[/].get[1].as_location>'
     - ^look <npc> %furnace%
     - ~equip <npc> hand:<i@air>
     - ^animate <npc> animation:ARM_SWING
     - ^wait 5t
     - ^playsound %furnace% sound:ghast_fireball
     - ^showfake m@burning_furnace,<def[furnace].material.data> %furnace% to:<def[furnace].find.players.within[10]> d:200t
     # The script should break away here so the chef can go do other stuff while
     # the oven continues to animate.
     - ^repeat 20 {
       - ^define sound 'li@fuse|fire.random'
       - ^playsound %furnace% sound:<def[sound].random>
       - ^wait 5t
       }
     - ^animate <npc> animation:ARM_SWING
     - ~equip <npc> hand:%foodItem%
     - ^wait 10t
 
   grillFood_Attended:
   # Walk to grill and cook %rawFood% into %cookedFood%
     - ^inject locally findGrill instantly
     - ^define destination '<def[locations].random>'
     - ~walkto '<def[destination].split[/].get[2].as_location>' speed:0.7
     - ^define grill '<def[destination].split[/].get[1].as_location>'
     - ^look <npc> %grill%
     - ~equip <npc> hand:<i@air>
     - ^animate <npc> animation:ARM_SWING
     - ^wait 5t
     - ^playsound %grill% sound:ghast_fireball
     - ^displayitem <def[rawFood].as_item> '%grill%' d:300s save:rawFood
     # Default (fallback) cook time of 30 seconds
     - ^define finishTime <def[cookTime].mul[1000].add_int[<server.current_time_millis>]||<server.current_time_millis.add_int[30000]>>
     # This method provides AT LEAST a 90 second max cook time. The longest
     # possible cook time is 270 seconds. There's a bit of randomness to this
     # though since the wait time between iterations is random. Animation will
     # stop regardless of the actual cook time after 360 iterations.
     - ^repeat 360 {
       - if <def[finishTime].is[LESS].than[<server.current_time_millis>]> repeat stop
       - ^define sound 'li@fuse|fuse|fire.random'
       - ^playsound %grill% sound:<def[sound].random>
       - ^if <util.random.int[1].to[10].is[OR_MORE].than[7]> animate <npc> animation:ARM_SWING
       - ^if <util.random.int[1].to[10].is[OR_MORE].than[4]> playeffect %grill% effect:smoke qty:1 data:4
       - ^wait <util.random.int[5].to[15]>t
       }
     - ^animate <npc> animation:ARM_SWING
     - ^remove <entry[rawFood].dropped>
     - ^displayitem <def[cookedFood].as_item> '%grill%' d:30s save:cookedFood
     - ^repeat 3 {
       - ^define sound 'li@fuse|fuse|fire.random'
       - ^playsound %grill% sound:<def[sound].random>
       - ^playeffect %grill% effect:smoke qty:1 data:4
       - ^wait 15t
       }
     - ^animate <npc> animation:ARM_SWING
     - ^remove <entry[cookedFood].dropped>
     - ~equip <npc> hand:%cookedFood%
     - ^wait 10t
 
   boilFood_Attended:
   # Walk to stove and cook %rawFood% into %cookedFood%
     - ^inject locally findStove instantly
     - ^define destination '<def[locations].random>'
     - ~walkto '<def[destination].split[/].get[2].as_location>' speed:0.7
     - ^define stove '<def[destination].split[/].get[1].as_location>'
     - ^look <npc> %stove%
     - ~equip <npc> hand:<i@air>
     - ^animate <npc> animation:ARM_SWING
     - ^wait 5t
     - ^playsound %stove% sound:ghast_fireball
     - ^modifyblock %stove% m@burning_furnace,<def[stove].material.data>
     - ^displayitem <def[rawFood].as_item> '%stove%' d:300s save:rawFood
     # Default (fallback) cook time of 30 seconds
     - ^define finishTime <def[cookTime].mul[1000].add_int[<server.current_time_millis>]||<server.current_time_millis.add_int[30000]>>
     # This method provides AT LEAST a 90 second max cook time. The longest
     # possible cook time is 270 seconds. There's a bit of randomness to this
     # though since the wait time between iterations is random. Animation will
     # stop regardless of the actual cook time after 360 iterations.
     - ^repeat 360 {
       - if <def[finishTime].is[LESS].than[<server.current_time_millis>]> repeat stop
       - ^define sound 'li@fuse|lava|fire.random'
       - ^playsound %stove% sound:<def[sound].random>
       - ^if <util.random.int[1].to[10].is[OR_MORE].than[7]> animate <npc> animation:ARM_SWING
       - ^if <util.random.int[1].to[10].is[OR_MORE].than[4]> playeffect %stove% effect:mob_spell qty:10 data:0.2 offset:0.2
       - ^wait <util.random.int[5].to[15]>t
       }
     - ^animate <npc> animation:ARM_SWING
     - ^remove <entry[rawFood].dropped>
     - ^displayitem <def[cookedFood].as_item> '%stove%' d:30s save:cookedFood
     - ^repeat 3 {
       - ^define sound 'li@fuse|lava|fire.random'
       - ^playsound %stove% sound:<def[sound].random>
       - ^playeffect %stove% effect:smoke qty:1 data:4
       - ^wait 15t
       }
     - ^animate <npc> animation:ARM_SWING
     - ^remove <entry[cookedFood].dropped>
     - ~equip <npc> hand:%cookedFood%
     - ^modifyblock %stove% m@furnace,<def[stove].material.data>
     - ^wait 10t
 
   deliverFood:
   # Walk to sink and wash the %foodItems%
     - ^inject locally findWindow instantly
     - ^define destination '<def[locations].random>'
     - ^define windowLoc '<def[destination].split[/].get[1].as_location>'
     - ~walkto '<def[destination].split[/].get[2].as_location>' speed:0.7
     - ^look <npc> %windowLoc%
     - ~equip <npc> hand:<i@air>
     - ^define displayItems li@
     - ^foreach %foodItems% {
       - displayitem <def[value].as_item> '%windowLoc%' d:30s save:displayItem_%loop_index%
       - define displayItems '<def[displayItems].include[<entry[displayItem_%loop_index%].dropped>]>'
       }
 
 
 ################################################################################
 #
 #  Recipes
 #
+MasterChef_potato:
+  type: item
+  material: i@baked_potato
+  display name: Baked Potato
+  lore:
+    - A tasty Baked Potato
+    - prepared by a Master Chef
+
   potato:
     - ^lookclose <npc> state:false
     - ^define foodItems li@potato_item
     - ^inject s@MasterChefNPC p:getFood_FancyFridge
     - ^inject s@MasterChefNPC p:washFood
     - ^inject s@MasterChefNPC p:prepFood
     - ^define foodItem baked_potato
     - ^inject s@MasterChefNPC p:bakeFood_Attended
     - ^lookclose <npc> state:true
     - ^define foodItems li@baked_potato
     - ^inject s@MasterChefNPC p:deliverFood
     - ^chat "Here it is, one baked potato!" no_targets
     - ^chat "Enjoy!" no_targets
     - ^wait 15t
     - ^give i@baked_potato
+#    - ^action "order up" context:ticket|%ticket%
 
 
+MasterChef_steak:
+  type: item
+  material: i@cooked_beef
+  display name: Steak
+  lore:
+    - A tasty Steak prepared
+    - by a Master Chef
+
   steak:
     - ^lookclose <npc> state:false
     - ^define foodItems li@raw_beef
     - ^inject s@MasterChefNPC p:getFood_FancyFridge
     - ^inject s@MasterChefNPC p:prepFood
     - ^define rawFood raw_beef
     - ^define cookedFood cooked_beef
     - ^define cookTime 30
     - ^inject s@MasterChefNPC p:grillFood_Attended
     - ^lookclose <npc> state:true
     - ^define foodItems li@cooked_beef
     - ^inject s@MasterChefNPC p:deliverFood
     - ^chat "Here it is, a delicious steak!" no_targets
     - ^chat "Enjoy!" no_targets
     - ^wait 15t
     - ^give i@cooked_beef
 
+
+MasterChef_stew:
+  type: item
+  material: i@mushroom_soup
+  display name: Mushroom Stew
+  lore:
+    - A tasty Mushroom Stew
+    - prepared by a Master Chef
 
   stew:
     - ^lookclose <npc> state:false
     - ^define foodItems li@brown_mushroom|red_mushroom
     - ^inject s@MasterChefNPC p:getFood_FancyFridge
     - ^inject s@MasterChefNPC p:washFood
     - ^inject s@MasterChefNPC p:prepFood
     - ^define rawFood bowl
     - ^define cookedFood mushroom_soup
     - ^define cookTime 30
     - ^inject s@MasterChefNPC p:boilFood_Attended
+#    - run s@MasterChefNPC p:boilFood_Unattended def:%rawFood%|%cookedFood%|%cookTime%
+#    - action "complete cook" context:ticketNumber|%ticketNumber%|
     - ^lookclose <npc> state:true
     - ^define foodItems li@mushroom_soup
     - ^inject s@MasterChefNPC p:deliverFood
     - ^chat "Here it is, a delicious stew!" no_targets
     - ^chat "Enjoy!" no_targets
     - ^wait 15t
     - ^give i@mushroom_soup
-