| @@ -95,6 +95,36 @@ stories.push({ | |||||
| if (state.player.stats.health.value <= 0) { | if (state.player.stats.health.value <= 0) { | ||||
| state.player.stats.health.value = 0; | state.player.stats.health.value = 0; | ||||
| const start = 86400 - 60 * 25 - 25; | |||||
| const end = state.info.time.value; | |||||
| const time_survived = end - start; | |||||
| const minutes = Math.floor(time_survived / 60); | |||||
| const seconds = time_survived % 60; | |||||
| const minute_text = minutes + (minutes == 1 ? " minute" : " minutes"); | |||||
| const second_text = seconds + (seconds == 1 ? " second" : " seconds"); | |||||
| let time_text; | |||||
| if (minutes == 0) | |||||
| time_text = "You survived for " + second_text + "."; | |||||
| else | |||||
| time_text = "You survived for " + minute_text + " and " + second_text + "."; | |||||
| startTimer({ | |||||
| id: "time-text", | |||||
| func: state => { | |||||
| print([time_text]); | |||||
| return true; | |||||
| }, | |||||
| delay: 2000, | |||||
| loop: false, | |||||
| classes: [ | |||||
| ] | |||||
| }, state); | |||||
| if (location.startsWith("stomach")) { | if (location.startsWith("stomach")) { | ||||
| goToRoom("digested-stomach", state); | goToRoom("digested-stomach", state); | ||||
| } | } | ||||