Skip to content

Commit

Permalink
better handling of map creator
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Aug 19, 2024
1 parent e75de34 commit 0dda47a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export function watchMaps(sendToUI: SendToUI) {
};

watcher.on('change', (filePath: string) => {
console.log(
`[Map Update]`,
`${filePath} has changed. Sending update to client...`
);
const map = path.basename(filePath, '.json');
updateMap(map);
});
Expand Down
1 change: 1 addition & 0 deletions src/app/services/electron.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class ElectronService {
});

window.api.receive('newmap', (mapData: IEditorMap) => {
console.log('pre', mapData);
this.modService.addMap(mapData);
});

Expand Down
7 changes: 5 additions & 2 deletions src/app/services/mod.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export class ModService {
map.properties ??= {};
map.propertytypes ??= {};

map.properties.creator = mod.meta.author || 'Unknown';
map.properties.creator =
map.properties.creator || mod.meta.author || 'Unknown';
map.propertytypes.creator = 'string';
});
}
Expand Down Expand Up @@ -200,11 +201,13 @@ export class ModService {

const existingMap = mod.maps.findIndex((x) => x.name === incomingMap.name);
if (existingMap !== -1) {
mod.maps.splice(existingMap, 1, incomingMap);
mod.maps[existingMap] = incomingMap;
} else {
mod.maps.push(incomingMap);
}

console.log(incomingMap);

this.updateMod(mod);
}

Expand Down

0 comments on commit 0dda47a

Please sign in to comment.