################################################################################
#
# d R e s t a u r a n t
# For the real Restaurant experience!
#
#
-# Author: |Anthony| calico-kid
+# Authors: |Anthony| calico-kid
# Version: 0.1
# dScript Version: 0.9.5-b1522
+#
+#
+#
+#--- About
+#
+# The dRestarunt system brings realistic NPC animated restaurants to Minecraft.
+# Those with permissions can create new restaurants. Restaurants can be bought
+# and sold, and Waitresses and Chefs can be employed and fired.
#
-#
+# Restaurants must have properly built equipment for the NPCs to be able to do
+# their jobs. NPCs will automagically navigate their environment. A list of
+# equipment and building instructions will follow. Adding more equipment to your
+# restaurant will unlock additional menu items.
+#
+# You can create new menu items by creating a new dRestaurant_item script. Copy
+# the provided template and build your "recipe" using the provided animations.
+# dRestaurant will keep track of ingredient stock and equipment. If a menu item
+# can't be made for whatever reason, it will be removed from the menu for that
+# specific restaurant.
#
-################################################################################
+# Each restaurant can have it's own menu. Restaurant owners are responsible for
+# hiring chefs and waitresses, keeping raw materials stocked, building kitchen
+# equipment, and creating their menus. Players can learn new menu items by
+# buying a menu item from an existing restaurant and adding it to their menu.
+# Server owned restaurants can add any menu item to any restaurant provided it
+# has the correct equipment.
#
-MasterWaitress:
- type: assignment
+#
+#--- Permissions
- 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
+#--- Ticket System
-# 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.
#
+# The Ticket System is a single flag that holds all the ticket information for
+# all restaurants. We're using <util.random.duuid> for our ticket numbers to
+# avoid some silly indexing method.
#
-#--------------------------------------
-# Click Responses
+# It contains a list of lists and is structured like this:
+# - %ticketNumber%/%chef%/%waitress%/<player>/%foodItems%|...
#
- click_drunk:
- # A catchall if something derps
+# To get a list of all ticket numbers:
+# - <server.flag[RestaurantTickets].get_sub_items[1].split_by[/]>
- - 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
+# To get a specific ticket object
+# - define tickets '<server.flag[RestaurantTickets].as_list>'
+# - define ticket '<def[tickets].get[<def[tickets].get_sub_items[1].split_by[/].find[%ticketNumber%]>]>'
#
- 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>
-
+# To get ticket details
+# - define ticketNumber '<def[ticket].split_by[/].get[1]>'
+# - 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]>'
+#
+# To add a new ticket
- 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
-#--------------------------------------
#
+# To remove an existing ticket
#
-# END MASTERWAITRESS ASSIGNMENT SCRIPT CONTAINER
#
################################################################################
#
# dRestaurant World Script
#
-# This should cover all restaurant related world events
+# This should cover all restaurant related world events. This is also the house
+# for all of the equipment locators and the animations.
#
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 server RestaurantTickets:->:<server.flag[RestaurantTickets]as_list.size.add[1].as_int>/%chef%/%waitress%/<player>/
}
- 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
#--------------------------------------
#
+# Kitchen Equipment Locators
#
-# END DRESTAURANT WORLD SCRIPT
+# 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%]>
+ }
+ }
+ }
+ }
+
+ findtap:
+ # The tap is a tripwire hook under a lever
+ - define range 15
+ - define tap <npc.location.find.blocks[tripwire_hook].within[%range%]||null>
+ - if <def[tap].is[!=].to[null]>
+ && !<def[tap].is_empty> {
+ - define locations li@
+ - foreach %tap% {
+ - define tap '%value%'
+ - if <def[tap].above.material.name.is[!=].to[lever]||true> foreach next
+
+ - define east '<def[tap].add[1,0,0]>'
+ - define west '<def[tap].add[-1,0,0]>'
+ - define north '<def[tap].add[0,0,1]>'
+ - define south '<def[tap].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].sub[0,1,0].material.name.is[==].to[air]>
+ && <def[location].sub[0,2,0].material.is_solid> {
+ - define locations <def[locations].include[%tap%/<def[location].below>]>
+ }
+ }
+ }
+ }
+
+ findWindow_chef:
+ # The Window is an upside down stair block with a carpet on top and a
+ # redstone_lamp_on above that. It must have an air block in front of it.
+ # This is the same window that the Waitress picks up food from. The chef
+ # delivers cooked food to the side of the window inside the kitchen. Be sure
+ # to have carpet on the floor in front of the window (outside the kitchen) so
+ # the chef and waitress are finding the same windows!
+ - 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%]>
+ }
+ }
+ }
+ }
+
+ findWindow_waitress:
+ # The Window is an upside down stair block with a carpet on top and a
+ # redstone_lamp_on above that. It must have a carpet block in front of it.
+ # This is the same window that the Chef places food on. The Waitress picks up
+ # the cooked food from outside the kitchen.
+ # Be sure to have an air block on the side of the window opposite the carpet
+ # (outside the kitchen) so the chef and waitress are finding the same windows!
+ - 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%]>
+ }
+ }
+ }
+ }
+
+#
+# END Kitchen Equipment Locators
+#--------------------------------------
+#
+# 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
#
-################################################################################
#
-# Idk what these are for
+#-----------------------
+# Chef Specific Animations
#
-i@beefstew:
- type: task
- script:
- - wait 10s
- - announce "<red>hi there!!!"
+ 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
-i@mushroomstew:
- type: task
- script:
- - announce "<green>hi!!!"
- - wait 10s
-################################################################################
+ 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_chef:
+ # Walk to the window and deliver the %foodItems%
+ - ^inject locally findWindow_chef 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>]>'
+ }
+ - ^action "order up" context:ticket|%ticket%
+
+
+#-----------------------
+# Waitress Specific Animations
+#
+ deliverFood_waitress:
+ # Walk to window, collect the %foodItems%, and deliver them to the player.
+ # Currently using a simple walkto command. This may lead to table dancers.
+ # Find the window and walk to it
+ - ^inject locally findWindow_waitress 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%
+ - ^wait 10t
+ # Pickup the food
+ - ^remove %foodItems%
+ - ~equip <npc> hand:<i@air>
+ - ^wait 10t
+ # Really should have a method to ensure that the player is still online and
+ # still in the restaurant before we proceed.
+ - ^if <def[player].location.distance[<npc.location>].is[OR_LESS].than[30]> {
+ - ~walkto %player%
+ - ^wait 10t
+# Not sure if this is sane without a table locator or if it's needed at all.
+# - ^foreach %foodItems% {
+# - displayitem <def[value].as_item> '<def[player].location.add[1,0,0]>' d:10s
+# - give player:%player% <def[value].as_item>
+# }
+ - ^give player:%player% %foodItems%
+ }
+ else give player:%player% %foodItems%
+#
+# END Animations
+#--------------------------------------
+#
+#
+# END DRESTAURANT WORLD SCRIPT
+#
################################################################################
#
# 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 <<>tool<>>
- /drestaurant <<>create<>> <<>name<>>
- /drestaurant <<>edit<>> <<>name<>>
- /drestaurant <<>delete<>> <<>name<>>
- /drestaurant <<>hire<>> <<>waitress/chef<>>
+ - /drestaurant <<>fire<>> <<>waitress/chef<>>
+ - /drestaurant <<>buy<>> <<>restaurant<>>
+ - /drestaurant <<>sell<>> <<>restaurant<>>
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.
#
+ 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
+
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>
+ - if <def[pos1].is[==].to[null]>
+ || <def[pos2].is[==].to[null]> {
+ - narrate "<&4><&l>ERROR<&co><&r> <&a>You must use the dRestaurant region tool to select 2 locations!"
+ - queue stop
+ }
+ - take i@dRestaurantTool
- note cu@%pos1%|%pos2% 'as:restaurant_%name%'
- flag server Restaurant.%name%.Owner:<player>
+ - flag player dRestaurantToolPOS1:!
+ - flag player dRestaurantToolPOS2:!
}
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>
+ - if <def[pos1].is[==].to[null]>
+ || <def[pos2].is[==].to[null]> {
+ - narrate "<&4><&l>ERROR<&co><&r> <&a>You must use the dRestaurant region tool to select 2 locations!"
+ - queue stop
+ }
+ - take i@dRestaurantTool
- note cu@%pos1%|%pos2% 'as:restaurant_%name%'
+ - flag player dRestaurantToolPOS1:!
+ - flag player dRestaurantToolPOS2:!
}
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%:!
}
+
+ hire:
+ - stub
+
+ fire:
+ - stub
- stub:
+ buy:
+ - stub
+
+ sell:
- 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
+#
+################################################################################
+#
+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 during 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]||<c.food.as_list>>'
+ # 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>
+
+ processTicketQueue:
+ # Run through a list of orders waiting to be delivered. Check the flag once
+ # more before completion to make sure no new tickets were added to the queue.
+ - if !<npc.flag[TicketQueue].as_list.is_empty> {
+ - flag npc Status:deliver
+ - foreach <npc.flag[TicketQueue]> {
+ - inject s@dRestaurant p:deliverFood_waitress
+ - flag npc TicketQueue
+ }
+ - if !<npc.flag[TicketQueue].as_list.is_empty> inject processTicketQueue locally
+ }
+ - flag npc Status:available
+
+
+#
+#--------------------------------------
+#
+# 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 Custom Items
#
# dRestaurant uses a lot of custom items to do different things.
#
#
-#
#--------------------------------------
#
# Menu items
#
menu:
type: item
material: i@book
display name: menu
+
+dRestaurant_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@dRestaurant p:getFood_FancyFridge
+ - ^inject s@dRestaurant p:washFood
+ - ^inject s@dRestaurant p:prepFood
+ - ^define foodItem baked_potato
+ - ^inject s@dRestaurant p:bakeFood_Attended
+ - ^lookclose <npc> state:true
+ - ^define foodItems li@baked_potato
+ - ^inject s@dRestaurant p:deliverFood_chef
+
+dRestaurant_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@dRestaurant p:getFood_FancyFridge
+ - ^inject s@dRestaurant p:prepFood
+ - ^define rawFood raw_beef
+ - ^define cookedFood cooked_beef
+ - ^define cookTime 30
+ - ^inject s@dRestaurant p:grillFood_Attended
+ - ^lookclose <npc> state:true
+ - ^define foodItems li@cooked_beef
+ - ^inject s@dRestaurant p:deliverFood_chef
+dRestaurant_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@dRestaurant p:getFood_FancyFridge
+ - ^inject s@dRestaurant p:washFood
+ - ^inject s@dRestaurant p:prepFood
+ - ^define rawFood bowl
+ - ^define cookedFood mushroom_soup
+ - ^define cookTime 30
+ - ^inject s@dRestaurant p:boilFood_Attended
+# - run s@dRestaurant p:boilFood_Unattended def:%rawFood%|%cookedFood%|%cookTime%
+# - action "complete cook" context:ticketNumber|%ticketNumber%|
+ - ^lookclose <npc> state:true
+ - ^define foodItems li@mushroom_soup
+ - ^inject s@dRestaurant p:deliverFood_chef
+
+
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
#
################################################################################
-