Merge branch 'main' into procedural_generation_save

This commit is contained in:
Isadora White 2025-03-04 11:10:42 -08:00 committed by GitHub
commit 2bdaf6e232
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 58 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "andy", "name": "andy",
"model": "gpt-4o", "model": "gpt-4o-mini",
"conversation_examples": [ "conversation_examples": [
[ [

View file

@ -1,7 +1,6 @@
{ {
"name": "jill", "name": "jill",
"model": "gpt-4o-mini",
"model": "gpt-4o",
"conversation_examples": [ "conversation_examples": [
[ [

View file

@ -668,7 +668,6 @@ export class Agent {
this.history.save(); this.history.save();
process.exit(code); process.exit(code);
} }
async checkTaskDone() { async checkTaskDone() {
if (this.task.data) { if (this.task.data) {
let res = this.task.isDone(); let res = this.task.isDone();

View file

@ -332,6 +332,8 @@ export class CookingTaskInitiator {
['minecraft:cooked_mutton', 64], ['minecraft:cooked_mutton', 64],
['minecraft:cooked_salmon', 64], ['minecraft:cooked_salmon', 64],
['minecraft:cooked_cod', 64] ['minecraft:cooked_cod', 64]
['minecraft:gold_ingot', 64],
['minecraft:oak_planks', 64],
]; ];
// Fill the chest with random cooking items // Fill the chest with random cooking items

View file

@ -26,6 +26,7 @@ function checkItemPresence(data, agent) {
function isTargetDictionaryWithQuantities(target) { function isTargetDictionaryWithQuantities(target) {
return typeof target === 'object' && return typeof target === 'object' &&
!Array.isArray(target) && !Array.isArray(target) &&
target !== null && target !== null &&
Object.values(target).every(value => typeof value === 'number'); Object.values(target).every(value => typeof value === 'number');
} }
@ -94,7 +95,6 @@ function checkItemPresence(data, agent) {
for (const [item, requiredCount] of Object.entries(requiredQuantities)) { for (const [item, requiredCount] of Object.entries(requiredQuantities)) {
const itemName = item.toLowerCase(); const itemName = item.toLowerCase();
const currentCount = inventoryCount[itemName] || 0; const currentCount = inventoryCount[itemName] || 0;
if (currentCount < requiredCount) { if (currentCount < requiredCount) {
allTargetsMet = false; allTargetsMet = false;
missingItems.push({ missingItems.push({
@ -158,16 +158,17 @@ export class Task {
} }
this.taskTimeout = this.data.timeout || 300; this.taskTimeout = this.data.timeout || 300;
this.taskStartTime = Date.now(); this.taskStartTime = Date.now();
// Set validator based on task_type
if (this.task_type === 'construction') { if (this.task_type === 'construction') {
this.validator = new ConstructionTaskValidator(this.data, this.agent); this.validator = new ConstructionTaskValidator(this.data, this.agent);
} else if (this.task_type === 'cooking' || this.task_type === 'techtree') { } else if (this.task_type === 'cooking' || this.task_type === 'techtree') {
this.validator = new CookingCraftingTaskValidator(this.data, this.agent); this.validator = new CookingCraftingTaskValidator(this.data, this.agent);
} else { } else {
this.validator = null; this.validator = null;
} }
if (this.data.blocked_actions) { if (this.data.blocked_actions) {
this.blocked_actions = this.data.blocked_actions[this.agent.count_id.toString()] || []; this.blocked_actions = this.data.blocked_actions[this.agent.count_id.toString()] || [];
} else { } else {
@ -272,7 +273,6 @@ export class Task {
} else { } else {
this.initiator = null; this.initiator = null;
} }
await this.teleportBots(); await this.teleportBots();
//wait for a bit so bots are teleported //wait for a bit so bots are teleported
@ -362,7 +362,6 @@ export class Task {
console.log(`Teleporting ${this.name} to human ${human_player_name}`) console.log(`Teleporting ${this.name} to human ${human_player_name}`)
bot.chat(`/tp ${this.name} ${human_player_name}`) bot.chat(`/tp ${this.name} ${human_player_name}`)
} }
await new Promise((resolve) => setTimeout(resolve, 200)); await new Promise((resolve) => setTimeout(resolve, 200));
// now all bots are teleport on top of each other (which kinda looks ugly) // now all bots are teleport on top of each other (which kinda looks ugly)
@ -376,7 +375,6 @@ export class Task {
*/ */
if (this.data.type !== 'construction') { if (this.data.type !== 'construction') {
const pos = getPosition(bot); const pos = getPosition(bot);
const xOffset = getRandomOffset(5); const xOffset = getRandomOffset(5);
@ -394,7 +392,6 @@ export class Task {
} }
} }
if (this.data.type === 'construction'){ if (this.data.type === 'construction'){
//Ensures construction is cleaned out first. -> relies on cheats which are turned off? //Ensures construction is cleaned out first. -> relies on cheats which are turned off?
if (this.blueprint){ if (this.blueprint){
@ -412,46 +409,3 @@ export class Task {
} }
} }
} }
export function giveBlueprint(agent, blueprint) {
let bot = agent.bot;
let name = agent.name;
let blueprint_name = blueprint.name;
let blueprint_count = blueprint.count;
bot.chat(`/clear ${name}`);
console.log(`Cleared ${name}'s inventory.`);
bot.chat(`/give ${name} ${blueprint_name} ${blueprint_count}`);
console.log(`Gave ${name} ${blueprint_count} ${blueprint_name}(s).`);
}
/**
* Auto-builds blueprint in minecraft world
* @param agent
* @param blueprint must be of the blueprint class
*/
export function buildBlueprint(agent, blueprint){
let bot = agent.bot
const result = blueprint.autoBuild();
// const result = clearHouse(blueprint)
const commands = result.commands;
const nearbyPosition = result.nearbyPosition;
for (const command of commands) {
bot.chat(command);
}
}
/**
* auto-deletes a built blueprint
* @param agent
* @param blueprint must be of the blueprint class
*/
export function deleteBlueprint(agent, blueprint){
let bot = agent.bot
const result = blueprint.autoDelete()
const commands = result.commands;
const nearbyPosition = result.nearbyPosition;
for (const command of commands) {
bot.chat(command);
}
}