################################################################################
#
# 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
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>, or <&f>fridge<&7> and I will find it."
- - chat "<&7>Or you can tell me <&f>potato<&7> and I will make a baked potato for you."
+ - 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>
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
+ - ^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%
- queue stop
}
- - ^define options li@fridge|fancyFridge|grill|sink|prep|oven|stove|window
+ - ^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
- 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@[<def[furnace2].material.name.is[!=].to[furnace]>].or[<def[furnace2].material.name.is[!=].to[burning_furnace]>]>
- && <el@[<def[furnace2].below.material.name.is[!=].to[furnace]>].or[<def[furnace2].below.material.name.is[!=].to[burning_furnace]>]> foreach next
+ - 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
- 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
+ - ^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
+ - ^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
+ - ^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
+ - ^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>]>'
}
- - ^animate <npc> animation:SNEAK
- - ^animate <npc> animation:ARM_SWING
- - ^playsound %sinkLoc% sound:splash2
- - ^repeat 5 {
- - animate <npc> animation:ARM_SWING
- - playsound %sinkLoc% sound:swim
- - wait 5t
+ - ^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
- - playsound <npc.location> sound:step_ladder
+ - ^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 <npc.location> sound:ghast_fireball
- - ^showfake m@burning_furnace,<def[furnace].material.data> %furnace% to:<npc.location.find.players.within[10]> d:200t
+ - ^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 <def[furnace].location> sound:%sound%
+ - ^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:
- # Walk to oven and bake the %foodItem%
+ # I have to figure out a method for making some cook processes be unattended
- # 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 <npc.location> sound:ghast_fireball
- - ^showfake m@burning_furnace,<def[furnace].material.data> %furnace% to:<npc.location.find.players.within[10]> d:200t
+ - ^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 <def[furnace].location> sound:%sound%
+ - ^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 <npc.location> sound:ghast_fireball
- - ^displayitem <def[rawFood].as_item> '%grill%' d:30s save:rawFood
- - ^repeat 20 {
- - ^define sound '<li@fuse|fire.random>'
- - ^playsound <def[furnace].location> sound:%sound%
- - ^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|fire.random>'
- - ^playsound <def[furnace].location> sound:%sound%
+ - ^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
#
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
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
+
+ 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
+ - ^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