@uzuhq/code-cli 0.4.1 → 0.5.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/dist/dev-server/game-room.js +28 -14
- package/package.json +1 -1
|
@@ -209,14 +209,17 @@ export class GameRoom {
|
|
|
209
209
|
const tickNow = Date.now();
|
|
210
210
|
const tickDraft = new ScheduleDraft(tickNow, (a) => this.hasAction(a));
|
|
211
211
|
try {
|
|
212
|
-
this.logic.update(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
212
|
+
this.logic.update({
|
|
213
|
+
state: this.gameState,
|
|
214
|
+
ctx: {
|
|
215
|
+
random: this.random,
|
|
216
|
+
tick: this.tickCount,
|
|
217
|
+
now: tickNow,
|
|
218
|
+
schedule: (o) => tickDraft.schedule(o),
|
|
219
|
+
unschedule: (k) => tickDraft.unschedule(k),
|
|
220
|
+
emit,
|
|
221
|
+
playerInputs: this.playerInputs,
|
|
222
|
+
},
|
|
220
223
|
});
|
|
221
224
|
}
|
|
222
225
|
catch (err) {
|
|
@@ -385,14 +388,25 @@ export class GameRoom {
|
|
|
385
388
|
try {
|
|
386
389
|
// 決定的な部分を先に走らせ、serverActions がその結果を見られるようにする。
|
|
387
390
|
if (plain && !legacyServerOnly) {
|
|
388
|
-
plain(
|
|
391
|
+
plain({
|
|
392
|
+
state: this.gameState,
|
|
393
|
+
payload: payload ?? {},
|
|
394
|
+
playerId: senderId,
|
|
395
|
+
ctx: { now, emit, ...scheduleCtx },
|
|
396
|
+
});
|
|
389
397
|
}
|
|
390
398
|
if (serverHandler) {
|
|
391
|
-
await serverHandler(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
399
|
+
await serverHandler({
|
|
400
|
+
state: this.gameState,
|
|
401
|
+
payload: payload ?? {},
|
|
402
|
+
playerId: senderId,
|
|
403
|
+
ctx: {
|
|
404
|
+
tick: this.tickCount,
|
|
405
|
+
random: this.random ?? new SeededRandomImpl(this.seed),
|
|
406
|
+
now,
|
|
407
|
+
emit: serverEmit,
|
|
408
|
+
...scheduleCtx,
|
|
409
|
+
},
|
|
396
410
|
});
|
|
397
411
|
}
|
|
398
412
|
}
|