mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-07 07:45:39 +02:00
Further removed changes from agent.js to resolve merge conflict
This commit is contained in:
parent
a27b336922
commit
1924e2e1cb
1 changed files with 82 additions and 92 deletions
|
@ -19,7 +19,6 @@ export class Agent {
|
||||||
async start(profile_fp, load_mem=false, init_message=null, count_id=0, task_path=null, task_id=null) {
|
async start(profile_fp, load_mem=false, init_message=null, count_id=0, task_path=null, task_id=null) {
|
||||||
this.last_sender = null;
|
this.last_sender = null;
|
||||||
this.count_id = count_id;
|
this.count_id = count_id;
|
||||||
try {
|
|
||||||
if (!profile_fp) {
|
if (!profile_fp) {
|
||||||
throw new Error('No profile filepath provided');
|
throw new Error('No profile filepath provided');
|
||||||
}
|
}
|
||||||
|
@ -77,7 +76,6 @@ export class Agent {
|
||||||
const spawnTimeout = setTimeout(() => {
|
const spawnTimeout = setTimeout(() => {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
this.bot.once('spawn', async () => {
|
this.bot.once('spawn', async () => {
|
||||||
try {
|
try {
|
||||||
clearTimeout(spawnTimeout);
|
clearTimeout(spawnTimeout);
|
||||||
|
@ -92,26 +90,18 @@ export class Agent {
|
||||||
this._setupEventHandlers(save_data, init_message);
|
this._setupEventHandlers(save_data, init_message);
|
||||||
this.startEvents();
|
this.startEvents();
|
||||||
|
|
||||||
|
if (!load_mem) {
|
||||||
this.task.initBotTask();
|
this.task.initBotTask();
|
||||||
|
}
|
||||||
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||||
this.checkAllPlayersPresent();
|
this.checkAllPlayersPresent();
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error in spawn event:', error);
|
console.error('Error in spawn event:', error);
|
||||||
throw error; //rethrow here instead
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
// Ensure we're not losing error details
|
|
||||||
console.error('Agent start failed with error:', {
|
|
||||||
message: error.message || 'No error message',
|
|
||||||
stack: error.stack || 'No stack trace',
|
|
||||||
error: error
|
|
||||||
});
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async _setupEventHandlers(save_data, init_message) {
|
async _setupEventHandlers(save_data, init_message) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue