mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-04 14:25:43 +02:00
Added example tasks for different goals per agent
This commit is contained in:
parent
57c47c0bcf
commit
fd4f952a2c
2 changed files with 13 additions and 3 deletions
|
@ -148,6 +148,9 @@
|
|||
]
|
||||
},
|
||||
"blocked_access_to_recipe": [],
|
||||
"goal": "Collaborate to make 1 bread, 1 cooked_mutton"
|
||||
"goal" : {
|
||||
"0": "Collaborate with randy to make 1 bread and 1 cooked mutton, you can divide the tasks among yourselves.\nThere is a furnace nearby that is already fueled, there is also a smoker and crafting table nearby, use them to your advantage. Crops of all different types are available in the farm where you are standing, you can use them to your advantage as well. The farm also includes animals like cows, pigs, sheep, and chickens that you can use to your advantage.\nSince the farm is huge, make sure to search for the resources over long distances to find them.",
|
||||
"1": "Collaborate with andy to make 1 bread and 1 cooked mutton, you can divide the tasks among yourselves.\nThere is a furnace nearby that is already fueled, there is also a smoker and crafting table nearby, use them to your advantage. Crops of all different types are available in the farm where you are standing, you can use them to your advantage as well. The farm also includes animals like cows, pigs, sheep, and chickens that you can use to your advantage.\nSince the farm is huge, make sure to search for the resources over long distances to find them."
|
||||
}
|
||||
}
|
||||
}
|
|
@ -155,15 +155,21 @@ export class Task {
|
|||
return null;
|
||||
}
|
||||
|
||||
let add_string = '';
|
||||
|
||||
if (this.task_type === 'cooking') {
|
||||
add_string = '\nIn the end, all the food should be given to Andy.';
|
||||
}
|
||||
|
||||
// If goal is a string, all agents share the same goal
|
||||
if (typeof this.data.goal === 'string') {
|
||||
return this.data.goal;
|
||||
return this.data.goal + add_string;
|
||||
}
|
||||
|
||||
// If goal is an object, get the goal for this agent's count_id
|
||||
if (typeof this.data.goal === 'object' && this.data.goal !== null) {
|
||||
const agentId = this.agent.count_id.toString();
|
||||
return this.data.goal[agentId] || null;
|
||||
return (this.data.goal[agentId] || '') + add_string;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -262,6 +268,7 @@ export class Task {
|
|||
}
|
||||
|
||||
const agentGoal = this.getAgentGoal();
|
||||
console.log(`Agent goal for agent Id ${this.agent.count_id}: ${agentGoal}`);
|
||||
if (agentGoal) {
|
||||
console.log(`Setting goal for agent ${this.agent.count_id}: ${agentGoal}`);
|
||||
await executeCommand(this.agent, `!goal("${agentGoal}")`);
|
||||
|
|
Loading…
Add table
Reference in a new issue