Paste #10195: Diff note for paste #10194

Date: 2014/09/30 20:53:25 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


 ################################################################################
 #
 #                         d  R  e  s  t  a  u  r  a  n  t
 #                       For the real Restaurant experience!
 #
 #
 #   Author: |Anthony| calico-kid
 #   Version: 0.1
 #   dScript Version: 0.9.5-b1522
 #
 # 
 #
 ################################################################################
 #
 MasterWaitress:
   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 delay:5s
     on click:
       - run locally click_<npc.flag[status]||drunk> instantly
     # Custom event fired by the chef when an order is complete
     on order up:
       # take a snapshot of all current tickets so we aren't effected by any
       # list changes that could happen durring processing.
       - define tickets '<server.flag[RestaurantTickets].as_list>'
       - define ticket '<def[tickets].get[<def[tickets].get_sub_items[1].split_by[/].find[<c.ticket>]>]>'
       # Define the ticket details
       - define ticketNumber '<def[ticket].split_by[/].get[1]||<c.ticket>>'
       - define chef '<def[ticket].split_by[/].get[2].as_npc>'
       - define waitress '<def[ticket].split_by[/].get[3].as_npc>'
       - define player '<def[ticket].split_by[/].get[4].as_player>'
       - define food '<def[ticket].split_by[/].get[5]>'
       # Let the waitress decide what to do based on status
       - inject locally orderup_<def[waitress].flag[Status]||drunk>
 
 
   assignment:
   # What happens on assignment. We want this as a subscript so we can run it
   # outside the on assignment action if needed.
     - 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:15
     - flag npc Pathfind.FidgetSpeed:0.7
     - flag npc Pathfind.FidgetWait:5
     - 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
     - if <queue.exists[fidgetQueue_<npc.id>]> queue queue:fidgetQueue_<npc.id> stop
     - run s@Fidget id:fidgetQueue_<npc.id>
 #
 #--------------------------------------
 #
 #  MasterWaitress Status Actions
 #
 # We're using an NPC status system for action responses. This is a low latency
 # and low load method that allows for very fast NPC reactions since they do not
 # have to do ANY comparisons. They just run the correct subscript based on the
 # action and their current status.
 #
 #
 #--------------------------------------
 #  Click Responses
 #
   click_drunk:
   # A catchall if something derps
     - flag npc status:drunk
     - if <queue.exists[fidgetQueue_<npc.id>]> queue queue:fidgetQueue_<npc.id> stop
     - chat "I<&sq>m not feeling well... I have to go." no_target
     - wait 2s
     - despawn <npc>
 
   click_available:
   # When the Waitress is available for whatever
     - flag npc status:order
     - if <queue.exists[fidgetQueue_<npc.id>]> queue queue:fidgetQueue_<npc.id> stop
     - give i@menu
 
   click_order:
   # When the Waitress is taking an order
     - stub
 
   click_deliver:
   # When the Waitress is delivering food
     - stub
 
 #
 #--------------------------------------
 #  Order Up Responses
 #
   orderup_drunk:
   # A catchall if something derps
     - flag npc status:drunk
     - if <queue.exists[fidgetQueue_<npc.id>]> queue queue:fidgetQueue_<npc.id> stop
     - chat "I<&sq>m not feeling well... I have to go." no_target
     - wait 2s
     - despawn <npc>
 
   orderup_available:
   # When the Waitress is available for whatever
     - flag npc status:deliver
     - if <queue.exists[fidgetQueue_<npc.id>]> queue queue:fidgetQueue_<npc.id> stop
 
   orderup_order:
   # When the Waitress is taking an order
     - stub
 
   orderup_deliver:
   # When the Waitress is delivering food
     - stub
 
 #
 #  END MasterWaitress Status Actions
 #--------------------------------------
 #
 #
 #  END MASTERWAITRESS ASSIGNMENT SCRIPT CONTAINER
 #
 ################################################################################
 #
 #  dRestaurant World Script
 #
 # This should cover all restaurant related world events
 #
 dRestaurant:
   type: world
   debug: false
 
   events:
 #--------------------------------------
 #  dRestaurant NPC events
 #
     on player right clicks with i@menu:
       - inventory open d:<player.flag[restaurant].as_npc.inventory>
 
     on player clicks in inventory:
       - if <c.inventory> == <player.flag[restaurant].as_npc.inventory> {
         - if <player> == <player.flag[restaurant].as_npc.owner> {
           - queue clear
           }
         - flag player order:->:<c.item>
         - determine passively cancelled
         - inventory update
         }
 
     on player closes inventory:
       - if <c.inventory> == <player.flag[restaurant].as_npc.inventory> {
         - take i@menu
         - foreach <player.flag[order].as_list> {
           - ~run MasterChefNPC as:<player.flag[chef]> path:%value%
           }
         - flag player order:!
         }
 
     on player right clicks with i@chefegg:
       - create player chef712 <player.location.cursor_on.add[0.5,1,0.5]>
       - execute as_op "npc select"
       - assignment set script:MasterChefNPC npc:<player.selected_npc>
       - take i@chefegg
       - give i@waitressegg
       - flag player chef:<player.selected_npc>
 
     on player right clicks with i@waitressegg:
       - create player waitress <player.location.cursor_on.add[0.5,1,0.5]>
       - execute as_op "npc select"
       - assignment set script:waitress npc:<player.selected_npc>
       - take i@waitressegg
       - flag <player.selected_npc> chef:<player.flag[chef]>
 
 #
 #  END dRestaurant NPC events
 #--------------------------------------
 #  Cuboid Selection
 #
     on player right clicks block with dRestaurantTool:
     - determine passively CANCELLED
     - if !<player.has_permission[dRestaurant.create]> {
       - take i@dRestaurantTool
       - narrate "<&4><&l>ERROR<&co><&r> <&a>You should not have this!"
       - queue stop
       }
     - narrate "<&b><&l>dRestaurant<&co><&r> <&a>Set POS1 to <context.location.simple>"
     - flag player dRestaurantToolPOS1:<context.location>
     
     on player left clicks block with dRestaurantTool:
     - determine passively CANCELLED
     - if !<player.has_permission[dRestaurant.create]> {
       - take i@dRestaurantTool
       - narrate "<&4><&l>ERROR<&co><&r> <&a>You should not have this!"
       - queue stop
       }
     - narrate "<&b><&l>dRestaurant<&co><&r> <&a>Set POS2 to <context.location.simple>"
     - flag player dRestaurantToolPOS2:<context.location>
 
 #
 #  END Cuboid Selection
 #--------------------------------------
 #
 #
 #  END DRESTAURANT WORLD SCRIPT
 #
 ################################################################################
 #
 # Idk what these are for
 #
 i@beefstew:
   type: task
   script:
   - wait 10s
   - announce "<red>hi there!!!"
 
 i@mushroomstew:
   type: task
   script:
   - announce "<green>hi!!!"
   - wait 10s
 ################################################################################
 
 
 
 
 
 
 
 ################################################################################
 #
 #  Restaurant Command Script Container
 #
 # This script covers all dRestaurant commands
 #
 #
 #  DATA STORAGE
 #   - Currently using flags. Might convert to yaml.
 #
 #
 #
 #
 #--------------------------------------
 #
 #  dRestaurant Command Script Basics
 #
 # The basic stuff required in a command script container
 #
 dRestaurantCommand:
   type: command
   debug: false
   name: drestaurant
   description: Commands to create and manage dRestaurants.
   usage:
   - /drestaurant <&lt>tool<&gt>
   - /drestaurant <&lt>create<&gt> <&lt>name<&gt>
   - /drestaurant <&lt>edit<&gt> <&lt>name<&gt>
   - /drestaurant <&lt>delete<&gt> <&lt>name<&gt>
   - /drestaurant <&lt>hire<&gt> <&lt>waitress/chef<&gt>
   aliases:
   - restaurant
   - dr
   - drest
   allowed help:
   - determine <player.has_permission[dRestaurant.user]>
 # This is what is run when someone types the root command. This subscript
 # quickly passes the command on to the command argument handlers below. If the
 # argument doesn't exist, or is not specified, it runs the help subscript.
   script:
     - inject locally <c.args.get[1].escaped||help>
     - inject locally help
 #
 #
 #  END dRestaurant Command Script Basics
 #--------------------------------------
 #
 #  dRestaurant Command Arguments
 #
 # Each of these subscripts is an argument for the root command.
 #
   tool:
     - if <player.has_permission[dRestaurant.create]> {
       - give i@dRestaurantTool
       - narrate "<&b><&l>BAB<&co><&r> <&a>Right click to select pos1"
       - narrate "<&b><&l>BAB<&co><&r> <&a>Left click to select pos2"
       - queue stop
       }
 
   help:
     - if <player.has_permission[dRestaurant.create]> inject locally msgsHelpAdmin instantly
       else inject locally msgsHelpUser instantly
     - define footerText '<&f><&sp><&sp>Authors<&co> <&7>|Anthony|<&f>, <&7>calico-kid'
     - inject locally msgsFooter instantly
     - queue stop
 
   create:
     - if <player.has_permission[dRestaurant.create]> {
       - define name '<c.args.get[2].escaped||null>'
       - if <def[name].is[==].to[null]> {
         - narrate "<&4><&l>ERROR<&co><&r> <&a>You must specify a name!"
         - queue stop
         }
       - if <cu@restaurant_%name%||null> != null {
         - narrate "<&4><&l>ERROR<&co><&r> <&a>There is already a restaurant by this name!"
         - queue stop
         }
       - define pos1 <player.flag[dRestaurantToolPOS1]||null>
       - define pos2 <player.flag[dRestaurantToolPOS2]||null>
       - note cu@%pos1%|%pos2% 'as:restaurant_%name%'
       - flag server Restaurant.%name%.Owner:<player>
       }
 
   edit:
     - define name '<c.args.get[2].escaped||null>'
     - if <player.has_permission[dRestaurant.admin]>
       || <el@val[<player.has_permission[dRestaurant.create]>].and[<server.flag[Restaurant.%name%.Owner].is[==].to[<player>]>]> {
       - if <def[name].is[==].to[null]> {
         - narrate "<&4><&l>ERROR<&co><&r> <&a>You must specify a name!"
         - queue stop
         }
       - if <cu@restaurant_%name%||null> == null {
         - narrate "<&4><&l>ERROR<&co><&r> <&a>There is no restaurant by this name!"
         - queue stop
         }
       - define pos1 <player.flag[dRestaurantToolPOS1]||null>
       - define pos2 <player.flag[dRestaurantToolPOS2]||null>
       - note cu@%pos1%|%pos2% 'as:restaurant_%name%'
       }
 
   delete:
     - define name '<c.args.get[2].escaped||null>'
     - if <player.has_permission[dRestaurant.admin]>
       || <el@val[<player.has_permission[dRestaurant.create]>].and[<server.flag[Restaurant.%name%.Owner].is[==].to[<player>]>]> {
       - if <def[name].is[==].to[null]> {
         - narrate "<&4><&l>ERROR<&co><&r> <&a>You must specify a name!"
         - queue stop
         }
       - if <cu@restaurant_%name%||null> == null {
         - narrate "<&4><&l>ERROR<&co><&r> <&a>There is no restaurant by this name!"
         - queue stop
         }
       - note remove 'as:restaurant_%name%'
       - flag server Restaurant.%name%:!
       }
 
-  delete:
-    - define name '<c.args.get[2].escaped||null>'
+  stub:
+    - stub
 #
 #
 #  END dRestaurant Command Arguments
 #--------------------------------------
 #
 #  dRestaurant Command Messages
 #
 # These are not complete! They are mostly just stubs till the rest is fleshed out!
 #
   msgsHeader:
     - ^narrate "<&5>|----------------------------------------|"
     - ^narrate "<&5>|<&sp><&sp><&sp><&6>dRestaurant   <&7>%msgsHeaderTitle%"
     - ^narrate "<&5>|<&sp><&sp><&sp><&e>MineConomy    <&f>Exclusive"
     - ^narrate "<&5>|<&f>"
 
   msgsFooter:
     - ^narrate "<&5>|<def[footerText]||>"
     - ^narrate "<&d>|-----------S-c-r-o-l-l---U-p-------------|"
 
   msgsHelpAdmin:
     - define msgsHeaderTitle 'Admin Help'
     - inject locally msgsHeader instantly
     - ^narrate "<&5>|<&sp><&sp><&sp><&sp><&f>You can create restaurants and staff"
     - ^narrate "<&5>|<&sp><&sp><&f>them with chefs and waitresses that will"
     - ^narrate "<&5>|<&sp><&sp><&f>automagically tend to your guests. Just keep"
     - ^narrate "<&5>|<&sp><&sp><&f>your restaurant stocked with the materials for"
     - ^narrate "<&5>|<&sp><&sp><&f>your menu and have the proper kithen equimpent."
     - ^narrate "<&5>|<&sp><&f>"
 
   msgsHelpUser:
     - define msgsHeaderTitle 'User Help'
     - inject locally msgsHeader instantly
     - ^narrate "<&5>|<&sp><&sp><&sp><&sp><&f>dRestaurant brings a realistic restaurant"
     - ^narrate "<&5>|<&sp><&sp><&f>experience to Minecraft. Fully automated NPCs will"
     - ^narrate "<&5>|<&sp><&sp><&f>serve your customers and prepare their food."
     - ^narrate "<&5>|<&sp><&f>"
 
 #
 #  END dRestaurant Command Messages
 #--------------------------------------
 #
 #
 #  END DRESTAURANT COMMAND SCRIPT
 #
 ################################################################################
 #
 #  dRestaurant Custom Items
 #
 # dRestaurant uses a lot of custom items to do different things.
 #
 #
 #
 #--------------------------------------
 #
 #  Menu items
 #
 menu:
   type: item
   material: i@book
   display name: menu
 
 beefstew:
   type: item
   material: mushroom_soup
   display name: "beef stew"
 
 mushroomstew:
   type: item
   material: mushroom_soup
   display name: "mushroom stew"
 
 #
 #  END Menu Items
 #--------------------------------------
 #
 #  Other items
 #
 waitressegg:
   type: item
   material: m@monster_egg
   display name: waitress
 
 chefegg:
   type: item
   material: m@monster_egg
   display name: chef
 
 dRestaurantTool:
   type: item
   material: stick
   display name: <&3>Restaurant Region Tool
   lore:
   - <&f>Right click to set pos1
   - <&f>Left click to set pos2
 
 #
 #  END Other Items
 #--------------------------------------
 #
 #
 #  END DRESTAURANT CUSTOM ITEMS
 #
 ################################################################################
-