diff --git a/assets/projects/the-backrooms/sfx/baby.wav b/assets/projects/the-backrooms/sfx/baby.wav new file mode 100644 index 00000000..68a17b5e Binary files /dev/null and b/assets/projects/the-backrooms/sfx/baby.wav differ diff --git a/src/projects/the-backrooms/index.js b/src/projects/the-backrooms/index.js index 559be574..b8705cdd 100644 --- a/src/projects/the-backrooms/index.js +++ b/src/projects/the-backrooms/index.js @@ -166,8 +166,8 @@ ON GOT_RUNE { >>WELCOME_MESSAGE { PLAY -o "system" - HEROSAY "You've noclipped out of reality and landed in the backrooms!" - QUEST "You've noclipped out of reality and landed in the backrooms!" + HEROSAY "You've noclipped out of reality and landed in the backrooms! You might leave by exiting through an unmarked fire exit." + QUEST "You've noclipped out of reality and landed in the backrooms! You might leave by exiting through an unmarked fire exit." RETURN } @@ -203,7 +203,7 @@ ON GOT_RUNE { )(items.marker); }; -const createJumpscareController = (pos, config) => { +const createJumpscareController = (pos, lampCtrl, config) => { return compose( markAsUsed, moveTo(pos, [0, 0, 0]), @@ -236,6 +236,10 @@ ON PICKUP { } } + if (^$PARAM1 == "key:exit") { + GOSUB BABY + } + ACCEPT } @@ -288,18 +292,20 @@ ON SPELLCAST { } >>BABY { - // save lámpa state - // 100ms villanás sárgába, mint az exit-nél - // összes lámpa kialszik - // sebesség lelassítása player-nél -> 0.3-ra - // kis pause, babasírás fadein - // szívdobogás hang - // random lámpa felkapcsolások, vagy az összes lámpa felkapcsolása? - // 5 másodperc ott tartás - // fadeout feketébe - // hang kikapcs - // lámpák restore - // hang vissza + PLAY -o "strange_noise1" + PLAY -oil "player_heartb" + PLAY -o "baby" + SENDEVENT SAVE ${lampCtrl.ref} NOP + SENDEVENT SETSPEED player 0.3 + WORLDFADE OUT 10 ${color("khaki")} WORLDFADE IN 500 NOP + + TIMERoff -m 1 600 SENDEVENT OFF ${lampCtrl.ref} NOP + TIMERstopheartbeat -m 1 13000 PLAY -os "player_heartb" + + TIMERend -m 1 13000 SENDEVENT RESTORE ${lampCtrl.ref} NOP + TIMERspeedrestore -m 1 14000 SENDEVENT SETSPEED player 1 + + RETURN } `; }), @@ -343,6 +349,7 @@ ON SPELLCAST { "projects/the-backrooms/whispers/german/no-exit.wav", "speech/deutsch/whisper--no-exit.wav" ), + addDependencyAs("projects/the-backrooms/sfx/baby.wav", "sfx/baby.wav"), declare("int", "magicCntr", 0), declare("int", "almondwaterCntr", 0), createItem @@ -428,7 +435,7 @@ ON ACTION { )(items.doors.lightDoor, { name: "Unmarked fire exit" }); }; -const createKey = (pos, angle = [0, 0, 0]) => { +const createKey = (pos, angle = [0, 0, 0], jumpscareCtrl) => { return compose( markAsUsed, moveTo(pos, angle), @@ -438,10 +445,20 @@ const createKey = (pos, angle = [0, 0, 0]) => { ON INIT { ${getInjections("init", self)} OBJECT_HIDE SELF NO + ACCEPT +} + +ON INVENTORYIN { + IF (${self.state.pickedUp} == 0) { + SET ${self.state.pickedUp} 0 + SENDEVENT PICKUP ${jumpscareCtrl.ref} "key:exit" + } + ACCEPT } `; }), + declare("int", "pickedUp", 0), createItem // )(items.keys.oliverQuest, { name: "[key--exit]" }); )(items.keys.oliverQuest, { name: "Fire exit key" }); @@ -777,36 +794,6 @@ const generate = async (config) => { floors ); - const key = createKey([ - left + keyX * UNIT - 50, - 0, - -(top + keyZ * UNIT) - 50, - ]); - - const jumpscareCtrl = createJumpscareController([-10, 0, -10], config); - - const loots = [ - (pos) => - createAlmondWater( - pos, - [0, 0, 0], - getAlmondWaterVariant(), - jumpscareCtrl - ), - // TODO: more loot - ]; - - lootSlot.forEach(([x, z]) => { - const offsetX = Math.floor(randomBetween(0, UNIT / 100)) * 100; - const offsetZ = Math.floor(randomBetween(0, UNIT / 100)) * 100; - const pos = [ - left + x * UNIT - 50 + offsetX, - 0, - -(top + z * UNIT) - 50 + offsetZ, - ]; - pickRandoms(1, loots)[0](pos); - }); - let translate = [0, 0, 0]; let rotate = [0, 0, 0]; @@ -831,6 +818,18 @@ const generate = async (config) => { const lampCtrl = createLampController([10, 0, 10], lamps, config); + const jumpscareCtrl = createJumpscareController( + [-10, 0, -10], + lampCtrl, + config + ); + + const key = createKey( + [left + keyX * UNIT - 50, 0, -(top + keyZ * UNIT) - 50], + [0, 0, 0], + jumpscareCtrl + ); + createExit( move(...translate, [left + wallX * UNIT, 0, -(top + wallZ * UNIT)]), rotate, @@ -838,6 +837,28 @@ const generate = async (config) => { lampCtrl ); + const loots = [ + (pos) => + createAlmondWater( + pos, + [0, 0, 0], + getAlmondWaterVariant(), + jumpscareCtrl + ), + // TODO: more loot + ]; + + lootSlot.forEach(([x, z]) => { + const offsetX = Math.floor(randomBetween(0, UNIT / 100)) * 100; + const offsetZ = Math.floor(randomBetween(0, UNIT / 100)) * 100; + const pos = [ + left + x * UNIT - 50 + offsetX, + 0, + -(top + z * UNIT) - 50 + offsetZ, + ]; + pickRandoms(1, loots)[0](pos); + }); + return mapData; }, diff --git a/src/scripting.js b/src/scripting.js index ff66c4d6..5e80ec24 100644 --- a/src/scripting.js +++ b/src/scripting.js @@ -1,10 +1,10 @@ const rgba = require("color-rgba"); -const { compose, dropLast, join, curry, map, divide, __ } = require("ramda"); +const { compose, dropLast, join, curry, map } = require("ramda"); const color = (colorDefinition) => { return compose( join(" "), - map(divide(__, 256)), + map((channel) => Math.round((channel / 256) * 10 ** 6) / 10 ** 6), dropLast(1), rgba )(colorDefinition);