prettify, sorry for the big ass commit

This commit is contained in:
Olivier Gagnon
2021-09-04 19:09:30 -04:00
parent 3d7cdb4ef9
commit a18bdd6afc
554 changed files with 91615 additions and 66138 deletions
+38 -36
View File
@@ -2,13 +2,11 @@
* Map of all Locations in the game
* Key = Location name, value = Location object
*/
import { City } from "./City";
import { Cities } from "./Cities";
import { Location,
IConstructorParams } from "./Location";
import { CityName } from "./data/CityNames";
import { LocationsMetadata } from "./data/LocationsMetadata";
import { City } from "./City";
import { Cities } from "./Cities";
import { Location, IConstructorParams } from "./Location";
import { CityName } from "./data/CityNames";
import { LocationsMetadata } from "./data/LocationsMetadata";
import { IMap } from "../types";
@@ -19,26 +17,30 @@ export const Locations: IMap<Location> = {};
* be initialized from the `LocationsMetadata`
*/
function constructLocation(p: IConstructorParams): Location {
if (!p.name) {
throw new Error(`Invalid constructor parameters for Location. No 'name' property`);
}
if (!p.name) {
throw new Error(
`Invalid constructor parameters for Location. No 'name' property`,
);
}
if (Locations[p.name] instanceof Location) {
console.warn(`Property with name ${p.name} already exists and is being overwritten`);
}
if (Locations[p.name] instanceof Location) {
console.warn(
`Property with name ${p.name} already exists and is being overwritten`,
);
}
Locations[p.name] = new Location(p);
Locations[p.name] = new Location(p);
return Locations[p.name];
return Locations[p.name];
}
// First construct all cities
Cities[CityName.Aevum] = new City(CityName.Aevum);
Cities[CityName.Chongqing] = new City(CityName.Chongqing);
Cities[CityName.Ishima] = new City(CityName.Ishima);
Cities[CityName.NewTokyo] = new City(CityName.NewTokyo);
Cities[CityName.Sector12] = new City(CityName.Sector12);
Cities[CityName.Volhaven] = new City(CityName.Volhaven);
Cities[CityName.Aevum] = new City(CityName.Aevum);
Cities[CityName.Chongqing] = new City(CityName.Chongqing);
Cities[CityName.Ishima] = new City(CityName.Ishima);
Cities[CityName.NewTokyo] = new City(CityName.NewTokyo);
Cities[CityName.Sector12] = new City(CityName.Sector12);
Cities[CityName.Volhaven] = new City(CityName.Volhaven);
Cities[CityName.Aevum].asciiArt = `
[aevum police headquarters] 26
@@ -75,7 +77,7 @@ Cities[CityName.Aevum].asciiArt = `
|
67 o
[the slums] P `
[the slums] P `;
Cities[CityName.Chongqing].asciiArt = `
|
75 o
@@ -98,7 +100,7 @@ Cities[CityName.Chongqing].asciiArt = `
|
|
x 82
[the slums] D `
[the slums] D `;
Cities[CityName.Ishima].asciiArt = `
o 59
o o |
@@ -123,7 +125,7 @@ Cities[CityName.Ishima].asciiArt = `
/ o----B------x-----o
o 50 52
[omega soft.]
[the slums] E `
[the slums] E `;
Cities[CityName.NewTokyo].asciiArt = `
@@ -151,7 +153,7 @@ Cities[CityName.NewTokyo].asciiArt = `
F [the slums]
`
`;
Cities[CityName.Sector12].asciiArt = `
78 o 97
o [icarus microsystems] /
@@ -181,7 +183,7 @@ Cities[CityName.Sector12].asciiArt = `
| /
85 o--G--------K--------S-------o 88 [the slums] R
[foodnstuff] [travel agency] `
[foodnstuff] [travel agency] `;
Cities[CityName.Volhaven].asciiArt = `
[omnia cybersystems]
17 66 68
@@ -213,19 +215,19 @@ Cities[CityName.Volhaven].asciiArt = `
57
[the slums] K `
[the slums] K `;
// Then construct all locations, and add them to the cities as we go.
for (const metadata of LocationsMetadata) {
const loc = constructLocation(metadata);
const loc = constructLocation(metadata);
const cityName = loc.city;
if (cityName === null) {
// Generic location, add to all cities
for (const city in Cities) {
Cities[city].addLocation(loc.name);
}
} else {
Cities[cityName].addLocation(loc.name);
const cityName = loc.city;
if (cityName === null) {
// Generic location, add to all cities
for (const city in Cities) {
Cities[city].addLocation(loc.name);
}
} else {
Cities[cityName].addLocation(loc.name);
}
}