mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-03 13:55:36 +02:00
dont init task if we are loading mem, works w smelting
This commit is contained in:
parent
a760b11b65
commit
9e2b7c3e22
3 changed files with 21 additions and 5 deletions
|
@ -57,5 +57,19 @@
|
|||
"number_of_target": 1,
|
||||
"type": "techtree",
|
||||
"timeout": 300
|
||||
},
|
||||
"smelt_ingot": {
|
||||
"goal": "Smelt 1 iron ingot and 1 copper ingot",
|
||||
"agent_count": 1,
|
||||
"initial_inventory": {
|
||||
"furnace": 1,
|
||||
"raw_iron": 1,
|
||||
"raw_copper": 1,
|
||||
"coal": 2
|
||||
},
|
||||
"target": "copper_ingot",
|
||||
"number_of_target": 1,
|
||||
"type": "techtree",
|
||||
"timeout": 300
|
||||
}
|
||||
}
|
|
@ -91,7 +91,9 @@ export class Agent {
|
|||
this._setupEventHandlers(save_data, init_message);
|
||||
this.startEvents();
|
||||
|
||||
this.task.initBotTask();
|
||||
if (!load_mem) {
|
||||
this.task.initBotTask();
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in spawn event:', error);
|
||||
|
|
|
@ -101,19 +101,19 @@ export class Task {
|
|||
return;
|
||||
let bot = this.agent.bot;
|
||||
let name = this.agent.name;
|
||||
|
||||
|
||||
bot.chat(`/clear ${name}`);
|
||||
console.log(`Cleared ${name}'s inventory.`);
|
||||
|
||||
//wait for a bit so inventory is cleared
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
|
||||
let initial_inventory = null;
|
||||
if (this.data.agent_count > 1) {
|
||||
let initial_inventory = this.data.initial_inventory[this.agent.count_id.toString()];
|
||||
initial_inventory = this.data.initial_inventory[this.agent.count_id.toString()];
|
||||
console.log("Initial inventory:", initial_inventory);
|
||||
} else if (this.data) {
|
||||
console.log("Initial inventory:", this.data.initial_inventory);
|
||||
let initial_inventory = this.data.initial_inventory;
|
||||
initial_inventory = this.data.initial_inventory;
|
||||
}
|
||||
|
||||
if ("initial_inventory" in this.data) {
|
||||
|
|
Loading…
Add table
Reference in a new issue