forked from noxious/server
npm run dev
This commit is contained in:
parent
3638e2a793
commit
4f9a1bc879
@ -10,4 +10,4 @@ export default class AlertCommand {
|
||||
if (!message) return console.log('message is required')
|
||||
this.io.emit('notification', { message: message })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,4 @@ export default class ListZonesCommand {
|
||||
public execute(input: CommandInput): void {
|
||||
console.log(ZoneManager.getLoadedZones())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,24 +9,24 @@ export default class TilesCommand {
|
||||
|
||||
public async execute(): Promise<void> {
|
||||
// Get all tiles
|
||||
const tilesDir = path.join(process.cwd(), 'public', 'tiles');
|
||||
const tiles = fs.readdirSync(tilesDir).filter((file) => file.endsWith('.png'));
|
||||
const tilesDir = path.join(process.cwd(), 'public', 'tiles')
|
||||
const tiles = fs.readdirSync(tilesDir).filter((file) => file.endsWith('.png'))
|
||||
|
||||
// Create output directory if it doesn't exist
|
||||
if (!fs.existsSync(tilesDir)) {
|
||||
fs.mkdirSync(tilesDir, { recursive: true });
|
||||
fs.mkdirSync(tilesDir, { recursive: true })
|
||||
}
|
||||
|
||||
for (const tile of tiles) {
|
||||
// Check if tile is already 66x34
|
||||
const metadata = await sharp(path.join(tilesDir, tile)).metadata();
|
||||
const metadata = await sharp(path.join(tilesDir, tile)).metadata()
|
||||
if (metadata.width === 66 && metadata.height === 34) {
|
||||
commandLogger.info(`Tile ${tile} already processed`);
|
||||
continue;
|
||||
commandLogger.info(`Tile ${tile} already processed`)
|
||||
continue
|
||||
}
|
||||
|
||||
const inputPath = path.join(tilesDir, tile);
|
||||
const outputPath = path.join(tilesDir, tile);
|
||||
const inputPath = path.join(tilesDir, tile)
|
||||
const outputPath = path.join(tilesDir, tile)
|
||||
|
||||
try {
|
||||
await sharp(inputPath)
|
||||
@ -36,14 +36,14 @@ export default class TilesCommand {
|
||||
fit: 'fill',
|
||||
kernel: 'nearest'
|
||||
})
|
||||
.toFile(outputPath);
|
||||
.toFile(outputPath)
|
||||
|
||||
commandLogger.info(`Processed: ${tile}`);
|
||||
commandLogger.info(`Processed: ${tile}`)
|
||||
} catch (error) {
|
||||
console.error(`Error processing ${tile}:`, error);
|
||||
console.error(`Error processing ${tile}:`, error)
|
||||
}
|
||||
}
|
||||
|
||||
commandLogger.info('Tile processing completed.');
|
||||
commandLogger.info('Tile processing completed.')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,9 +67,15 @@ class CommandManager {
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
const extension = config.ENV === 'development' ? '.ts' : '.js'
|
||||
const extension = path.extname(file)
|
||||
const commandName = path.basename(file, extension)
|
||||
const commandPath = path.join(commandsDir, `${commandName}${extension}`)
|
||||
|
||||
let commandPath: string
|
||||
commandPath = path.join(commandsDir, `${commandName}.js`)
|
||||
|
||||
if (config.ENV === 'development') {
|
||||
commandPath = path.join(commandsDir, `${commandName}.ts`)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(commandPath)) {
|
||||
commandLogger.warn(`Command file not found: ${commandPath}`)
|
||||
@ -104,4 +110,4 @@ class CommandManager {
|
||||
}
|
||||
}
|
||||
|
||||
export default new CommandManager()
|
||||
export default new CommandManager()
|
||||
|
@ -74,7 +74,7 @@ export class Server {
|
||||
await CharacterManager.boot()
|
||||
|
||||
// Load command manager
|
||||
await CommandManager.boot(this.io);
|
||||
await CommandManager.boot(this.io)
|
||||
|
||||
// Listen for socket connections
|
||||
this.io.on('connection', this.handleConnection.bind(this))
|
||||
|
@ -43,13 +43,6 @@ const watchLogs = () => {
|
||||
})
|
||||
}
|
||||
|
||||
export const {
|
||||
http: httpLogger,
|
||||
game: gameLogger,
|
||||
gameMaster: gameMasterLogger,
|
||||
app: appLogger,
|
||||
queue: queueLogger,
|
||||
command: commandLogger
|
||||
} = loggers
|
||||
export const { http: httpLogger, game: gameLogger, gameMaster: gameMasterLogger, app: appLogger, queue: queueLogger, command: commandLogger } = loggers
|
||||
|
||||
export { watchLogs }
|
||||
|
Loading…
x
Reference in New Issue
Block a user