-
Notifications
You must be signed in to change notification settings - Fork 92
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
1 parent
63bfc00
commit 3b7a852
Showing
2 changed files
with
38 additions
and
0 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
37 changes: 37 additions & 0 deletions
37
src/interactions/map_campus_house_1/restroom_toilet.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,37 @@ | ||
import { time } from '../../kplayCtx'; | ||
import { displayDialogue, displayPermissionBox } from '../../utils'; | ||
import { updateEnergyState } from '../../utils/energyUpdate'; | ||
|
||
export const restroomToiletInteractions = (player, k, map) => { | ||
player.onCollide('restroom_toilet', async () => { | ||
let wantUseToilet = await displayPermissionBox({ | ||
k, | ||
player, | ||
text: [ | ||
'Do you need to use the restroom? (Time advances 15 minutes)', | ||
], | ||
}); | ||
|
||
const dialogue = []; | ||
|
||
if (wantUseToilet) { | ||
time.minutes += 15; | ||
dialogue.push('You feel relieved!'); | ||
dialogue.push('Ready to continue your journey.'); | ||
updateEnergyState(player.state, player.state.energy + 10); // Optional small energy boost | ||
} else { | ||
if (player.state.energy < 50) { | ||
dialogue.push('Maybe you should take a break.'); | ||
dialogue.push('It could help you feel more comfortable.'); | ||
} else { | ||
dialogue.push('You decide to keep going for now.'); | ||
} | ||
} | ||
|
||
displayDialogue({ | ||
k, | ||
player, | ||
text: [dialogue.join(' ')], | ||
}); | ||
}); | ||
}; |