Added comments for "poiscreens" and "encounters"

files
This commit is contained in:
Caroline Foy 2025-04-28 12:11:00 -05:00
parent 77cb3f4613
commit 1179fb5afc
2 changed files with 22 additions and 0 deletions

View file

@ -4,6 +4,9 @@ import { userInput, pauseScreen, enableRawMode, disableRawMode, sleep } from "./
import './variables.js';
import { whitespringStore, trader, eurekaStore, newVegasStore, vaultZeroStore } from "./shops.js";
//This function uses a switch statement to determine the player's location within a given range. If said location IS
//within the given range, the statement will call a seperate function to declare that the player is in a point of interest,
//building the player's screen to match that.
export function checkPOI() {
if (path == 0) {
if (location >= (pois[poiCounter].location)-3 && location <= pois[poiCounter].location && pois[poiCounter].visited == false) {
@ -92,6 +95,8 @@ export function checkPOI() {
}
}
//This array holds important information about every point of interest in the game, such as its name, locaiton on the
//player's path, and a boolean for if it has been visited by the player yet.
global.poiCounter = 0;
global.pois = [
{name: "Whitespring Bunker", location: 25, path: 0, visited: false},
@ -119,7 +124,12 @@ global.pois = [
{name: "Camp Navarro", location: 100, path: 2, visited: false},
]
//EVERY POI FUNCTION WORKS THE SAME, THE ONLY DIFFERENCE IS THAT THEY EACH CALL THEIR RESPECTIVE DIALOGUE AND
//SHOP FUNCTIONS.
//This function builds the POI the player has reached. In this instance, it builds the POI called "The Whitespring".
function whitespring() {
//Basic introductory message, along with changing the game's basic functioning with the raw mode command.
disableRawMode();
console.clear();
sleep(1);
@ -131,6 +141,8 @@ function whitespring() {
console.log("3) Open your PIP-Boy");
console.log("4) Leave");
let whitespringInput = userInput("Enter: ");
//Switch statement changes depending on the user's input, allowing them to explore the POI, talk or trade with the locals,
//check their stats, or leave if they wish to.
switch(whitespringInput) {
case "1":
console.clear();