forked from zero-to-mastery/ZTM-Quest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenterMapCityRight.interactions.js
More file actions
71 lines (68 loc) · 2.29 KB
/
enterMapCityRight.interactions.js
File metadata and controls
71 lines (68 loc) · 2.29 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
import { displayDialogue } from '../../utils';
import {
receiveQuest,
retrieveQuestObjectiveStatus,
} from '../../utils/questHandler';
import { map_start_quests } from '../quests/constants.quests';
export const enterMapCityRightInteraction = (player, k, map) => {
const questName = 'Start Interacting!';
player.onCollide('enter_map_right', async () => {
const hasTalkedToBruno = retrieveQuestObjectiveStatus(
player,
questName,
'hasTalkedToBruno'
);
const wasInRestroom = retrieveQuestObjectiveStatus(
player,
questName,
'wasInRestroom'
);
const hasWashedHands = retrieveQuestObjectiveStatus(
player,
questName,
'hasWashedHands'
);
// Collision point (Enter map boundary) //! NOT THE SPAWNPOINT
if (
hasTalkedToBruno &&
wasInRestroom &&
hasWashedHands &&
questName in player.state.quests
) {
k.go('city', 'spawn_office_right'); // City spawn point
} else {
await receiveQuest(player, map_start_quests['Start Interacting!']);
if (!hasTalkedToBruno) {
displayDialogue({
k,
player,
text: [
'You should talk to Bruno first.',
'He is the guy with the beautiful suit to your left side.',
],
});
return;
} else {
if (!wasInRestroom) {
displayDialogue({
k,
player,
text: [
'You should visit the restroom first.',
'Remember what bruno said? It will be a long journey.',
"Don't forget to wash your hands.",
],
});
return;
}
if (!hasWashedHands) {
displayDialogue({
k,
player,
text: ['You should wash your hands first.'],
});
}
}
}
});
};