castle-web-cli 0.4.229 → 0.4.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-prompts.d.ts +2 -0
- package/dist/agent-prompts.js +16 -8
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +21 -21
- package/dist/api.d.ts +28 -2
- package/dist/api.js +74 -16
- package/dist/castle-host/host.d.ts +91 -0
- package/dist/castle-host/host.js +860 -3
- package/dist/castleJson.d.ts +44 -0
- package/dist/castleJson.js +131 -0
- package/dist/check.js +27 -1
- package/dist/contentPack.d.ts +49 -0
- package/dist/contentPack.js +273 -0
- package/dist/devExperiments.d.ts +21 -0
- package/dist/devExperiments.js +139 -0
- package/dist/devHub.d.ts +55 -0
- package/dist/devHub.js +187 -0
- package/dist/devSaveStorage.d.ts +36 -0
- package/dist/devSaveStorage.js +469 -0
- package/dist/devSessionChild.js +25 -13
- package/dist/devSessionServer.d.ts +14 -1
- package/dist/devSessionServer.js +237 -46
- package/dist/devSessionStorage.d.ts +9 -0
- package/dist/devSessionStorage.js +66 -1
- package/dist/experimentAssignment.d.ts +15 -0
- package/dist/experimentAssignment.js +41 -0
- package/dist/importCheckHook.d.ts +40 -0
- package/dist/importCheckHook.js +171 -0
- package/dist/importRegression.d.ts +15 -0
- package/dist/importRegression.js +100 -0
- package/dist/importTrust.d.ts +2 -0
- package/dist/importTrust.js +27 -0
- package/dist/importUpdateHook.d.ts +18 -0
- package/dist/importUpdateHook.js +31 -8
- package/dist/importUpdateHookRunner.js +19 -7
- package/dist/imports.d.ts +16 -0
- package/dist/imports.js +141 -31
- package/dist/index.js +3 -1
- package/dist/init.d.ts +3 -0
- package/dist/init.js +126 -9
- package/dist/install.js +4 -1
- package/dist/localPaths.js +4 -0
- package/dist/login.js +2 -2
- package/dist/platformDoc.js +3 -8
- package/dist/playPagePolicy.js +3 -1
- package/dist/remix.js +5 -0
- package/dist/routerTaskReport.d.ts +28 -0
- package/dist/routerTaskReport.js +56 -0
- package/dist/save-deck.d.ts +18 -0
- package/dist/save-deck.js +142 -6
- package/dist/serve.d.ts +8 -0
- package/dist/serve.js +99 -14
- package/dist/serverBundle.d.ts +1 -1
- package/dist/serverBundle.js +5 -1
- package/dist/webSourceSync.d.ts +2 -0
- package/dist/webSourceSync.js +2 -0
- package/kits/base/CLAUDE.md +2 -3
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/README.md +406 -53
- package/kits/base/sdk/agent.js +4 -4
- package/kits/base/sdk/avatar.d.ts +12 -0
- package/kits/base/sdk/avatar.js +23 -0
- package/kits/base/sdk/castle.d.ts +9 -0
- package/kits/base/sdk/castle.js +5 -0
- package/kits/base/sdk/commands.d.ts +223 -0
- package/kits/base/sdk/commands.js +16 -0
- package/kits/base/sdk/context.d.ts +6 -0
- package/kits/base/sdk/experiments.d.ts +15 -0
- package/kits/base/sdk/experiments.js +83 -0
- package/kits/base/sdk/hub.d.ts +85 -0
- package/kits/base/sdk/hub.js +107 -0
- package/kits/base/sdk/multiplayer.d.ts +45 -1
- package/kits/base/sdk/multiplayer.js +158 -8
- package/kits/base/sdk/save.d.ts +197 -0
- package/kits/base/sdk/save.js +525 -0
- package/kits/base/sdk/saveCoordinator.d.ts +39 -0
- package/kits/base/sdk/saveCoordinator.js +252 -0
- package/kits/base/sdk/server/hub.d.ts +169 -0
- package/kits/base/sdk/server/hub.js +125 -0
- package/kits/base/sdk/server/platformHandle.d.ts +42 -1
- package/kits/base/sdk/server/storage.d.ts +58 -4
- package/kits/base/sdk/server/storage.js +25 -5
- package/kits/base/sdk/server/wrapper.d.ts +36 -2
- package/kits/base/sdk/server/wrapper.js +92 -11
- package/kits/base/sdk/store.d.ts +3 -2
- package/kits/base/sdk/store.js +5 -0
- package/kits/base/sdk/transport.d.ts +2 -1
- package/kits/base/sdk/transport.js +13 -1
- package/kits/hub-game/.prettierrc +5 -0
- package/kits/hub-game/CLAUDE.md +149 -0
- package/kits/hub-game/blueprints/avatar-0.scene +28 -0
- package/kits/hub-game/blueprints/avatar-1.scene +28 -0
- package/kits/hub-game/blueprints/avatar-2.scene +28 -0
- package/kits/hub-game/blueprints/avatar-3.scene +28 -0
- package/kits/hub-game/blueprints/bean/avatar-0.scene +28 -0
- package/kits/hub-game/blueprints/bean/avatar-1.scene +28 -0
- package/kits/hub-game/blueprints/bean/avatar-2.scene +28 -0
- package/kits/hub-game/blueprints/bean/avatar-3.scene +28 -0
- package/kits/hub-game/blueprints/blocky/avatar-0.scene +28 -0
- package/kits/hub-game/blueprints/blocky/avatar-1.scene +28 -0
- package/kits/hub-game/blueprints/blocky/avatar-2.scene +28 -0
- package/kits/hub-game/blueprints/blocky/avatar-3.scene +28 -0
- package/kits/hub-game/blueprints/pixel/avatar-0.scene +28 -0
- package/kits/hub-game/blueprints/pixel/avatar-1.scene +28 -0
- package/kits/hub-game/blueprints/pixel/avatar-2.scene +28 -0
- package/kits/hub-game/blueprints/pixel/avatar-3.scene +28 -0
- package/kits/hub-game/castle.json +96 -0
- package/kits/hub-game/code/client/attention.js +133 -0
- package/kits/hub-game/code/client/avatar.js +288 -0
- package/kits/hub-game/code/client/cabinets.js +90 -0
- package/kits/hub-game/code/client/chat.js +135 -0
- package/kits/hub-game/code/client/chrome.js +1035 -0
- package/kits/hub-game/code/client/doorFrame.js +15 -0
- package/kits/hub-game/code/client/firstJoin.js +14 -0
- package/kits/hub-game/code/client/grab.js +376 -0
- package/kits/hub-game/code/client/hookLayer.js +236 -0
- package/kits/hub-game/code/client/idle.js +326 -0
- package/kits/hub-game/code/client/keys.js +48 -0
- package/kits/hub-game/code/client/pack.js +232 -0
- package/kits/hub-game/code/client/packFormat.js +397 -0
- package/kits/hub-game/code/client/say.js +127 -0
- package/kits/hub-game/code/client/sha256.js +80 -0
- package/kits/hub-game/code/client/sound.js +147 -0
- package/kits/hub-game/code/client/state.js +143 -0
- package/kits/hub-game/code/client/talk.js +233 -0
- package/kits/hub-game/code/client/tiers.js +480 -0
- package/kits/hub-game/code/client/together.js +440 -0
- package/kits/hub-game/code/client/wear.js +149 -0
- package/kits/hub-game/code/server/actors.js +627 -0
- package/kits/hub-game/code/server/blocks.js +103 -0
- package/kits/hub-game/code/server/cabinets.js +309 -0
- package/kits/hub-game/code/server/game.js +137 -0
- package/kits/hub-game/code/server/grab.js +248 -0
- package/kits/hub-game/code/server/history.js +96 -0
- package/kits/hub-game/code/server/hub.js +1998 -0
- package/kits/hub-game/code/server/idle.js +412 -0
- package/kits/hub-game/code/server/index.js +64 -0
- package/kits/hub-game/code/server/labels.js +59 -0
- package/kits/hub-game/code/server/manifest.js +554 -0
- package/kits/hub-game/code/server/npcs.js +733 -0
- package/kits/hub-game/code/server/party.js +439 -0
- package/kits/hub-game/code/server/place.js +43 -0
- package/kits/hub-game/code/server/say.js +83 -0
- package/kits/hub-game/code/server/wear.js +142 -0
- package/kits/hub-game/code/systems/hub.js +2347 -0
- package/kits/hub-game/docs/content-pack.md +151 -0
- package/kits/hub-game/docs/contract.md +1209 -0
- package/kits/hub-game/docs/style.md +137 -0
- package/kits/hub-game/drawings/blocky/castle-eye.sprite +58 -0
- package/kits/hub-game/drawings/blocky/dash.sprite +59 -0
- package/kits/hub-game/drawings/blocky/pom.sprite +59 -0
- package/kits/hub-game/drawings/blocky/tabby.sprite +59 -0
- package/kits/hub-game/drawings/pixel/castle-arm.sprite +13 -0
- package/kits/hub-game/drawings/pixel/castle-body.sprite +23 -0
- package/kits/hub-game/drawings/pixel/castle-leg.sprite +12 -0
- package/kits/hub-game/drawings/pixel/kai-arm.sprite +14 -0
- package/kits/hub-game/drawings/pixel/kai-head.sprite +24 -0
- package/kits/hub-game/drawings/pixel/kai-leg.sprite +15 -0
- package/kits/hub-game/drawings/pixel/kai-torso.sprite +18 -0
- package/kits/hub-game/drawings/pixel/mimi-arm.sprite +13 -0
- package/kits/hub-game/drawings/pixel/mimi-head.sprite +23 -0
- package/kits/hub-game/drawings/pixel/mimi-leg.sprite +15 -0
- package/kits/hub-game/drawings/pixel/mimi-torso.sprite +18 -0
- package/kits/hub-game/drawings/pixel/nox-arm.sprite +13 -0
- package/kits/hub-game/drawings/pixel/nox-head.sprite +21 -0
- package/kits/hub-game/drawings/pixel/nox-leg.sprite +14 -0
- package/kits/hub-game/drawings/pixel/nox-torso.sprite +18 -0
- package/kits/hub-game/eslint.config.js +20 -0
- package/kits/hub-game/fonts.generated.js +9 -0
- package/kits/hub-game/index.html +22 -0
- package/kits/hub-game/main.jsx +6 -0
- package/kits/hub-game/models/avatar-0.pxmodel +21 -0
- package/kits/hub-game/models/avatar-1.pxmodel +24 -0
- package/kits/hub-game/models/avatar-2.pxmodel +27 -0
- package/kits/hub-game/models/avatar-3.pxmodel +22 -0
- package/kits/hub-game/models/bean/avatar-0.pxmodel +19 -0
- package/kits/hub-game/models/bean/avatar-1.pxmodel +24 -0
- package/kits/hub-game/models/bean/avatar-2.pxmodel +22 -0
- package/kits/hub-game/models/bean/avatar-3.pxmodel +24 -0
- package/kits/hub-game/models/blocky/avatar-0.pxmodel +21 -0
- package/kits/hub-game/models/blocky/avatar-1.pxmodel +30 -0
- package/kits/hub-game/models/blocky/avatar-2.pxmodel +28 -0
- package/kits/hub-game/models/blocky/avatar-3.pxmodel +27 -0
- package/kits/hub-game/models/pixel/avatar-0.pxmodel +24 -0
- package/kits/hub-game/models/pixel/avatar-1.pxmodel +16 -0
- package/kits/hub-game/models/pixel/avatar-2.pxmodel +19 -0
- package/kits/hub-game/models/pixel/avatar-3.pxmodel +23 -0
- package/kits/hub-game/package-lock.json +365 -0
- package/kits/hub-game/package.json +32 -0
- package/kits/hub-game/scenes/main.scene +318 -0
- package/kits/hub-game/scripts/check.mjs +339 -0
- package/kits/hub-game/scripts/fixtures/sdk-stub.mjs +3 -0
- package/kits/hub-game/scripts/gen-avatars-bean.mjs +748 -0
- package/kits/hub-game/scripts/gen-avatars-blocky.mjs +607 -0
- package/kits/hub-game/scripts/gen-avatars-pixel.mjs +771 -0
- package/kits/hub-game/scripts/gen-avatars.mjs +621 -0
- package/kits/hub-game/scripts/pack.mjs +192 -0
- package/kits/hub-game/scripts/test-actors.mjs +666 -0
- package/kits/hub-game/scripts/test-attention.mjs +103 -0
- package/kits/hub-game/scripts/test-avatar.mjs +472 -0
- package/kits/hub-game/scripts/test-ban-join.mjs +194 -0
- package/kits/hub-game/scripts/test-blocks.mjs +351 -0
- package/kits/hub-game/scripts/test-chat.mjs +98 -0
- package/kits/hub-game/scripts/test-classic.mjs +590 -0
- package/kits/hub-game/scripts/test-door-jump.mjs +131 -0
- package/kits/hub-game/scripts/test-door.mjs +56 -0
- package/kits/hub-game/scripts/test-grab-client.mjs +328 -0
- package/kits/hub-game/scripts/test-grab.mjs +331 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +835 -0
- package/kits/hub-game/scripts/test-hub-trip.mjs +1518 -0
- package/kits/hub-game/scripts/test-idle.mjs +518 -0
- package/kits/hub-game/scripts/test-interest.mjs +413 -0
- package/kits/hub-game/scripts/test-keys.mjs +50 -0
- package/kits/hub-game/scripts/test-manifest.mjs +270 -0
- package/kits/hub-game/scripts/test-no-forms.mjs +16 -0
- package/kits/hub-game/scripts/test-npcs.mjs +724 -0
- package/kits/hub-game/scripts/test-pack.mjs +424 -0
- package/kits/hub-game/scripts/test-party.mjs +369 -0
- package/kits/hub-game/scripts/test-say.mjs +149 -0
- package/kits/hub-game/scripts/test-tiers.mjs +666 -0
- package/kits/hub-game/scripts/test-together.mjs +215 -0
- package/kits/hub-game/theme.style +3 -0
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/avatars.js +101 -1
- package/kits/multiplayer-3d/code/server/players.js +4 -1
- package/kits/multiplayer-3d/code/server/sceneBodies.js +27 -6
- package/kits/multiplayer-3d/code/server/world.js +20 -7
- package/kits/multiplayer-3d/code/systems/multiplayer.js +222 -11
- package/kits/physics-2d/CLAUDE.md +2 -0
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/engine/art.js +13 -0
- package/kits/physics-2d/engine/assets.js +4 -2
- package/kits/physics-2d/engine/scene.js +117 -5
- package/kits/physics-2d/package.json +1 -1
- package/kits/physics-2d/scripts/test-skip-unchanged.mjs +254 -0
- package/kits/physics-3d/CLAUDE.md +285 -1
- package/kits/physics-3d/behaviors/Player.jsx +74 -1
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +33 -5
- package/kits/physics-3d/engine3d/actornode.js +253 -0
- package/kits/physics-3d/engine3d/artobjects.js +2 -2
- package/kits/physics-3d/engine3d/materials.js +29 -1
- package/kits/physics-3d/engine3d/nearshadows.js +600 -0
- package/kits/physics-3d/engine3d/unchanged.js +153 -0
- package/kits/physics-3d/engine3d/world3d.js +527 -5
- package/kits/physics-3d/package.json +1 -1
- package/kits/physics-3d/scripts/test-camera-follow.mjs +533 -0
- package/kits/physics-3d/scripts/test-near-shadows.mjs +1073 -0
- package/kits/physics-3d/scripts/test-static-actors.mjs +662 -0
- package/kits/physics-3d/scripts/test-static-passes.mjs +459 -0
- package/kits/physics-3d/scripts/test-static-physics.mjs +128 -0
- package/kits/physics-3d/systems/physics3d.js +187 -5
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/client/connection.js +77 -7
- package/kits/real-time/code/client/gameHooks.js +63 -3
- package/kits/real-time/code/client/messages.js +7 -0
- package/kits/real-time/code/server/gameHooks.js +24 -0
- package/kits/real-time/code/server/session.js +390 -22
- package/package.json +2 -2
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
// A party in a town (contract §5, v1.10): a few players who go through doors
|
|
2
|
+
// together. One player invites another from the People list or by walking up
|
|
3
|
+
// to them; the other accepts. A member who picks a door from the Doors list
|
|
4
|
+
// proposes it: they are put on its pad, and each member who says yes is put
|
|
5
|
+
// on it too, so the pad counts them and fires for all of them at once. A
|
|
6
|
+
// party is the place's own and lasts while its layer does: a member away
|
|
7
|
+
// through a door is kept for half an hour and is back in it on return.
|
|
8
|
+
// A game (a place with `result`) has no parties and answers none of this.
|
|
9
|
+
//
|
|
10
|
+
// Members are kept by user id where a player has one (so a return is the same
|
|
11
|
+
// member) and by player id for a guest, who is a member only while here.
|
|
12
|
+
|
|
13
|
+
// The most players one party holds.
|
|
14
|
+
export const PARTY_MAX = 8;
|
|
15
|
+
// An invitation and a proposed door wait this long for an answer.
|
|
16
|
+
const INVITE_MS = 60000;
|
|
17
|
+
const PROPOSAL_MS = 45000;
|
|
18
|
+
// How long of that a proposal may hold the pad's countdown (`hub.coming`).
|
|
19
|
+
const PROPOSAL_HOLD_MS = 20000;
|
|
20
|
+
// A party's proposal holds a pad's countdown (`hub.coming`) at most once in
|
|
21
|
+
// this long, so proposing again and again cannot keep a door shut.
|
|
22
|
+
const HOLD_EVERY_MS = 60000;
|
|
23
|
+
// One player's party messages: a burst of this many, then one a second.
|
|
24
|
+
const RATE_BURST = 6;
|
|
25
|
+
const RATE_EVERY_MS = 1000;
|
|
26
|
+
// A member who left the layer (through a door) is kept this long.
|
|
27
|
+
const AWAY_MS = 30 * 60 * 1000;
|
|
28
|
+
// How far from a pad's middle party members are put, in a ring (at most half
|
|
29
|
+
// the pad's radius). Six spots round it are this far apart.
|
|
30
|
+
export const PAD_RING_M = 1.2;
|
|
31
|
+
// A spot on a pad is taken when an NPC or a player stands within this of it.
|
|
32
|
+
// More than two bodies' width (2 x 0.45 m): a player put down touching another
|
|
33
|
+
// is pushed apart by physics, and the one already there can slide off the pad
|
|
34
|
+
// and stop counting, so a pad that needs both never fires.
|
|
35
|
+
export const PAD_CLEAR_M = 1.1;
|
|
36
|
+
// A standing body's radius.
|
|
37
|
+
const BODY_RADIUS_M = 0.45;
|
|
38
|
+
|
|
39
|
+
const DEG = Math.PI / 180;
|
|
40
|
+
|
|
41
|
+
export function newPartyState() {
|
|
42
|
+
return {
|
|
43
|
+
party: {
|
|
44
|
+
seq: 0,
|
|
45
|
+
// member key -> party id, and party id -> { keys: Set, away: Map(key -> since) }
|
|
46
|
+
of: new Map(),
|
|
47
|
+
parties: new Map(),
|
|
48
|
+
// invitee playerId -> { from: playerId, until }
|
|
49
|
+
invites: new Map(),
|
|
50
|
+
// party id -> { id, door, by: playerId, until, holdUntil, asked: Set(playerId), n }
|
|
51
|
+
proposals: new Map(),
|
|
52
|
+
// playerId -> { tokens, at }, and the JSON last sent to each player
|
|
53
|
+
rate: new Map(),
|
|
54
|
+
sent: new Map(),
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const keyOf = (h, playerId) => {
|
|
60
|
+
const userId = h.players.get(playerId)?.userId;
|
|
61
|
+
return userId ? `u:${userId}` : `p:${playerId}`;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// The players of a party who are here, arrived.
|
|
65
|
+
function present(h, partyId) {
|
|
66
|
+
const party = h.party.parties.get(partyId);
|
|
67
|
+
const out = [];
|
|
68
|
+
if (party) {
|
|
69
|
+
for (const [playerId, entry] of h.players) {
|
|
70
|
+
if (entry.arrived && h.sim?.players.has(playerId) && party.keys.has(keyOf(h, playerId))) {
|
|
71
|
+
out.push(playerId);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function spend(h, playerId) {
|
|
79
|
+
const now = Date.now();
|
|
80
|
+
const r = h.party.rate.get(playerId) ?? { tokens: RATE_BURST, at: now };
|
|
81
|
+
r.tokens = Math.min(RATE_BURST, r.tokens + (now - r.at) / RATE_EVERY_MS);
|
|
82
|
+
r.at = now;
|
|
83
|
+
h.party.rate.set(playerId, r);
|
|
84
|
+
if (r.tokens < 1) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
r.tokens -= 1;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function leaveParty(h, key) {
|
|
92
|
+
const p = h.party;
|
|
93
|
+
const partyId = p.of.get(key);
|
|
94
|
+
const party = partyId ? p.parties.get(partyId) : null;
|
|
95
|
+
p.of.delete(key);
|
|
96
|
+
if (!party) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
party.keys.delete(key);
|
|
100
|
+
party.away.delete(key);
|
|
101
|
+
if (party.keys.size < 2) {
|
|
102
|
+
for (const other of party.keys) {
|
|
103
|
+
p.of.delete(other);
|
|
104
|
+
}
|
|
105
|
+
p.parties.delete(partyId);
|
|
106
|
+
p.proposals.delete(partyId);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function hidden(d, a, b) {
|
|
111
|
+
return Boolean(d.blockedPairs(d.h)?.get(a)?.has(b));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// `d` is the hub layer's own: `{ h, blockedPairs, usernameOf, placeAt, stand,
|
|
115
|
+
// jumpDoors, front }`.
|
|
116
|
+
export function message(d, player, data) {
|
|
117
|
+
const h = d.h;
|
|
118
|
+
const playerId = player?.playerId;
|
|
119
|
+
const me = playerId ? h.players.get(playerId) : null;
|
|
120
|
+
if (!h.sim || h.place.result || !me?.arrived || !spend(h, playerId)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const p = h.party;
|
|
124
|
+
const now = Date.now();
|
|
125
|
+
const myKey = keyOf(h, playerId);
|
|
126
|
+
switch (data?.op) {
|
|
127
|
+
case 'invite': {
|
|
128
|
+
const otherId = data.player;
|
|
129
|
+
const other = typeof otherId === 'string' && otherId !== playerId ? h.players.get(otherId) : null;
|
|
130
|
+
if (!other?.arrived || !h.sim.players.has(otherId) || hidden(d, playerId, otherId)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const partyId = p.of.get(myKey);
|
|
134
|
+
if (partyId && (p.of.get(keyOf(h, otherId)) === partyId || p.parties.get(partyId).keys.size >= PARTY_MAX)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// One invitation waits on a player at a time; a newer one waits its turn.
|
|
138
|
+
const pending = p.invites.get(otherId);
|
|
139
|
+
if (pending && pending.until > now && pending.from !== playerId) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
p.invites.set(otherId, { from: playerId, until: now + INVITE_MS });
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
case 'accept': {
|
|
146
|
+
// An answer is to the invitation the player was shown, by its inviter.
|
|
147
|
+
const invite = p.invites.get(playerId);
|
|
148
|
+
if (!invite || invite.from !== data.from) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
p.invites.delete(playerId);
|
|
152
|
+
const from = invite.until > now ? invite.from : null;
|
|
153
|
+
if (!from || !h.players.get(from)?.arrived || hidden(d, playerId, from)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const fromKey = keyOf(h, from);
|
|
157
|
+
let partyId = p.of.get(fromKey);
|
|
158
|
+
if (partyId && p.parties.get(partyId).keys.size >= PARTY_MAX) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
leaveParty(h, myKey);
|
|
162
|
+
// Leaving a party of two ends it, which may have been the inviter's too.
|
|
163
|
+
partyId = p.of.get(fromKey);
|
|
164
|
+
if (!partyId) {
|
|
165
|
+
p.seq += 1;
|
|
166
|
+
partyId = `party-${p.seq}`;
|
|
167
|
+
p.parties.set(partyId, { keys: new Set([fromKey]), away: new Map(), heldAt: -Infinity });
|
|
168
|
+
p.of.set(fromKey, partyId);
|
|
169
|
+
}
|
|
170
|
+
p.parties.get(partyId).keys.add(myKey);
|
|
171
|
+
p.of.set(myKey, partyId);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
case 'decline':
|
|
175
|
+
if (p.invites.get(playerId)?.from === data.from) {
|
|
176
|
+
p.invites.delete(playerId);
|
|
177
|
+
}
|
|
178
|
+
return;
|
|
179
|
+
case 'leave':
|
|
180
|
+
leaveParty(h, myKey);
|
|
181
|
+
return;
|
|
182
|
+
case 'go': {
|
|
183
|
+
// A member picked a door: they stand on its pad, and the rest are asked.
|
|
184
|
+
const partyId = p.of.get(myKey);
|
|
185
|
+
const door = d.jumpDoors(h).find((x) => x.id === data.door);
|
|
186
|
+
if (!partyId || !door) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// The door the party is already going to: a member asked about it has
|
|
190
|
+
// said yes, and the proposer is put back on its pad; no second proposal.
|
|
191
|
+
const going = p.proposals.get(partyId);
|
|
192
|
+
if (going && going.door === door.id && going.until > now) {
|
|
193
|
+
if (going.asked.delete(playerId)) {
|
|
194
|
+
if (toPad(d, playerId, door, going.n)) {
|
|
195
|
+
going.n += 1;
|
|
196
|
+
}
|
|
197
|
+
if (!going.asked.size) {
|
|
198
|
+
p.proposals.delete(partyId);
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
toPad(d, playerId, door, 0);
|
|
202
|
+
}
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
// A member a block hides from the proposer is not asked, or told of it.
|
|
206
|
+
const others = present(h, partyId).filter((id) => id !== playerId && !hidden(d, playerId, id));
|
|
207
|
+
if (!toPad(d, playerId, door, 0)) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const party = p.parties.get(partyId);
|
|
211
|
+
const holds = now - party.heldAt >= HOLD_EVERY_MS;
|
|
212
|
+
if (holds) {
|
|
213
|
+
party.heldAt = now;
|
|
214
|
+
}
|
|
215
|
+
p.seq += 1;
|
|
216
|
+
p.proposals.set(partyId, {
|
|
217
|
+
id: p.seq,
|
|
218
|
+
door: door.id,
|
|
219
|
+
by: playerId,
|
|
220
|
+
until: now + PROPOSAL_MS,
|
|
221
|
+
holdUntil: holds ? now + PROPOSAL_HOLD_MS : now,
|
|
222
|
+
asked: new Set(others),
|
|
223
|
+
n: 1,
|
|
224
|
+
});
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
case 'go-yes':
|
|
228
|
+
case 'go-no': {
|
|
229
|
+
const partyId = p.of.get(myKey);
|
|
230
|
+
const proposal = partyId ? p.proposals.get(partyId) : null;
|
|
231
|
+
// An answer is to the proposal the player was shown, by its id.
|
|
232
|
+
if (!proposal || proposal.id !== data.id || proposal.until <= now || !proposal.asked.delete(playerId)) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const door = d.jumpDoors(h).find((x) => x.id === proposal.door);
|
|
236
|
+
if (data.op === 'go-yes' && door && toPad(d, playerId, door, proposal.n)) {
|
|
237
|
+
proposal.n += 1;
|
|
238
|
+
}
|
|
239
|
+
if (!proposal.asked.size) {
|
|
240
|
+
p.proposals.delete(partyId);
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
default:
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Put a player on a door's pad (its `HubPad` actor), the `n`th of a ring
|
|
249
|
+
// about its middle, facing the door; in front of a door with no pad, as a
|
|
250
|
+
// jump to it does. A sitter stands first; a player the place holds stays.
|
|
251
|
+
export function toPad(d, playerId, door, n) {
|
|
252
|
+
const h = d.h;
|
|
253
|
+
d.stand(h, playerId);
|
|
254
|
+
if (h.held.has(playerId)) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
const facing = ((door.t.rotationY ?? 0) + 180) * DEG;
|
|
258
|
+
const at = padPoint(h, door, n, playerId) ?? d.front(door);
|
|
259
|
+
d.placeAt(h, playerId, { x: at.x, y: 1.2, z: at.z }, facing);
|
|
260
|
+
h.session?.send(playerId, { k: 'hub-jumped', facing });
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Where the `n`th player sent to a door stands: on its pad, a ring about the
|
|
265
|
+
// middle, or null for a door with no pad.
|
|
266
|
+
export function padPoint(h, door, n, moverId = null) {
|
|
267
|
+
const pad = h.actors.find((a) => a.components.HubPad?.door === door.id && a.components.Transform && !h.hidden.has(a.id));
|
|
268
|
+
if (!pad) {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
const t = pad.components.Transform;
|
|
272
|
+
const radius = Math.min(PAD_RING_M, (pad.components.HubPad.radius ?? pad.components.Shape?.radius ?? 2.3) * 0.5);
|
|
273
|
+
// The `n`th spot of the ring, or the next one round that nobody stands on:
|
|
274
|
+
// a body put down inside an NPC or another player is pushed out by physics,
|
|
275
|
+
// off the pad, and the pad then never counts them.
|
|
276
|
+
const taken = [];
|
|
277
|
+
for (const npc of h.npcs?.list?.() ?? []) {
|
|
278
|
+
if (npc?.at) {
|
|
279
|
+
taken.push(npc.at);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// The mover's own body is not in its way.
|
|
283
|
+
for (const [playerId, body] of h.sim?.players ?? []) {
|
|
284
|
+
if (playerId !== moverId && body?.at) {
|
|
285
|
+
taken.push(body.at);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
const padRadius = pad.components.HubPad.radius ?? pad.components.Shape?.radius ?? 2.3;
|
|
289
|
+
// The ring first (from the `n`th spot round), then an outer ring between
|
|
290
|
+
// its spots where the pad is wide enough, then the middle; the first with
|
|
291
|
+
// PAD_CLEAR_M clear. When none is, the one with the most room.
|
|
292
|
+
const outer = Math.max(radius, padRadius - BODY_RADIUS_M - 0.1);
|
|
293
|
+
const ring = (r, i, turn = 0) => {
|
|
294
|
+
const angle = ((i + turn) * 2 * Math.PI) / 6 + (door.t.rotationY ?? 0) * DEG;
|
|
295
|
+
return { x: t.x + Math.sin(angle) * r, z: t.z + Math.cos(angle) * r };
|
|
296
|
+
};
|
|
297
|
+
const spots = [];
|
|
298
|
+
for (let i = 0; i < 6; i += 1) {
|
|
299
|
+
spots.push(ring(radius, n + i));
|
|
300
|
+
}
|
|
301
|
+
if (outer > radius + 0.3) {
|
|
302
|
+
for (let i = 0; i < 6; i += 1) {
|
|
303
|
+
spots.push(ring(outer, n + i, 0.5));
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
spots.push({ x: t.x, z: t.z });
|
|
307
|
+
const room = (at) => Math.min(Infinity, ...taken.map((other) => Math.hypot(other.x - at.x, other.z - at.z)));
|
|
308
|
+
let best = null;
|
|
309
|
+
for (const at of spots) {
|
|
310
|
+
const r = room(at);
|
|
311
|
+
if (r >= PAD_CLEAR_M) {
|
|
312
|
+
return at;
|
|
313
|
+
}
|
|
314
|
+
if (!best || r > best.r) {
|
|
315
|
+
best = { at, r };
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return best.at;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Each tick: what has run out goes, and each player in a town is told their
|
|
322
|
+
// party, the invitation waiting on them and the door proposed to them, when
|
|
323
|
+
// any of it changed.
|
|
324
|
+
export function tick(d) {
|
|
325
|
+
const h = d.h;
|
|
326
|
+
const p = h.party;
|
|
327
|
+
if (!h.sim || h.place.result) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const now = Date.now();
|
|
331
|
+
for (const [playerId, invite] of p.invites) {
|
|
332
|
+
if (invite.until <= now || !h.players.has(playerId) || !h.players.has(invite.from)) {
|
|
333
|
+
p.invites.delete(playerId);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
for (const [partyId, proposal] of p.proposals) {
|
|
337
|
+
if (proposal.until <= now || !p.parties.has(partyId)) {
|
|
338
|
+
p.proposals.delete(partyId);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const here = new Set();
|
|
342
|
+
for (const [playerId, entry] of h.players) {
|
|
343
|
+
if (entry.arrived) {
|
|
344
|
+
here.add(keyOf(h, playerId));
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
for (const party of p.parties.values()) {
|
|
348
|
+
for (const key of [...party.keys]) {
|
|
349
|
+
if (here.has(key)) {
|
|
350
|
+
party.away.delete(key);
|
|
351
|
+
} else if (!key.startsWith('u:')) {
|
|
352
|
+
// A guest is a member only while here.
|
|
353
|
+
leaveParty(h, key);
|
|
354
|
+
} else if (!party.away.has(key)) {
|
|
355
|
+
party.away.set(key, now);
|
|
356
|
+
} else if (now - party.away.get(key) > AWAY_MS) {
|
|
357
|
+
leaveParty(h, key);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
for (const [playerId, entry] of h.players) {
|
|
362
|
+
if (!entry.arrived) {
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
const partyId = p.of.get(keyOf(h, playerId));
|
|
366
|
+
const invite = p.invites.get(playerId);
|
|
367
|
+
const proposal = partyId ? p.proposals.get(partyId) : null;
|
|
368
|
+
const state = {
|
|
369
|
+
// The members here, this player left out; a block hides a member's name.
|
|
370
|
+
members: partyId ? present(h, partyId).filter((id) => id !== playerId && !hidden(d, playerId, id)) : null,
|
|
371
|
+
away: partyId ? p.parties.get(partyId).away.size : 0,
|
|
372
|
+
invite: invite ? { from: invite.from, username: d.usernameOf(h, invite.from) } : null,
|
|
373
|
+
// Only the proposer and the members asked hear of a proposal.
|
|
374
|
+
proposal: proposal && (proposal.by === playerId || proposal.asked.has(playerId))
|
|
375
|
+
? {
|
|
376
|
+
id: proposal.id,
|
|
377
|
+
door: proposal.door,
|
|
378
|
+
by: proposal.by,
|
|
379
|
+
username: d.usernameOf(h, proposal.by),
|
|
380
|
+
asked: proposal.asked.has(playerId),
|
|
381
|
+
}
|
|
382
|
+
: null,
|
|
383
|
+
};
|
|
384
|
+
const json = JSON.stringify(state);
|
|
385
|
+
if (json !== (p.sent.get(playerId) ?? 'null') && !(json === EMPTY && !p.sent.has(playerId))) {
|
|
386
|
+
p.sent.set(playerId, json);
|
|
387
|
+
h.session?.send(playerId, { k: 'hub-party', ...state });
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const EMPTY = JSON.stringify({ members: null, away: 0, invite: null, proposal: null });
|
|
393
|
+
|
|
394
|
+
// `hub.coming(doorId)`: how many party members were asked to a door and have
|
|
395
|
+
// not answered yet, so a place may hold its pad's countdown for them. A
|
|
396
|
+
// party holds a pad this way for at most 20 s in any minute.
|
|
397
|
+
export function coming(h, doorId) {
|
|
398
|
+
let n = 0;
|
|
399
|
+
const now = Date.now();
|
|
400
|
+
for (const proposal of h.party.proposals.values()) {
|
|
401
|
+
if (proposal.door === doorId && proposal.holdUntil > now) {
|
|
402
|
+
n += proposal.asked.size;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return n;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// `hub.partyOf(playerId)`: the other members of their party who are here.
|
|
409
|
+
export function matesHere(h, playerId) {
|
|
410
|
+
const partyId = h.party.of.get(keyOf(h, playerId));
|
|
411
|
+
return partyId ? present(h, partyId).filter((id) => id !== playerId) : [];
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Whether two players here are in one party (Join goes to a party member).
|
|
415
|
+
export function together(h, a, b) {
|
|
416
|
+
const partyId = h.party.of.get(keyOf(h, a));
|
|
417
|
+
return Boolean(partyId) && partyId === h.party.of.get(keyOf(h, b));
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// A player left the session. A guest leaves their party with them; a
|
|
421
|
+
// signed-in member is kept as away (`tick`). Called while the player is known.
|
|
422
|
+
export function forget(h, playerId) {
|
|
423
|
+
const p = h.party;
|
|
424
|
+
const key = keyOf(h, playerId);
|
|
425
|
+
if (!key.startsWith('u:')) {
|
|
426
|
+
leaveParty(h, key);
|
|
427
|
+
}
|
|
428
|
+
p.invites.delete(playerId);
|
|
429
|
+
for (const [id, invite] of p.invites) {
|
|
430
|
+
if (invite.from === playerId) {
|
|
431
|
+
p.invites.delete(id);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
for (const proposal of p.proposals.values()) {
|
|
435
|
+
proposal.asked.delete(playerId);
|
|
436
|
+
}
|
|
437
|
+
p.rate.delete(playerId);
|
|
438
|
+
p.sent.delete(playerId);
|
|
439
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Which place a session runs, from the session alone (contract §2). A client
|
|
2
|
+
// never names it: the M0 town let the first client pick the scene, which let
|
|
3
|
+
// any client start a session of any of the deck's scenes.
|
|
4
|
+
//
|
|
5
|
+
// 1. `session.place`, stamped by the host from the door that placed the
|
|
6
|
+
// session (ghost's door table). No production host stamps it yet.
|
|
7
|
+
// 2. On the dev serve only, the named key in the session id:
|
|
8
|
+
// `dev:hub.<place>.<instance>`, the key `hub.go` mints (behind a
|
|
9
|
+
// `deck:<name>/` prefix when the door leads to another local deck). A `dev:` id exists
|
|
10
|
+
// only on `castle-web serve`, where every client is the author's own; a
|
|
11
|
+
// production named key is a client's choice and is never read.
|
|
12
|
+
// 3. Otherwise the deck's main place.
|
|
13
|
+
|
|
14
|
+
import { MAIN_PLACE } from './manifest.js';
|
|
15
|
+
|
|
16
|
+
// A door to another local deck runs that deck's server under
|
|
17
|
+
// `deck:<name>/hub.<place>.<instance>` (the serve's devDecks, content-pack.md).
|
|
18
|
+
const DEV_KEY = /^dev:(?:deck:[A-Za-z0-9_-]{1,40}\/)?hub\.([a-z][a-z0-9-]{0,23})\.[A-Za-z0-9-]{1,40}$/;
|
|
19
|
+
|
|
20
|
+
// `{ id, source }`, `id` always a place the manifest has.
|
|
21
|
+
export function resolvePlace(session, manifest) {
|
|
22
|
+
const stamped = typeof session?.place === 'string' ? session.place : null;
|
|
23
|
+
if (stamped) {
|
|
24
|
+
if (manifest.places[stamped]) {
|
|
25
|
+
return { id: stamped, source: 'host' };
|
|
26
|
+
}
|
|
27
|
+
console.warn(`[hub] the host placed this session at "${stamped}", which this deck does not declare`);
|
|
28
|
+
return { id: MAIN_PLACE, source: 'fallback' };
|
|
29
|
+
}
|
|
30
|
+
const dev = DEV_KEY.exec(String(session?.sessionId ?? ''));
|
|
31
|
+
if (dev) {
|
|
32
|
+
if (manifest.places[dev[1]]) {
|
|
33
|
+
return { id: dev[1], source: 'dev-key' };
|
|
34
|
+
}
|
|
35
|
+
console.warn(`[hub] dev session key names "${dev[1]}", which this deck does not declare`);
|
|
36
|
+
}
|
|
37
|
+
return { id: MAIN_PLACE, source: 'default' };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// The named key `hub.go` joins in dev: the place, then a fresh instance.
|
|
41
|
+
export function devKey(placeId) {
|
|
42
|
+
return `hub.${placeId}.${Math.random().toString(36).slice(2, 10)}`;
|
|
43
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Quick reactions and phrases (contract §6, v1.11): what every player can say
|
|
2
|
+
// without typing a word. A reaction is one of the kit's emoji; a phrase is one
|
|
3
|
+
// of the kit's canned lines, named by id. The words are the kit's, written on
|
|
4
|
+
// each client from the id, so nothing a player types is ever carried. Shown
|
|
5
|
+
// as a bubble over the speaker for everyone here who may see them, never
|
|
6
|
+
// across a block.
|
|
7
|
+
|
|
8
|
+
// The emoji a reaction may be, by index.
|
|
9
|
+
export const REACTIONS = ['👍', '😂', '❤️', '😮', '👋', '🎉'];
|
|
10
|
+
// The phrases, by id: where each may be said (`town`, a place with no
|
|
11
|
+
// `result`; `game`, one with) and whether it names a door.
|
|
12
|
+
export const PHRASES = {
|
|
13
|
+
here: { town: true, game: true },
|
|
14
|
+
play: { town: true, game: false, door: true },
|
|
15
|
+
wait: { town: true, game: true },
|
|
16
|
+
yes: { town: true, game: true },
|
|
17
|
+
no: { town: true, game: true },
|
|
18
|
+
gg: { town: false, game: true },
|
|
19
|
+
again: { town: false, game: true },
|
|
20
|
+
back: { town: false, game: true },
|
|
21
|
+
};
|
|
22
|
+
// One player's: a burst of three, then one every 1.5 s.
|
|
23
|
+
const BURST = 3;
|
|
24
|
+
const EVERY_MS = 1500;
|
|
25
|
+
// "Let's play <door>" names the door the speaker stands within this of.
|
|
26
|
+
const PLAY_NEAR_M = 12;
|
|
27
|
+
|
|
28
|
+
export function newSayState() {
|
|
29
|
+
return { sayRate: new Map() };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// `d` is the hub layer's own: `{ h, blockedPairs, jumpDoors }`.
|
|
33
|
+
export function message(d, player, data) {
|
|
34
|
+
const h = d.h;
|
|
35
|
+
const playerId = player?.playerId;
|
|
36
|
+
const body = playerId ? h.sim?.players.get(playerId) : null;
|
|
37
|
+
if (!body || !h.players.get(playerId)?.arrived) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const game = Boolean(h.place.result);
|
|
41
|
+
const out = { k: 'hub-said', player: playerId };
|
|
42
|
+
if (Number.isInteger(data?.r) && data.r >= 0 && data.r < REACTIONS.length) {
|
|
43
|
+
out.r = data.r;
|
|
44
|
+
} else if (typeof data?.p === 'string' && Object.hasOwn(PHRASES, data.p) && PHRASES[data.p][game ? 'game' : 'town']) {
|
|
45
|
+
out.p = data.p;
|
|
46
|
+
if (PHRASES[data.p].door) {
|
|
47
|
+
// The door they stand by, if any: the client words it from its own list.
|
|
48
|
+
let best = null;
|
|
49
|
+
for (const door of d.jumpDoors(h)) {
|
|
50
|
+
const dist = Math.hypot(body.at.x - door.t.x, body.at.z - door.t.z);
|
|
51
|
+
if (dist <= PLAY_NEAR_M && (!best || dist < best.dist)) {
|
|
52
|
+
best = { dist, id: door.id };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
out.door = best?.id ?? null;
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const now = Date.now();
|
|
61
|
+
const r = h.sayRate.get(playerId) ?? { tokens: BURST, at: now };
|
|
62
|
+
r.tokens = Math.min(BURST, r.tokens + (now - r.at) / EVERY_MS);
|
|
63
|
+
r.at = now;
|
|
64
|
+
h.sayRate.set(playerId, r);
|
|
65
|
+
if (r.tokens < 1) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
r.tokens -= 1;
|
|
69
|
+
const hidden = d.blockedPairs(h)?.get(playerId);
|
|
70
|
+
if (!hidden?.size) {
|
|
71
|
+
h.session?.broadcast(out);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
for (const id of h.sim.players.keys()) {
|
|
75
|
+
if (!hidden.has(id)) {
|
|
76
|
+
h.session?.send(id, out);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function forget(h, playerId) {
|
|
82
|
+
h.sayRate.delete(playerId);
|
|
83
|
+
}
|