From dd066f0aa32cdda1a79583ad274ab237ca1c09b2 Mon Sep 17 00:00:00 2001 From: Talon Date: Fri, 5 Nov 2021 00:02:02 +0100 Subject: [PATCH] Actually split on new lines --- src/engine/output.js | 5 ++++- src/game/rooms/start.js | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/engine/output.js b/src/engine/output.js index e9c1ee1..7256d11 100644 --- a/src/engine/output.js +++ b/src/engine/output.js @@ -9,7 +9,10 @@ export default class Output { say(string) { const node = document.createElement("p"); - node.appendChild(document.createTextNode(string)); + string.split("\n").forEach((line) => { + node.appendChild(document.createTextNode(line)); + node.appendChild(document.createElement("br")); + }); this.history.appendChild(node); // this.tts.speak(string); } diff --git a/src/game/rooms/start.js b/src/game/rooms/start.js index 6682aef..2371417 100644 --- a/src/game/rooms/start.js +++ b/src/game/rooms/start.js @@ -3,7 +3,12 @@ import RoomBuilder from '../../engine/builders/room'; export default new RoomBuilder() .withID("start") .withTitle("The starting room") -.withFirstDescription("You set foot in your very first room") +.withFirstDescription(` +You set foot in your very first ever room. +You're not quite sure what you were supposed to expect, but it definitely wasn't this. +I mean who would expect a boring old room like this one? Ugh. +Just... make it stop. Please. +`) .withDescription("The first room. Nothing special about it.") .withExit("north", "tunnel_1") .withEnterCallback(async function(context) {