-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add kitchen_fridge and mage interaction to map_campus_house_1 (#140)
Part of #130
- Loading branch information
Showing
3 changed files
with
96 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/interactions/map_campus_house_1/kitchenFridge.interaction.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { displayDialogue } from '../../utils'; | ||
|
||
const butterBeerDialog = [ | ||
"You see a fresh mug of butterbeer in the fridge and take it. You're not thirsty at the moment, but perhaps someone else in the house might enjoy it.", | ||
]; | ||
|
||
const emptyFridge = ['The refrigerator is now empty.']; | ||
|
||
export const kitchenFridgeInteractions = (player, k, map) => { | ||
player.onCollide('kitchen_fridge', async () => { | ||
player.isInDialog = true; | ||
|
||
if (player?.state?.hasButterBeer) { | ||
await displayDialogue({ | ||
k, | ||
player, | ||
text: emptyFridge, | ||
onDisplayEnd: () => { | ||
player.isInDialog = false; | ||
}, | ||
}); | ||
return; | ||
} | ||
|
||
displayDialogue({ | ||
k, | ||
player, | ||
text: butterBeerDialog, | ||
onDisplayEnd: () => { | ||
player.state.hasButterBeer = true; | ||
player.isInDialog = false; | ||
}, | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters