fix(v0.3.1): mechanical food/stuck fixes — bot reaches the chicken now
The wedge wasn't only in the manifesto layer; several mechanical bugs kept the bot in a dead random-walk: - storyline / manifesto / curriculum: "local food" now means an edible passive mob within <=32 blocks. A distant chicken or a cod no longer fools the bot into dispatching acquire-food (which then fails on no_path). Long-range food goes through scout-food instead. - scout-food: partial approach to a target now counts as progress (approached_target, e.g. moved:14); a blocked heading is NOT counted as movement; added blind/tunnel fallback so it doesn't die when the pathfinder can't route cleanly. - acquire-food: on no_path it now also tries a blind/tunnel approach to the animal; no_drop routes back into food scouting instead of giving up. - explore.far / relocate / flee: fewer false "done" results (micro-steps no longer counted as success), more genuine escapes from stuck. - scripts/show-story.js: live IPC now actually renders the current storyline step. Verification: scripts/lint-patch.js clean; npm test 404/404 green; bot relaunched in tmux `pepa`. Live logs show real progress — bot switched to survive.scout-food, approached the chicken (approached_target moved:14), then reached survive.acquire-food: hunting chicken. Food isn't fully closed yet but the remaining issue is concrete pickup/drop, not dead random-walk. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -72,6 +72,7 @@ function hasAny(inv, names) {
|
||||
|
||||
const WOODEN_TOOLS = ["wooden_axe", "wooden_pickaxe", "wooden_sword"];
|
||||
const STONE_TOOLS = ["stone_axe", "stone_pickaxe", "stone_sword"];
|
||||
const PASSIVE_FOOD_MOBS = new Set(["cow", "pig", "chicken", "sheep", "rabbit", "mooshroom"]);
|
||||
|
||||
// A "stage reached" predicate: once the bot has wooden tools, wood.16 is
|
||||
// implicitly considered done even if the log stack is now empty (the bot
|
||||
@@ -86,6 +87,12 @@ function hasStoneTier(inv) {
|
||||
return STONE_TOOLS.some((n) => has(inv, n));
|
||||
}
|
||||
|
||||
function hasVisibleFoodTarget(snap) {
|
||||
const passives = snap?.nearbyEntities?.passives ?? [];
|
||||
if (passives.some((e) => PASSIVE_FOOD_MOBS.has(e.name))) return true;
|
||||
return (snap?.nearbyEntities?.droppedItems?.length ?? 0) > 0;
|
||||
}
|
||||
|
||||
const MILESTONES = [
|
||||
{
|
||||
id: "wood.16",
|
||||
@@ -157,7 +164,9 @@ const MILESTONES = [
|
||||
);
|
||||
return carrying || (snap?.food ?? 20) >= 18;
|
||||
},
|
||||
suggest: () => ({ skillId: "survive.acquire-food" }),
|
||||
suggest: (_inv, snap) => ({
|
||||
skillId: hasVisibleFoodTarget(snap) ? "survive.acquire-food" : "survive.scout-food",
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: "storage.chest",
|
||||
|
||||
Reference in New Issue
Block a user