################################################################################
#
# 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 <<>tool<>>
- /drestaurant <<>create<>> <<>name<>>
- /drestaurant <<>edit<>> <<>name<>>
- /drestaurant <<>delete<>> <<>name<>>
- /drestaurant <<>hire<>> <<>waitress/chef<>>
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
#
################################################################################
-