fixing construction tasks

This commit is contained in:
Isadora White 2025-03-22 17:13:14 -05:00
parent 57af4f13cc
commit 93db8b664c
5 changed files with 18 additions and 14 deletions

View file

@ -37,7 +37,7 @@ BLOCKED_ACTIONS_CONSTRUCTION = [
'!equip', '!followPlayer', '!getBlueprint', '!getBlueprintLevel', '!goToBed', '!equip', '!followPlayer', '!getBlueprint', '!getBlueprintLevel', '!goToBed',
'!help', '!modes', '!moveAway', '!newAction', '!placeHere', '!putInChest', '!help', '!modes', '!moveAway', '!newAction', '!placeHere', '!putInChest',
'!restart', '!searchForBlock', '!searchForEntity', '!setMode', '!stay', '!stfu', '!restart', '!searchForBlock', '!searchForEntity', '!setMode', '!stay', '!stfu',
'!stop', '!takeFromChest', '!viewChest' '!stop', '!takeFromChest', '!viewChest', '!craftRecipe', '!smeltItem'
] ]
def analyze_json_file(file_path): def analyze_json_file(file_path):

View file

@ -20,16 +20,16 @@
{"role": "assistant", "content": "Great the last level is complete, let's check the whole blueprint just to be sure. !checkBlueprint"} {"role": "assistant", "content": "Great the last level is complete, let's check the whole blueprint just to be sure. !checkBlueprint"}
], ],
[ [
{"role": "assistant", "content": "I've got stone. What about you?"}, {"role": "user", "content": "andy: (FROM OTHER BOT) I've got stone. What about you?"},
{"role": "assistant", "content": "I have a door and planks. Great we have everything we need from the blueprint. Let's start building the first level! !checkBlueprintLevel(0)"}, {"role": "assistant", "content": "I have a door and planks. Great we have everything we need from the blueprint. Let's start building the first level! !checkBlueprintLevel(0)"},
{"role": "system", "content": "Level 0 requires the following fixes:\n Place stone at X:100, y: -60, Z:-179\n Place stone at X: 99, Y: -60, Z:-179\n Place stone at X: 98, Y:-60, Z:-179..."}, {"role": "system", "content": "Level 0 requires the following fixes:\n Place stone at X:100, y: -60, Z:-179\n Place stone at X: 99, Y: -60, Z:-179\n Place stone at X: 98, Y:-60, Z:-179..."},
{"role": "assistant", "content": "Looks like the first level requires only stone, why don't you build that since you have stone?"}, {"role": "assistant", "content": "Looks like the first level requires only stone, why don't you build that since you have stone?"},
{"role": "assistant", "content": "Ok, let me see what needs to be done for level 0. !checkBlueprintLevel(0) "}, {"role": "user", "content": "andy: (FROM OTHER BOT) Ok, let me see what needs to be done for level 0. !checkBlueprintLevel(0) "},
{"role": "system", "content": "Level 0 requires the following fixes:\n Place stone at X:100, y: -60, Z:-179\n Place stone at X: 99, Y: -60, Z:-179\n Place stone at X: 98, Y:-60, Z:-179..."}, {"role": "system", "content": "Level 0 requires the following fixes:\n Place stone at X:100, y: -60, Z:-179\n Place stone at X: 99, Y: -60, Z:-179\n Place stone at X: 98, Y:-60, Z:-179..."},
{"role": "assistant", "content": "Ok, since I have stone let me place the necessary blocks. !newAction(\"Place stone for level 0\")"}, {"role": "user", "content": "andy: (FROM OTHER BOT) Ok, since I have stone let me place the necessary blocks. !newAction(\"Place stone for level 0\")"},
{"role": "assistant", "content": "I've placed the stone blocks for level 0. Let's check if it is done! !checkBlueprintLevel(0)"}, {"role": "user", "content": "andy: (FROM OTHER BOT) I've placed the stone blocks for level 0. Let's check if it is done! !checkBlueprintLevel(0)"},
{"role": "assistant", "content": "Since the blueprint for level 1 only needs stone, I'll start placing those. !newAction(\"Place stone blocks for level 1.\")"}, {"role": "user", "content": "andy: (FROM OTHER BOT) Since the blueprint for level 1 only needs stone, I'll start placing those. !newAction(\"Place stone blocks for level 1.\")"},
{"role": "assistant", "content": "jill: I'll place the planks for level 2. !newAction(\"Place planks for level 2.\")"} {"role": "assistant", "content": " I'll place the planks for level 2. !newAction(\"Place planks for level 2.\")"}
] ]
] ]
} }

View file

@ -278,12 +278,12 @@ export class Blueprint {
const placement = level.placement; const placement = level.placement;
// Update bounds // Update bounds
minX = Math.min(minX, baseX); minX = Math.min(minX, baseX) - 15;
maxX = Math.max(maxX, baseX + placement[0].length - 1); maxX = Math.max(maxX, baseX + placement[0].length - 1) + 15;
minY = Math.min(minY, baseY); minY = Math.min(minY, baseY);
maxY = Math.max(maxY, baseY); maxY = Math.max(maxY, baseY);
minZ = Math.min(minZ, baseZ); minZ = Math.min(minZ, baseZ) - 15;
maxZ = Math.max(maxZ, baseZ + placement.length - 1); maxZ = Math.max(maxZ, baseZ + placement.length - 1) + 15;
// Loop through the 2D placement array // Loop through the 2D placement array
for (let z = 0; z < placement.length; z++) { for (let z = 0; z < placement.length; z++) {
@ -299,9 +299,9 @@ export class Blueprint {
// Calculate a position nearby the blueprint but not in it // Calculate a position nearby the blueprint but not in it
const nearbyPosition = { const nearbyPosition = {
x: maxX + 5, // Move 5 blocks to the right x: Math.floor((maxX + minX)/2), // Move 5 blocks to the right
y: minY, // Stay on the lowest level of the blueprint y: minY, // Stay on the lowest level of the blueprint
z: minZ // Stay aligned with the front of the blueprint z: Math.floor((maxZ + minZ)/2) // Stay aligned with the front of the blueprint
}; };
return { commands, nearbyPosition }; return { commands, nearbyPosition };

View file

@ -422,7 +422,7 @@ export class Task {
const commands = result.commands; const commands = result.commands;
const nearbyPosition = result.nearbyPosition; const nearbyPosition = result.nearbyPosition;
console.log("nearby position", nearbyPosition); console.log("nearby position", nearbyPosition);
bot.chat(`/tp ${this.name} ${nearbyPosition.x} ${nearbyPosition.y} ${nearbyPosition.z}`); bot.chat(`/tp @a ${nearbyPosition.x} ${nearbyPosition.y} ${nearbyPosition.z}`);
for (const command of commands) { for (const command of commands) {
bot.chat(command); bot.chat(command);
} }

View file

@ -69,6 +69,10 @@ function createInitialInventory(blueprint, agents, evenlySplit = true) {
} }
} }
for (let i = 0; i < agents; i++) {
inventories[i]['dirt'] = 128;
}
return inventories; return inventories;
} }