Skip to content

Commit

Permalink
fix store.ts compile
Browse files Browse the repository at this point in the history
  • Loading branch information
hpx7 committed Apr 10, 2024
1 parent 71a3a44 commit 1d4ff64
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions templates/base/server/.hathora/store.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export async function loadState(stateId: RoomId) {
const userId = reader.readString();
const argsBuffer = reader.readBuffer(reader.readUVarint());
const chance = Chance(seed.toString());
const impl = new ImplWrapper(ctxNoEvents(chance, time), argsBuffer);
const impl = new ImplWrapper(ctxNoEvents(chance, time, stateId), argsBuffer);

for (let i = 1; i < rows.length; i++) {
const { time, record } = rows[i];
Expand All @@ -203,13 +203,13 @@ export async function loadState(stateId: RoomId) {
{{#if tick}}
if (method === 0xff) {
const timeDelta = reader.readUVarint();
await impl.onTick(ctxNoEvents(chance, time), timeDelta / 1000);
await impl.onTick(ctxNoEvents(chance, time, stateId), timeDelta / 1000);
continue;
}
{{/if}}
const userId = reader.readString();
const argsBuffer = reader.readBuffer(reader.readUVarint());
await impl.getResult(userId, method, ctxNoEvents(chance, time), argsBuffer);
await impl.getResult(userId, method, ctxNoEvents(chance, time, stateId), argsBuffer);
}

return { impl, chance };
Expand Down Expand Up @@ -291,8 +291,8 @@ function ctx(chance: Chance.Chance, time: number, stateId: RoomId): Context {
};
}

function ctxNoEvents(chance: Chance.Chance, time: number): Context {
return { chance, time, sendEvent() {}, broadcastEvent() {} };
function ctxNoEvents(chance: Chance.Chance, time: number, stateId: RoomId): Context {
return { roomId: stateId, chance, time, sendEvent() {}, broadcastEvent() {} };
}

function addPendingMessage(stateId: RoomId, userId: UserId) {
Expand Down

0 comments on commit 1d4ff64

Please sign in to comment.