mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-09-04 21:33:03 +02:00
adding the blueprint to the goal string
This commit is contained in:
parent
d2f46dbe65
commit
095cdc2d6d
2 changed files with 22 additions and 9 deletions
|
@ -27,7 +27,7 @@
|
|||
"techtree_1_shears_with_2_iron_ingot": {
|
||||
"goal": "Build a shear.",
|
||||
"initial_inventory": {
|
||||
"iron_ingot": 1
|
||||
"iron_ingot": 2
|
||||
},
|
||||
"target": "shears",
|
||||
"number_of_target": 1,
|
||||
|
@ -52,7 +52,7 @@
|
|||
},
|
||||
"construction_house": {
|
||||
"type": "construction",
|
||||
"goal": "Make a house with a blueprint below",
|
||||
"goal": "Make a house with the blueprint below",
|
||||
"blueprint": {
|
||||
"materials": {
|
||||
"plank": {
|
||||
|
@ -93,8 +93,8 @@
|
|||
"placement":
|
||||
[
|
||||
["plank", "plank", "plank", "plank", "plank"],
|
||||
["plank", "air", "air", "air", "plank"],
|
||||
["plank", "air", "air", "air", "plank"],
|
||||
["plank", "plank", "plank", "plank", "plank"],
|
||||
["plank", "plank", "plank", "plank", "plank"],
|
||||
["plank", "plank", "plank", "plank", "plank"]
|
||||
]
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ export class Blueprint {
|
|||
}
|
||||
return explanation;
|
||||
}
|
||||
|
||||
_getPlacementString(placement) {
|
||||
var placement_string = "[\n";
|
||||
for (let row of placement) {
|
||||
|
@ -67,7 +66,6 @@ export class Blueprint {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
export class Task {
|
||||
constructor(agent, task_path, task_id) {
|
||||
this.agent = agent;
|
||||
|
@ -78,11 +76,25 @@ export class Task {
|
|||
this.blocked_actions = [];
|
||||
if (task_path && task_id) {
|
||||
this.data = this.loadTask(task_path, task_id);
|
||||
this.task_type = this.data.type;
|
||||
console.log('Task type:', this.task_type);
|
||||
if (this.task_type === 'construction' && this.data.blueprint) {
|
||||
//add the blueprint to the goal if it is a construction task
|
||||
//todo: fix this for multi-agent scenarios with partial blueprints
|
||||
this.blueprint = new Blueprint(this.data.blueprint);
|
||||
console.log('Blueprint:', this.blueprint.explain());
|
||||
this.goal = this.data.goal + ' \n' + this.blueprint.explain();
|
||||
console.log('Goal:', this.goal);
|
||||
} else {
|
||||
this.goal = this.data.goal;
|
||||
console.log('Goal:', this.goal);
|
||||
}
|
||||
|
||||
this.taskTimeout = this.data.timeout || 300;
|
||||
this.taskStartTime = Date.now();
|
||||
this.validator = new TaskValidator(this.data, this.agent);
|
||||
this.blocked_actions = this.data.blocked_actions || [];
|
||||
if (this.data.goal)
|
||||
if (this.goal)
|
||||
this.blocked_actions.push('!endGoal');
|
||||
if (this.data.conversation)
|
||||
this.blocked_actions.push('!endConversation');
|
||||
|
@ -214,8 +226,9 @@ export class Task {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.data.goal) {
|
||||
await executeCommand(this.agent, `!goal("${this.data.goal}")`);
|
||||
if (this.goal) {
|
||||
console.log('Setting goal:', this.goal);
|
||||
await executeCommand(this.agent, `!goal("${this.goal}")`);
|
||||
}
|
||||
|
||||
if (this.data.conversation && this.agent.count_id === 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue