Bookkeeping and tweaking
This commit is contained in:
@@ -9,10 +9,13 @@
|
||||
|
||||
import { isIdSane, miniUid } from "../utils/id.js";
|
||||
import { Xorshift32 } from "../utils/random.js";
|
||||
import { Character } from "./character.js";
|
||||
import { ItemAttributes, ItemBlueprint } from "./item.js";
|
||||
import { ItemBlueprint } from "./item.js";
|
||||
import { Player } from "./player.js";
|
||||
|
||||
/** @typedef {import("./character.js").Character} Character */
|
||||
/** @typedef {import("./item.js").ItemAttributes} ItemAttributes */
|
||||
/** @typedef {import("./item.js").ItemBlueprint} ItemBlueprint */
|
||||
|
||||
export class Game {
|
||||
_counter = 1_000_000;
|
||||
|
||||
@@ -117,10 +120,8 @@ export class Game {
|
||||
*/
|
||||
getItemBlueprint(blueprintId) {
|
||||
if (!isIdSane(blueprintId)) {
|
||||
throw new Error(`blueprintId >>${blueprintId}<< is insane!`);
|
||||
throw new Error(`blueprintId >>${blueprintId}<< is not a valid id`);
|
||||
}
|
||||
const tpl = this._itemBlueprints.get(blueprintId);
|
||||
|
||||
return tpl || undefined;
|
||||
return this._itemBlueprints.get(blueprintId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
* Example: two adjacent rooms connected by a door:
|
||||
* Room A has a portal to Room B, and
|
||||
* Room B has a portal to Room A.
|
||||
*
|
||||
* @todo Add encounters to portals
|
||||
*/
|
||||
export class Portal {
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import WebSocket from "ws";
|
||||
import { Player } from "./player.js";
|
||||
import { mustBeString, mustBe } from "../utils/mustbe.js";
|
||||
import { Scene } from "../scenes/scene.js";
|
||||
import { gGame } from "./globals.js";
|
||||
import { formatMessage, MessageType } from "../utils/messages.js";
|
||||
|
||||
/** @typedef {import("ws").WebSocket} WebSocket */
|
||||
|
||||
export class Session {
|
||||
/** @type {WebSocket} */
|
||||
_websocket;
|
||||
|
||||
Reference in New Issue
Block a user