Create-Task/files/variables.js
2025-02-26 15:56:21 -06:00

74 lines
No EOL
2 KiB
JavaScript

// Holds the global variables and useful functions such as userInput
const readline = require('readline-sync');
module.exports = { // Lets variables and functions be used in other files
day,
location,
ammo,
food,
foodAmt,
health,
travelSpeed,
isRadiated,
radSeverity,
isSick,
sickSeverity,
inventory,
name,
prewarmoney,
caps,
sleep,
userInput,
randomNumber,
};
var name = '';
var prewarmoney = 0; // Used in Enclave Stores
var caps = 0; // Used everywhere
var day = 0; // Should we add a definite end? 365 Days?
var location = 0; // Location in the world, 0 is Raven Rock, 255 is New Vegas
var locationA = 0; // Location on path A,
var locationB = 0; // Location on path B, 225 is Navarro
var ammo = 0; // Used in encounters and hunting, No cap :)
var food = 0; // Max: 200
var foodAmt = 0; // Amt of food eaten per day, 3 levels, starting at 1
var health = 0; // Max: 100
var travelSpeed = 0; // Location points per day, 3 levels, starting at 1
var isRadiated = false;
var radSeverity = 0; // Modifies many things, 3 levels, starting at 1
var isSick = false;
var sickPoints = 0; // If you accumulate 50 sick points you lose
var sickSeverity = 0; // 3 levls, starting at 1
var inventory = []; // Max of 5 items
var lootTables = [[],[],[],[],[]] // Only small things like food and ammo, 5 Loot tables per scavenge score, 3 items in each, first is best
var daysSinceScav = 0; // Days since your last scavenge, you must wait 15 days before scavenging again.
function sleep(time) { // Waits the inputed amt of miliseconds before proceeding
setTimeout(() => {}, time);
}
function userInput(question) { // Basic user input functions, takes in the question to be asked.
let answer = readline.question(question);
return(answer);
}
function randomNumber(min, max) { // Takes in two parameters, min and max, and returns a random number between those boundries.
while (true) {
var randNum = Math.floor(Math.random() * (max+1))
if (randNum >= min) { break; }
}
return randNum;
}