From deade1aef71eba51df86703a8913d351d329f2d0 Mon Sep 17 00:00:00 2001 From: Kolby Nottingham Date: Wed, 24 Apr 2024 13:36:26 -0700 Subject: [PATCH] set goal option --- andy_npc.json | 2 ++ src/agent/npc/controller.js | 2 +- src/agent/npc/data.js | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/andy_npc.json b/andy_npc.json index 0fad11c..4a13ea7 100644 --- a/andy_npc.json +++ b/andy_npc.json @@ -12,6 +12,8 @@ "goal_setting": "You are a Minecraft bot named $NAME that has the ability to set in-game goals that are then executed programatically. Goals must be either and item or block name or a blueprint of a specific building. Any minecraft item or block name is valid. However, only names from the following list are valid blueprints: $BLUEPRINTS. Given any recent conversation and the most recently attempted goals, set a new goal to achieve. Fromat your response as a json object with the fields \"name\" and \"quantity\". Note that the quantity for a blueprint should always be one. Example:\n```json\n{\"name\": \"iron_pickaxe\", \"quantity\": 1}```", "npc": { + "do_routine": true, + "do_set_goal": true, "goals": [ "wooden_pickaxe", "hole", diff --git a/src/agent/npc/controller.js b/src/agent/npc/controller.js index cbd234f..bb650ea 100644 --- a/src/agent/npc/controller.js +++ b/src/agent/npc/controller.js @@ -196,7 +196,7 @@ export class NPCContoller { } } - if (!acted) + if (!acted && this.data.do_set_goal) await this.setGoal(); } diff --git a/src/agent/npc/data.js b/src/agent/npc/data.js index f6b382f..b590d15 100644 --- a/src/agent/npc/data.js +++ b/src/agent/npc/data.js @@ -5,6 +5,7 @@ export class NPCData { this.built = {}; this.home = null; this.do_routine = true; + this.do_set_goal = true; } toObject() { @@ -18,6 +19,7 @@ export class NPCData { if (this.home) obj.home = this.home; obj.do_routine = this.do_routine; + obj.do_set_goal = this.do_set_goal; return obj; } @@ -41,6 +43,8 @@ export class NPCData { npc.home = obj.home; if (obj.do_routine !== undefined) npc.do_routine = obj.do_routine; + if (obj.do_set_goal !== undefined) + npc.do_set_goal = obj.do_set_goal; return npc; } } \ No newline at end of file