@for(tab of tabOrder; track tab.name; let i = $index) {
-
{{ tab.name
}} ({{ tab.count() }})
}
diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss
index e0f5f78..4caa115 100644
--- a/src/app/home/home.component.scss
+++ b/src/app/home/home.component.scss
@@ -41,3 +41,7 @@
overflow-y: auto;
overflow-x: hidden;
}
+
+a.btn-disabled {
+ opacity: 0.5;
+}
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts
index 5950ec6..1399e10 100644
--- a/src/app/home/home.component.ts
+++ b/src/app/home/home.component.ts
@@ -54,7 +54,11 @@ export class HomeComponent {
});
public tabOrder = [
- { name: 'Maps', count: computed(() => this.modService.mod().maps.length) },
+ {
+ name: 'Maps',
+ count: computed(() => this.modService.mod().maps.length),
+ disableOutsideElectron: true,
+ },
{
name: 'Items',
count: computed(() => this.modService.mod().items.length),
@@ -173,4 +177,13 @@ export class HomeComponent {
toggleTester() {
this.tester()?.nativeElement.showModal();
}
+
+ updateResources() {
+ if (this.electronService.isInElectron()) {
+ this.electronService.send('UPDATE_RESOURCES');
+ return;
+ }
+
+ void this.electronService.reloadExternalWebMod();
+ }
}
diff --git a/src/app/services/electron.service.ts b/src/app/services/electron.service.ts
index 60402c5..58f6430 100644
--- a/src/app/services/electron.service.ts
+++ b/src/app/services/electron.service.ts
@@ -29,6 +29,8 @@ export class ElectronService {
private notifyService = inject(NotifyService);
private settingsService = inject(SettingsService);
+ public isInElectron = computed(() => !!window.api);
+
private quicksaveFilepath = computed(() => {
const mod = this.modService.mod();
const settings = this.settingsService.allSettings()[mod.meta.id];
@@ -38,6 +40,8 @@ export class ElectronService {
constructor() {
this.watchIPC();
+ void this.tryLoadingOutsideElectron();
+
effect(() => {
const mod = this.modService.mod();
@@ -53,7 +57,30 @@ export class ElectronService {
});
}
+ public async reloadExternalWebMod() {
+ const basegamecontent = await fetch(
+ 'https://play.rair.land/assets/content/_output/simplemods/BaseGameContent.rairmod.json'
+ );
+ const contentJson = await basegamecontent.json();
+
+ this.modService.updateMod(contentJson as IModKit);
+ }
+
+ private async tryLoadingOutsideElectron() {
+ if (this.isInElectron()) return;
+
+ const mod = this.modService.mod();
+ if (mod.meta.author === 'Anonymous') {
+ await this.reloadExternalWebMod();
+ }
+
+ this.isLoaded.set(true);
+ this.isFirstLoad.set(false);
+ }
+
private watchIPC() {
+ if (!this.isInElectron()) return;
+
window.api.reset();
const tryToReady = () => {
@@ -157,10 +184,12 @@ export class ElectronService {
}
requestJSON(key: ModJSONKey) {
+ if (!this.isInElectron()) return;
window.api.send('JSON', { json: key });
}
send(key: string, value?: any) {
+ if (!this.isInElectron()) return;
window.api.send(key, value);
}
}
diff --git a/src/app/services/mod.service.ts b/src/app/services/mod.service.ts
index e537824..02774e7 100644
--- a/src/app/services/mod.service.ts
+++ b/src/app/services/mod.service.ts
@@ -212,12 +212,12 @@ export class ModService {
// map functions
public ensureMapsExist() {
- window.api.send('ENSURE_MAPS', this.mod().maps);
+ window.api?.send('ENSURE_MAPS', this.mod().maps);
}
public importMap(incomingMap: IEditorMap) {
this.addMap(incomingMap);
- window.api.send('ENSURE_MAP', { ...incomingMap });
+ window.api?.send('ENSURE_MAP', { ...incomingMap });
}
public addMap(incomingMap: IEditorMap) {
diff --git a/src/app/shared/components/cell-buttons/cell-buttons.component.html b/src/app/shared/components/cell-buttons/cell-buttons.component.html
index 2c96563..6986457 100644
--- a/src/app/shared/components/cell-buttons/cell-buttons.component.html
+++ b/src/app/shared/components/cell-buttons/cell-buttons.component.html
@@ -6,14 +6,16 @@
}
@if(params.showCopyButton) {
-
}
@if(params.showRenameButton) {
-
diff --git a/src/app/tabs/droptables/droptables-editor/droptables-editor.component.html b/src/app/tabs/droptables/droptables-editor/droptables-editor.component.html
index 1cc3066..6bf701a 100644
--- a/src/app/tabs/droptables/droptables-editor/droptables-editor.component.html
+++ b/src/app/tabs/droptables/droptables-editor/droptables-editor.component.html
@@ -4,7 +4,8 @@