feat(03-01): add Node-safe core state construction

- isolate legacy loading behind internal dependencies
- provide memory saves and remove singleton back-edges
This commit is contained in:
AncTe committed 2026-09-10 15:35:01 +08:00
1 parent 51d1796358
commit a707be4856
9 files changed
+310 -64

No files matched your search

+9 -4
View File
@@ -70,13 +70,18 @@ class GameLoading extends EventEmitter<GameLoadEvent> {
}
export const loading = new GameLoading();
main.loading = loading;
if (typeof main !== 'undefined') {
main.loading = loading;
}
let clientRegistered = false;
let dataRegistered = false;
function checkRegistered() {
if (main.replayChecking || main.mode === 'editor') {
if (
typeof main !== 'undefined' &&
(main.replayChecking || main.mode === 'editor')
) {
clientRegistered = true;
}
if (clientRegistered && dataRegistered) {
@@ -168,8 +173,8 @@ class GameListener extends EventEmitter<ListenerEvent> {
constructor() {
super();
if (main.replayChecking) return;
if (window.core) {
if (typeof main === 'undefined' || main.replayChecking) return;
if (typeof window !== 'undefined' && window.core) {
this.init();
} else {
loading.once('coreInit', () => {
+1 -1
View File
@@ -40,7 +40,7 @@ export class HeroMover<T extends IHeroLocation>
readonly tile: T,
faceHandler: IFaceHandler<FaceDirection>
) {
super(faceHandler, tile.getCurrentFaceDirection());
super(faceHandler, FaceDirection.Unknown);
this.state = tile.state;
}