vimp-engine 0.22.1 → 0.23.0
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/bin/vimp-surface.js +88 -0
- package/core/Cargo.toml +1 -1
- package/package.json +1 -1
- package/src/client/lib/formBuilder.js +27 -8
- package/src/client/lib/socketDispatch.js +34 -0
- package/src/client/main.js +55 -7
- package/src/config/abiOps.js +31 -0
- package/src/config/clientServices.js +27 -0
- package/src/config/opcodes.js +11 -2
- package/src/config/wsports.js +9 -0
- package/src/devtools/contract/loadContext.js +25 -2
- package/src/devtools/contract/rules/b10-respawns.js +5 -3
- package/src/devtools/contract/rules/b2-engine-api.js +31 -8
- package/src/devtools/contract/rules/b3-game-config-shape.js +46 -5
- package/src/devtools/contract/rules/b4-teams.js +6 -3
- package/src/devtools/contract/rules/b5-room-form.js +40 -8
- package/src/devtools/contract/rules/c4-component-dependencies.js +10 -15
- package/src/devtools/surface/abiParse.js +175 -0
- package/src/devtools/surface/collect.js +413 -0
- package/src/host/GameCoreAdapter.js +49 -0
- package/src/lib/applyRoomOverrides.js +14 -2
- package/src/lib/capabilities.js +32 -0
- package/src/lib/coreConfig.js +3 -3
- package/src/lib/createHostRuntime.js +5 -3
- package/src/lib/formControls.js +89 -0
- package/src/lib/gameConfigView.js +211 -0
- package/src/lib/gamePlugin.js +65 -87
- package/src/lib/loadGamePackage.js +9 -2
- package/src/lib/registry.js +94 -0
- package/src/standalone/index.js +27 -13
- package/tests/fixtures/generations/gen-api3/README.md +7 -0
- package/tests/fixtures/generations/gen-api3/client/fakeClientCore.js +307 -0
- package/tests/fixtures/generations/gen-api3/client/index.js +38 -0
- package/tests/fixtures/generations/gen-api3/client/parts/Actor.js +18 -0
- package/tests/fixtures/generations/gen-api3/client/parts/ActorRadar.js +7 -0
- package/tests/fixtures/generations/gen-api3/config/auth.js +41 -0
- package/tests/fixtures/generations/gen-api3/config/client.js +151 -0
- package/tests/fixtures/generations/gen-api3/config/game.js +167 -0
- package/tests/fixtures/generations/gen-api3/core/pkg-node/core.js +4 -0
- package/tests/fixtures/generations/gen-api3/host/ScriptedManager.js +129 -0
- package/tests/fixtures/generations/gen-api3/host/createModules.js +6 -0
- package/tests/fixtures/generations/gen-api3/host/fakeCore.js +263 -0
- package/tests/fixtures/generations/gen-api3/host/index.js +30 -0
- package/tests/fixtures/generations/gen-api3/host/spawnCommand.js +14 -0
- package/tests/fixtures/generations/gen-api3/host/systemMessages.js +6 -0
- package/tests/fixtures/generations/gen-api3/manifest.json +25 -0
- package/tests/fixtures/generations/gen-api4/README.md +7 -0
- package/tests/fixtures/generations/gen-api4/client/fakeClientCore.js +307 -0
- package/tests/fixtures/generations/gen-api4/client/index.js +38 -0
- package/tests/fixtures/generations/gen-api4/client/parts/Actor.js +18 -0
- package/tests/fixtures/generations/gen-api4/client/parts/ActorRadar.js +7 -0
- package/tests/fixtures/generations/gen-api4/config/auth.js +41 -0
- package/tests/fixtures/generations/gen-api4/config/client.js +151 -0
- package/tests/fixtures/generations/gen-api4/config/game.js +156 -0
- package/tests/fixtures/generations/gen-api4/core/pkg-node/core.js +4 -0
- package/tests/fixtures/generations/gen-api4/host/ScriptedManager.js +129 -0
- package/tests/fixtures/generations/gen-api4/host/createModules.js +6 -0
- package/tests/fixtures/generations/gen-api4/host/fakeCore.js +263 -0
- package/tests/fixtures/generations/gen-api4/host/index.js +30 -0
- package/tests/fixtures/generations/gen-api4/host/spawnCommand.js +14 -0
- package/tests/fixtures/generations/gen-api4/host/systemMessages.js +6 -0
- package/tests/fixtures/generations/gen-api4/manifest.json +17 -0
- package/tests/fixtures/miniGame/client/fakeClientCore.js +17 -0
- package/tests/fixtures/miniGame/host/fakeCore.js +38 -8
|
@@ -145,15 +145,28 @@ export default class FakeGameCore {
|
|
|
145
145
|
return actor ? [actor.x, actor.y] : [];
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// FIRST_SHOT_DATA: полный снапшот игроков в раскладке снапшот-схемы
|
|
149
|
+
// (ключ схемы -> id -> поля), а не плоским списком: ровно её разбирает
|
|
150
|
+
// клиент (applyShot браузера и VirtualClient._applyGameData). Плоский
|
|
151
|
+
// список доезжал до клиента ключами '0', '1' — сущность первого кадра
|
|
152
|
+
// не появлялась на холсте, и видно это только со второго участника
|
|
148
153
|
players_data() {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
const entry = Object.entries(
|
|
155
|
+
this._config.engine?.snapshot?.keys ?? {},
|
|
156
|
+
).find(([, spec]) => spec.class === 'hot' && spec.kind === 'indexed8');
|
|
157
|
+
|
|
158
|
+
if (!entry) {
|
|
159
|
+
return '{}';
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const [key, spec] = entry;
|
|
163
|
+
const rows = {};
|
|
164
|
+
|
|
165
|
+
for (const [id, actor] of this._actors) {
|
|
166
|
+
rows[id] = spec.fields.map(field => Number(actor[field.name] ?? 0));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return JSON.stringify({ [key]: rows });
|
|
157
170
|
}
|
|
158
171
|
|
|
159
172
|
// ***** игровой тик ***** //
|
|
@@ -247,4 +260,21 @@ export default class FakeGameCore {
|
|
|
247
260
|
|
|
248
261
|
this._actors = new Map(entries);
|
|
249
262
|
}
|
|
263
|
+
|
|
264
|
+
// ***** расширение (этап 4 плана plugin-forward-compat) ***** //
|
|
265
|
+
|
|
266
|
+
// самоописание: фикстура представляет ядро текущего поколения, поэтому
|
|
267
|
+
// отвечает так же, как раскрытие движкового макроса
|
|
268
|
+
abi_describe() {
|
|
269
|
+
return JSON.stringify({ abi: 1, core: 'fixture', ops: ['debug.json'] });
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// опкод вместо нового символа: пустой ответ — «не обработан»
|
|
273
|
+
dispatch(op) {
|
|
274
|
+
if (op === 'debug.json') {
|
|
275
|
+
return new TextEncoder().encode(this.debug_json());
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return new Uint8Array(0);
|
|
279
|
+
}
|
|
250
280
|
}
|