Commit d443f7d5 authored by nanahira's avatar nanahira

add room events

parent 72362a53
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"aragami": "^1.2.10", "aragami": "^1.2.10",
"axios": "^1.13.5", "axios": "^1.13.5",
"better-lock": "^3.2.0", "better-lock": "^3.2.0",
"crypto-random-string": "3.3.1",
"http-proxy-agent": "^7.0.2", "http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.6", "https-proxy-agent": "^7.0.6",
"ipaddr.js": "^2.3.0", "ipaddr.js": "^2.3.0",
...@@ -2862,6 +2863,27 @@ ...@@ -2862,6 +2863,27 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/crypto-random-string": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-3.3.1.tgz",
"integrity": "sha512-5j88ECEn6h17UePrLi6pn1JcLtAiANa3KExyr9y9Z5vo2mv56Gh3I4Aja/B9P9uyMwyxNHAHWv+nE72f30T5Dg==",
"license": "MIT",
"dependencies": {
"type-fest": "^0.8.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/crypto-random-string/node_modules/type-fest": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
"integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
"license": "(MIT OR CC0-1.0)",
"engines": {
"node": ">=8"
}
},
"node_modules/dateformat": { "node_modules/dateformat": {
"version": "4.6.3", "version": "4.6.3",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz",
......
import { RoomEvent } from "./room-event";
export class OnRoomCreate extends RoomEvent {}
import { RoomEvent } from "./room-event";
export class OnRoomFinalize extends RoomEvent {}
...@@ -92,6 +92,8 @@ import { canIncreaseTime } from '../utility/can-increase-time'; ...@@ -92,6 +92,8 @@ import { canIncreaseTime } from '../utility/can-increase-time';
import { TimerState } from './timer-state'; import { TimerState } from './timer-state';
import { makeArray } from 'aragami/dist/src/utility/utility'; import { makeArray } from 'aragami/dist/src/utility/utility';
import path from 'path'; import path from 'path';
import { OnRoomCreate } from './room-event/on-room-create';
import { OnRoomFinalize } from './room-event/on-room-finalize';
const { OcgcoreScriptConstants } = _OcgcoreConstants; const { OcgcoreScriptConstants } = _OcgcoreConstants;
...@@ -169,6 +171,7 @@ export class Room { ...@@ -169,6 +171,7 @@ export class Room {
if (this.hostinfo.lflist >= 0) { if (this.hostinfo.lflist >= 0) {
this.lflist = (await this.findLFList()) || blankLFList; this.lflist = (await this.findLFList()) || blankLFList;
} }
await this.ctx.dispatch(new OnRoomCreate(this), undefined as any);
return this; return this;
} }
...@@ -211,6 +214,7 @@ export class Room { ...@@ -211,6 +214,7 @@ export class Room {
}, },
'Finalizing room', 'Finalizing room',
); );
await this.ctx.dispatch(new OnRoomFinalize(this), this.allPlayers[0]);
await this.cleanPlayers(sendReplays); await this.cleanPlayers(sendReplays);
while (this.finalizors.length) { while (this.finalizors.length) {
const finalizor = this.finalizors.pop()!; const finalizor = this.finalizors.pop()!;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment