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