mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-06 23:35:39 +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,
|
"number_of_target": 1,
|
||||||
"type": "techtree",
|
"type": "techtree",
|
||||||
"timeout": 300
|
"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._setupEventHandlers(save_data, init_message);
|
||||||
this.startEvents();
|
this.startEvents();
|
||||||
|
|
||||||
|
if (!load_mem) {
|
||||||
this.task.initBotTask();
|
this.task.initBotTask();
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error in spawn event:', error);
|
console.error('Error in spawn event:', error);
|
||||||
|
|
|
@ -107,13 +107,13 @@ export class Task {
|
||||||
|
|
||||||
//wait for a bit so inventory is cleared
|
//wait for a bit so inventory is cleared
|
||||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
|
let initial_inventory = null;
|
||||||
if (this.data.agent_count > 1) {
|
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);
|
console.log("Initial inventory:", initial_inventory);
|
||||||
} else if (this.data) {
|
} else if (this.data) {
|
||||||
console.log("Initial inventory:", this.data.initial_inventory);
|
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) {
|
if ("initial_inventory" in this.data) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue