1
0
forked from noxious/server

Almost finalised refactoring

This commit is contained in:
2025-01-03 14:35:02 +01:00
parent fecdf222d7
commit a40b71140a
35 changed files with 257 additions and 410 deletions

View File

@ -27,7 +27,7 @@ export default class InitCommand extends BaseCommand {
public async execute(): Promise<void> {
// Assets
await this.importTiles()
await this.importObjects()
await this.importMapObjects()
await this.createCharacterType()
await this.createCharacterHair()
// await this.createCharacterEquipment()
@ -51,19 +51,19 @@ export default class InitCommand extends BaseCommand {
}
}
private async importObjects(): Promise<void> {
for (const object of fs.readdirSync(Storage.getPublicPath('objects'))) {
private async importMapObjects(): Promise<void> {
for (const mapObject of fs.readdirSync(Storage.getPublicPath('map_objects'))) {
const newMapObject = new MapObject()
newMapObject
.setId(object.split('.')[0] as UUID)
.setName('New object')
.setId(mapObject.split('.')[0] as UUID)
.setName('New map object')
.setFrameWidth(
(await sharp(Storage.getPublicPath('objects', object))
(await sharp(Storage.getPublicPath('map_objects', mapObject))
.metadata()
.then((metadata) => metadata.height)) ?? 0
)
.setFrameHeight(
(await sharp(Storage.getPublicPath('objects', object))
(await sharp(Storage.getPublicPath('map_objects', mapObject))
.metadata()
.then((metadata) => metadata.width)) ?? 0
)