thinstuff

This commit is contained in:
Kim Ravn Hansen
2025-09-10 22:37:54 +02:00
parent ba293d08b3
commit 8c196bb6a1
13 changed files with 350 additions and 213 deletions

View File

@@ -8,6 +8,7 @@
*/
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 { Player } from "./player.js";
@@ -33,6 +34,24 @@ export class Game {
*/
_players = new Map();
/** @protected @type {Xorshift32} */
_rng;
/** @type {Xorshift32} */
get rng() {
return this._rng;
}
/** @param {number} rngSeed Seed number used for randomization */
constructor(rngSeed) {
if (!Number.isInteger(rngSeed)) {
throw new Error("rngSeed must be an integer");
}
this._rng = new Xorshift32(rngSeed);
}
getPlayer(username) {
return this._players.get(username);
}