Skip to content

Commit

Permalink
add restroom_toilet interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
kapish9741 committed Oct 27, 2024
1 parent 63bfc00 commit 3b7a852
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/interactions/map_campus_house_1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const interactions = [
bedroomTableInteractions,
livingroomcouchInteractions,
bedroomPlantInteractions,
restroomToiletInteractions,
];

export default interactions;
37 changes: 37 additions & 0 deletions src/interactions/map_campus_house_1/restroom_toilet.interaction.js
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(' ')],
});
});
};

0 comments on commit 3b7a852

Please sign in to comment.