-
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.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/interactions/map_campus_house_1/diningtableinteraction.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,37 @@ | ||
import { time } from '../../kplayCtx'; | ||
import { displayDialogue, displayPermissionBox } from '../../utils'; | ||
import { updateEnergyState } from '../../utils/energyUpdate'; | ||
|
||
export const diningTableInteractions = (player, k, map) => { | ||
player.onCollide('diningTable', async () => { | ||
let wantEat = await displayPermissionBox({ | ||
k, | ||
player, | ||
text: [ | ||
'Are you hungry? Would you like to have a meal? (Time advances 1 hour)', | ||
], | ||
}); | ||
|
||
const dialogue = []; | ||
|
||
if (wantEat) { | ||
time.minutes += 60; | ||
dialogue.push('You enjoyed a delicious meal!'); | ||
dialogue.push('You feel more energized now.'); | ||
updateEnergyState(player.state, 75); | ||
} else { | ||
if (player.state.energy < 50) { | ||
dialogue.push('You look a bit weak.'); | ||
dialogue.push('It might be time for a meal!'); | ||
} else { | ||
dialogue.push('No worries, maybe later!'); | ||
} | ||
} | ||
|
||
displayDialogue({ | ||
k, | ||
player, | ||
text: [dialogue.join(' ')], | ||
}); | ||
}); | ||
}; |
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