-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial.js
More file actions
130 lines (130 loc) · 7.58 KB
/
Copy pathtutorial.js
File metadata and controls
130 lines (130 loc) · 7.58 KB
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
const Room = require("./roomHelpers.js"), Food = require("./foodHelpers.js");
const states = [
{
text: `Hey kids! Welcome to the Tutorial! I bet you're all ready to START COOKING, aren't you? Excellent. Excellent. Well, first thing's first, you need some food to prepare! Someone in Room 2 should type "grab tomato from dispenser" to grab a tomato!`,
advanceCondition: function(gameData) {
for(const pID in gameData.playerDetails) {
const player = gameData.playerDetails[pID];
if(player.holding === null) { continue; }
if(player.room !== 1) { continue; }
if(player.holding.type === "tomato") { return true; }
}
return false;
}
}, {
text: `Excellent! A tomato! The food of the future! The fruit and/or vegetable we all know and love for its role in pizza, pasta, and bad stage productions! Now, we need to chop that tomato, but there are no cutting boards in Room 2! Type "put on table" to put the tomato on a table the players in Room 1 can reach!`,
advanceCondition: function(gameData) {
const tables = Room.GetObjectsOfTypeInRoom(gameData.map, 1, "table");
for(let i = 0; i < tables.length; i++) {
const table = tables[i];
if(table.contents.some(item => item.type === "tomato")) { return true; }
}
return false;
}
}, {
text: `Superb! Tables are nature's way of having things on a thing that isn't the floor! Now, someone in Room 1 should pick up that tomato by typing "grab tomato from table!" Getting the hang of these text commands yet?`,
advanceCondition: function(gameData) {
for(const pID in gameData.playerDetails) {
const player = gameData.playerDetails[pID];
if(player.holding === null) { continue; }
if(player.room !== 0) { continue; }
if(player.holding.type === "tomato") { return true; }
}
return false;
}
}, {
text: `Great! Now, remember: tomatoes are great, but they're even greater after a knife has been used on them several times! Put that tomato on a cutting board by typing "put on cutting board!"`,
advanceCondition: function(gameData) {
const cuttingboards = Room.GetObjectsOfTypeInRoom(gameData.map, 0, "cuttingboard");
for(let i = 0; i < cuttingboards.length; i++) {
const cuttingboard = cuttingboards[i];
if(cuttingboard.contents.some(item => item.type === "tomato")) { return true; }
}
return false;
}
}, {
text: `Tubular! Now it's time to turn that tomato into several fractions of a tomato! Type "cut tomato" to punish it for its hubris!`,
advanceCondition: function(gameData) {
const cuttingboards = Room.GetObjectsOfTypeInRoom(gameData.map, 0, "cuttingboard");
for(let i = 0; i < cuttingboards.length; i++) {
const cuttingboard = cuttingboards[i];
if(cuttingboard.contents.some(item => item.type === "tomato" && Food.HasAttribute(item, "sliced"))) {
const order = { type: "tomato", attributes: ["sliced"], score: 5 };
gameData.orders.push(order);
gameData.discordHelper.SayF(`Order up! Somebody wants ${Food.GetFoodDisplayNameFromObj(order)}, an order worth $${order.score}!`);
return true;
}
}
return false;
}
}, {
text: `Gruncheous! And you're just in time, too! Somebody ordered sliced tomatoes! But before you can serve it, it needs to be plated! All foods must be on a plate before you can serve them! Someone in Room 2 should grab a plate from the plate dispenser and put it on the table!`,
advanceCondition: function(gameData) {
const tables = Room.GetObjectsOfTypeInRoom(gameData.map, 1, "table");
for(let i = 0; i < tables.length; i++) {
const table = tables[i];
if(table.contents.some(item => item.type === "plate")) { return true; }
}
return false;
}
}, {
text: `Baseball! With that plate on the table, you can plate the sliced tomato! Someone in Room 1 should pick up the tomato from the cutting board, then plate it by typing either "put on plate" or "plate!"`,
advanceCondition: function(gameData) {
const tables = Room.GetObjectsOfTypeInRoom(gameData.map, 1, "table");
for(let i = 0; i < tables.length; i++) {
const table = tables[i];
if(table.contents.some(item => item.type === "tomato" && Food.HasAttribute(item, "sliced") && Food.HasAttribute(item, "plated"))) { return true; }
}
return false;
}
}, {
text: `Radical! Now it's time to serve that bad boy! Someone in Room 2 needs to pick up that tomato and type "serve" to serve it and complete the order!`,
advanceCondition: gameData => gameData.orders.length === 0
}, {
text: `Exceptional! Now let's try doing the same with some lettuce! Remember the workflow: In Room 2, grab the lettuce from the dispenser and put it on the table. Then in Room 1, grab it from the table, put it on the cutting board, and chop it. Someone in Room 2 should grab a plate and put it on the table so someone in Room 1 can plate the lettuce, then you can serve it!`,
advanceCondition: () => true
}, {
text: "", advanceCondition: function(gameData) {
const order = { type: "lettuce", attributes: ["sliced"], score: 4 };
gameData.orders.push(order);
gameData.discordHelper.SayF(`Order up! Somebody wants ${Food.GetFoodDisplayNameFromObj(order)}, an order worth $${order.score}!`);
return true;
}
}, {
text: "", advanceCondition: function(gameData) {
const order = { type: "tomato", attributes: ["sliced"], score: 5 };
gameData.orders.push(order);
gameData.discordHelper.SayF(`Order up! Somebody wants ${Food.GetFoodDisplayNameFromObj(order)}, an order worth $${order.score}!`);
return true;
}
}, {
text: "", advanceCondition: function(gameData) {
const order = { type: "lettuce", attributes: ["sliced"], score: 4 };
gameData.orders.push(order);
gameData.discordHelper.SayF(`Order up! Somebody wants ${Food.GetFoodDisplayNameFromObj(order)}, an order worth $${order.score}!`);
return true;
}
}, {
text: `Jinkies! Looks like you've got a handful of orders now! Fulfill them all, and you'll be Ready To Move On! Work together and divide your duties to ensure everything gets done as quickly as possible!`,
advanceCondition: gameData => gameData.orders.length === 0
}, {
text: `Spatulastic! You've got the hang of this! Congratulations on mastering the basics of cooking! Now you're ready for the little leagues!`,
advanceCondition: () => true
}, { text: "", advanceCondition: () => true }
];
module.exports = {
Toot: function(gameData, tutState) {
if(tutState >= states.length) { return -1; }
const tutInfo = states[tutState];
if(!gameData.tutWaiting) {
if(tutInfo.text !== "") { gameData.discordHelper.Say(`**${tutInfo.text}**`); }
gameData.tutWaiting = true;
}
if(tutInfo.advanceCondition(gameData)) {
gameData.tutWaiting = false;
return tutState + 1;
} else {
return tutState;
}
}
};