Skip to content

Commit

Permalink
add tutorials for the backrooms
Browse files Browse the repository at this point in the history
  • Loading branch information
meszaros-lajos-gyorgy committed May 23, 2024
1 parent 2b3c0b3 commit e621909
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 7 deletions.
12 changes: 10 additions & 2 deletions assets/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,20 @@
"english": "Fire Ex!t",
"german": "Notausgan9"
},
"trash_bag": {
"trash-bag": {
"english": "A smelly bag of trash",
"german": "Ein stinkender Müllsack"
},
"wet_floor_sign": {
"wet-floor-sign": {
"english": "Wet floor sign",
"german": "Nassbodenschild"
},
"tutorial--backrooms-1": {
"english": "Uh oh, you went out of bounds and landed in the backrooms. Find an unmarked fire exit door to return to the map.",
"german": "Oh oh, du hast die Levelgrenzen überschritten und bist in den Hinterräumen gelandet. Finde eine unmarkierte Notausgangstür um zurückzukehren. "
},
"tutorial--backrooms-2": {
"english": "Almost all lights have lost their power, but you can restore electricity by shooting the ceiling lamps with a lightning bolt spell.",
"german": "Fast alle Lichter sind ausgefallen, aber du kannst die Elektrizität wiederherstellen indem du die Lampen mit einem Blitzzauber beschießt."
}
}
2 changes: 1 addition & 1 deletion src/entities/TrashBag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class TrashBag extends Entity {

this.withScript()

this.script?.properties.push(new Label('[trash_bag]'))
this.script?.properties.push(new Label('[trash-bag]'))

const oneInFour = new Variable('int', 'one_in_four', 0)

Expand Down
2 changes: 1 addition & 1 deletion src/entities/WetFloorSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ export class WetFloorSign extends Entity {

this.withScript()

this.script?.properties.push(new Label('[wet_floor_sign]'), Collision.on)
this.script?.properties.push(new Label('[wet-floor-sign]'))
}
}
67 changes: 66 additions & 1 deletion src/gameStateManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ const tutorialGaveGameToGoblin = new ScriptSubroutine('tutorial_gave_game_to_gob
quest [tutorial--gave-game-to-goblin]
`
})
const tutorialLandedInBackrooms = new ScriptSubroutine('tutorial_landed_in_backrooms', () => {
return `
${notification.play()}
herosay [tutorial--backrooms-1]
quest [tutorial--backrooms-1]
`
})
const tutorialBackroomsLights = new ScriptSubroutine('tutorial_backrooms_light', () => {
return `
${notification.play()}
herosay [tutorial--backrooms-2]
quest [tutorial--backrooms-2]
`
})

const achievementListenSmall = new ScriptSubroutine('achievement_found_games_small', () => {
return `
Expand Down Expand Up @@ -76,13 +90,32 @@ export const createGameStateManager = (settings: Settings) => {
const isGoblinReadyForSuicide = new Variable('bool', 'is_goblin_ready_for_suicide', false)
const isGoblinDead = new Variable('bool', 'is_goblin_dead', false)
const haveLittered = new Variable('bool', 'player_littered', false)
const landedInBackroomsFirstTime = new Variable('bool', 'landed_in_backrooms_first_time', true)

const gotAam = new Variable('bool', 'got_aam', false)
const gotFolgora = new Variable('bool', 'got_folgora', false)
const gotTaar = new Variable('bool', 'got_taar', false)
const backroomsLightTutorialDone = new Variable('bool', 'backrooms_light_tutorial_done', false)

manager.script?.properties.push(numberOfCollectedGames, playerFoundAnyGames, isGoblinReadyForSuicide, isGoblinDead)
manager.script?.properties.push(
numberOfCollectedGames,
playerFoundAnyGames,
isGoblinReadyForSuicide,
isGoblinDead,
haveLittered,
landedInBackroomsFirstTime,
gotAam,
gotFolgora,
gotTaar,
backroomsLightTutorialDone,
)

manager.script?.subroutines.push(
tutorialWelcome,
tutorialFoundAGame,
tutorialGaveGameToGoblin,
tutorialLandedInBackrooms,
tutorialBackroomsLights,
achievementListenSmall,
achievementListenMedium,
achievementListenLarge,
Expand Down Expand Up @@ -191,6 +224,38 @@ export const createGameStateManager = (settings: Settings) => {
.on('player_leaves_backrooms', () => {
return `sendevent send_to_spawn player nop`
})
.on('landed_in_backrooms', () => {
return `
if (${landedInBackroomsFirstTime.name} == 1) {
set ${landedInBackroomsFirstTime.name} 0
${tutorialLandedInBackrooms.invoke()}
}
`
})
.on('got_rune', () => {
return `
if (^$param1 == "aam") {
set ${gotAam.name} 1
}
if (^$param1 == "folgora") {
set ${gotFolgora.name} 1
}
if (^$param1 == "taar") {
set ${gotTaar.name} 1
}
if (${gotAam.name} == 1) {
if (${gotFolgora.name} == 1) {
if (${gotTaar.name} == 1) {
if (${backroomsLightTutorialDone.name} == 0) {
set ${backroomsLightTutorialDone.name} 1
${tutorialBackroomsLights.invoke()}
}
}
}
}
`
})

return manager
}
12 changes: 10 additions & 2 deletions src/rooms/backrooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,21 @@ export const createBackrooms = async (
const aam = new Rune('aam', {
position: roomOrigin.clone().add(new Vector3(randomBetween(-200, 200), 0, randomBetween(-200, 200))),
})
aam.script?.on('inventoryuse', () => {
return `sendevent got_rune ${gameStateManager.ref} aam`
})
const folgora = new Rune('folgora', {
position: roomOrigin.clone().add(new Vector3(randomBetween(-200, 200), 0, randomBetween(-200, 200))),
})
folgora.script?.on('inventoryuse', () => {
return `sendevent got_rune ${gameStateManager.ref} folgora`
})
const taar = new Rune('taar', {
position: roomOrigin.clone().add(new Vector3(randomBetween(-200, 200), 0, randomBetween(-200, 200))),
})
taar.script?.on('inventoryuse', () => {
return `sendevent got_rune ${gameStateManager.ref} taar`
})
contents.entities.push(aam, folgora, taar)

const entryZone = createZone({
Expand All @@ -54,8 +63,7 @@ export const createBackrooms = async (
})
entry.script?.properties.push(new ControlZone(entryZone))
entry.script?.on('controlledzone_enter', () => {
// TODO: do lightning effect on the ceiling lamp that turns it on
return ''
return `sendevent landed_in_backrooms ${gameStateManager.ref} nop`
})
contents.entities.push(entry)
contents._.entry = entry
Expand Down

0 comments on commit e621909

Please sign in to comment.