From 4b2bcd65be4ea97fbfd052171d25f576d3889760 Mon Sep 17 00:00:00 2001 From: krypek Date: Mon, 13 May 2024 18:29:00 +0200 Subject: [PATCH] Make the crosscode demo version compatible again --- CHANGELOG.md | 1 + src/environment/interactables.ts | 6 +++--- src/hint-system/hints/chest.ts | 2 +- src/hint-system/hints/prop.ts | 2 +- src/hint-system/hints/rhombus-puzzle.ts | 6 +++--- src/plugin.ts | 2 +- src/tts/gather/api.ts | 4 +++- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ef91f..1021d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - Fixed aim analysis hint selection persisting when entering the quick menu - Fixed hint selecting persisting after the upgrade field in Rhombus Dungeon was used - Fixed sound selection persisting after switching categories in the Sound Glossary +- Made the demo version compatible again ## [0.6.0] 2024-04-20 diff --git a/src/environment/interactables.ts b/src/environment/interactables.ts index 1694e58..0685a15 100644 --- a/src/environment/interactables.ts +++ b/src/environment/interactables.ts @@ -33,7 +33,7 @@ export class InteractableHandler { /* in prestart */ SoundManager.continiousCleanupFilters.push('interact') const self = this - ig.ENTITY.Chest.inject({ + ig.ENTITY.Chest?.inject({ openUp() { this.parent() SoundManager.stopCondinious(self.getId(this)) @@ -47,10 +47,10 @@ export class InteractableHandler { setState(state) { this.parent(state) if (this.entity instanceof ig.ENTITY.NPC && (this.entity.xenoDialog || this.entity.xenoDialogGui)) return - if (this.entity instanceof ig.ENTITY.Chest && this.entity.isOpen) return + if (ig.ENTITY.Chest && this.entity instanceof ig.ENTITY.Chest && this.entity.isOpen) return /* this should be in init but if I do it in init then this.entity.propName is still uninitialized */ - if (this.entity instanceof ig.ENTITY.Prop && HProp.getInteractLang(this.entity)) { + if (ig.ENTITY.Prop && this.entity instanceof ig.ENTITY.Prop && HProp.getInteractLang(this.entity)) { const config = SoundManager.continious[self.getId(this.entity)] if (config) { if (!('paths' in config)) throw new Error('invalid pickContiniousSettingsPath settings: paths not included') diff --git a/src/hint-system/hints/chest.ts b/src/hint-system/hints/chest.ts index aa9f8c2..a09e4d5 100644 --- a/src/hint-system/hints/chest.ts +++ b/src/hint-system/hints/chest.ts @@ -9,7 +9,7 @@ export class HChest implements HintBase { /* run in prestart */ HintSystem.customColors['Chests'] = sc.ANALYSIS_COLORS.GREEN const self = this - ig.ENTITY.Chest.inject({ + ig.ENTITY.Chest?.inject({ getQuickMenuSettings(): Omit { return { type: 'Hints', hintName: self.entryName, hintType: 'Chests', disabled: !(Opts.hints && !this.isOpen) } }, diff --git a/src/hint-system/hints/prop.ts b/src/hint-system/hints/prop.ts index e174fd3..a88b1fd 100644 --- a/src/hint-system/hints/prop.ts +++ b/src/hint-system/hints/prop.ts @@ -33,7 +33,7 @@ export class HProp implements HintBase { /* run in prestart */ const self = this - sc.PropInteract.inject({ + sc.PropInteract?.inject({ init(prop, settings) { this.parent(prop, settings) this.iconType = settings.icon ?? 'INFO' diff --git a/src/hint-system/hints/rhombus-puzzle.ts b/src/hint-system/hints/rhombus-puzzle.ts index c6bacf3..71a653b 100644 --- a/src/hint-system/hints/rhombus-puzzle.ts +++ b/src/hint-system/hints/rhombus-puzzle.ts @@ -18,7 +18,7 @@ export class HOLPlatform implements HintBase { constructor() { /* run in prestart */ const self = this - ig.ENTITY.OLPlatform.inject({ + ig.ENTITY.OLPlatform?.inject({ getQuickMenuSettings(): Omit { return { type: 'Hints', @@ -41,7 +41,7 @@ export class HDynamicPlatform implements HintBase { constructor() { /* run in prestart */ const self = this - ig.ENTITY.DynamicPlatform.inject({ + ig.ENTITY.DynamicPlatform?.inject({ getQuickMenuSettings(): Omit { return { type: 'Hints', @@ -73,7 +73,7 @@ export class HBallChanger implements HintBase { constructor() { /* run in prestart */ const self = this - ig.ENTITY.BallChanger.inject({ + ig.ENTITY.BallChanger?.inject({ init(x, y, z, settings) { this.parent(x, y, z, settings) this.settings = settings diff --git a/src/plugin.ts b/src/plugin.ts index 4afe612..c88d627 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -83,6 +83,6 @@ export default class CrossedEyes implements PluginClass { CrossedEyes.initPoststart.forEach(p => p()) await import('./misc/log-keybinding') - if (localStorage.getItem('crossedeyesDev') == 'true') TestMap.start() + if (!ig.isdemo && localStorage.getItem('crossedeyesDev') == 'true') TestMap.start() } } diff --git a/src/tts/gather/api.ts b/src/tts/gather/api.ts index d00b8a4..c34b253 100644 --- a/src/tts/gather/api.ts +++ b/src/tts/gather/api.ts @@ -170,9 +170,11 @@ export class TextGather { await import('./quick-menu') await import('./save-menu') await import('./tutorial-popup') + await import('./checkbox') + + if (ig.isdemo) return await import('./mod-manager') await import('./equipment-menu') - await import('./checkbox') await import('./inventory') } }