@hadoku/game-server 0.1.89 → 0.1.90
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/people.d.ts +8 -1
- package/dist/people.js +5 -3
- package/package.json +5 -5
package/dist/people.d.ts
CHANGED
|
@@ -73,6 +73,8 @@ interface PersonRooms {
|
|
|
73
73
|
}): void;
|
|
74
74
|
setAvatar(roomId: string, memberId: string, avatarId: string | null): boolean;
|
|
75
75
|
setLook(roomId: string, memberId: string, look: Look | undefined): boolean;
|
|
76
|
+
/** A person the room still shows but who is no longer in it (a game's entrant who left): how their account names and draws them now. */
|
|
77
|
+
nameDeparted?(roomId: string, memberId: string, person: Person): void;
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
78
80
|
* Write `person` onto member `memberId` of `roomId`: their name in every room they are in, their
|
|
@@ -92,10 +94,15 @@ export interface PeopleRooms extends PersonRooms {
|
|
|
92
94
|
memberId: string;
|
|
93
95
|
userId: string;
|
|
94
96
|
}[];
|
|
97
|
+
/** The people the room still shows who are no longer in it (`PersonRooms.nameDeparted`), by registry userId. */
|
|
98
|
+
departedOf?(roomId: string): {
|
|
99
|
+
memberId: string;
|
|
100
|
+
userId: string;
|
|
101
|
+
}[];
|
|
95
102
|
}
|
|
96
103
|
/**
|
|
97
104
|
* Every member of a room that changes is written from their account (`applyPerson`, from the
|
|
98
|
-
* cache mostly), so a joiner and a member a restart left unnamed (R12) are named and dressed
|
|
105
|
+
* cache mostly), and so is every person it still shows who has left it (`departedOf`), so a joiner and a member a restart left unnamed (R12) are named and dressed
|
|
99
106
|
* whether or not they have the room open. A change made while the room IS open reaches it live
|
|
100
107
|
* through the served room (`room/serve.ts`); `sweep` is the boot's one read of the restored rooms,
|
|
101
108
|
* and `arrived` reads one person fresh as they come into a room, so a change made since the
|
package/dist/people.js
CHANGED
|
@@ -71,8 +71,10 @@ export function createPeople(opts) {
|
|
|
71
71
|
* for leaves what the room already holds.
|
|
72
72
|
*/
|
|
73
73
|
export function applyPerson(rooms, roomId, memberId, person) {
|
|
74
|
-
if (rooms.get(roomId)?.members.some((m) => m.id === memberId) !== true)
|
|
74
|
+
if (rooms.get(roomId)?.members.some((m) => m.id === memberId) !== true) {
|
|
75
|
+
rooms.nameDeparted?.(roomId, memberId, person);
|
|
75
76
|
return;
|
|
77
|
+
}
|
|
76
78
|
if (person.name !== null)
|
|
77
79
|
rooms.rename({ id: memberId, name: person.name });
|
|
78
80
|
if (person.sprite !== null)
|
|
@@ -81,7 +83,7 @@ export function applyPerson(rooms, roomId, memberId, person) {
|
|
|
81
83
|
}
|
|
82
84
|
/**
|
|
83
85
|
* Every member of a room that changes is written from their account (`applyPerson`, from the
|
|
84
|
-
* cache mostly), so a joiner and a member a restart left unnamed (R12) are named and dressed
|
|
86
|
+
* cache mostly), and so is every person it still shows who has left it (`departedOf`), so a joiner and a member a restart left unnamed (R12) are named and dressed
|
|
85
87
|
* whether or not they have the room open. A change made while the room IS open reaches it live
|
|
86
88
|
* through the served room (`room/serve.ts`); `sweep` is the boot's one read of the restored rooms,
|
|
87
89
|
* and `arrived` reads one person fresh as they come into a room, so a change made since the
|
|
@@ -89,7 +91,7 @@ export function applyPerson(rooms, roomId, memberId, person) {
|
|
|
89
91
|
*/
|
|
90
92
|
export function attachPeople(rooms, people) {
|
|
91
93
|
const write = async (open) => {
|
|
92
|
-
const users = open.map((roomId) => ({ roomId, users: rooms.usersOf(roomId) }));
|
|
94
|
+
const users = open.map((roomId) => ({ roomId, users: [...rooms.usersOf(roomId), ...(rooms.departedOf?.(roomId) ?? [])] }));
|
|
93
95
|
const found = await people.resolve(users.flatMap((r) => r.users.map((u) => u.userId)));
|
|
94
96
|
for (const r of users) {
|
|
95
97
|
for (const { memberId, userId } of r.users) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/game-server",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.90",
|
|
4
|
+
"gitHead": "e23485ea4ec7df82776c1c582ec5e8c4e7e34f0d",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "The server parts any hosted game shares, above the kernel: the app config and edge auth, the room core (identity, seats, sessions, membership, the room list, the generic room routes), match hosting (the host contract, local and remote JVMs, placement, the start queue, recordings, the in-process and relay runtimes), streams, erase, telemetry and usage. Knows no game; Magic plugs in from apps/server. MIT; imports only node built-ins, express, socket.io, @wolffm/* and the platform packages.",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"play/remote/"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.
|
|
20
|
-
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.
|
|
21
|
-
"@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.
|
|
19
|
+
"@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.90",
|
|
20
|
+
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.90",
|
|
21
|
+
"@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.123",
|
|
22
22
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.31",
|
|
23
23
|
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.127",
|
|
24
24
|
"@wolffm/rooms-server": "npm:@hadoku/rooms-server@^0.45.127",
|