mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-09-08 19:12:59 +02:00
added only_chat_with for users to listen/chat to
This commit is contained in:
parent
5278ecb72c
commit
2384b5bf5c
6 changed files with 12 additions and 12 deletions
|
@ -23,6 +23,7 @@ export default
|
|||
],
|
||||
"load_memory": false, // load memory from previous session
|
||||
"init_message": "Respond with hello world and your name", // sends to all on spawn
|
||||
"only_chat_with": [], // users that the bots listen to and send general messages to. if empty it will chat publicly
|
||||
|
||||
"language": "en", // translate to/from this language. Supports these language names: https://cloud.google.com/translate/docs/languages
|
||||
"show_bot_views": false, // show bot's view in browser at localhost:3000, 3001...
|
||||
|
@ -36,4 +37,3 @@ export default
|
|||
"narrate_behavior": true, // chat simple automatic actions ('Picking up item!')
|
||||
"chat_bot_messages": true, // publicly chat messages to other bots
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ export const actionsList = [
|
|||
name: '!stfu',
|
||||
description: 'Stop all chatting and self prompting, but continue current action.',
|
||||
perform: async function (agent) {
|
||||
agent.bot.chat('Shutting up.');
|
||||
agent.openChat('Shutting up.');
|
||||
agent.shutUp();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import settings from '../../settings.js';
|
||||
import { readFileSync } from 'fs';
|
||||
import { containsCommand } from './commands/index.js';
|
||||
import { sendBotChatToServer } from './server_proxy.js';
|
||||
import { sendBotChatToServer } from './agent_proxy.js';
|
||||
|
||||
let agent;
|
||||
let agent_names = settings.profiles.map((p) => JSON.parse(readFileSync(p, 'utf8')).name);
|
||||
|
@ -12,8 +12,8 @@ export function isOtherAgent(name) {
|
|||
return agent_names.some((n) => n === name);
|
||||
}
|
||||
|
||||
export function updateAgents(names) {
|
||||
agent_names = names;
|
||||
export function updateAgents(agents) {
|
||||
agent_names = agents.map(a => a.name);
|
||||
}
|
||||
|
||||
export function initConversationManager(a) {
|
||||
|
@ -98,7 +98,7 @@ export async function startConversation(send_to, message) {
|
|||
|
||||
export function sendToBot(send_to, message, start=false) {
|
||||
if (settings.chat_bot_messages)
|
||||
agent.bot.chat(`(To ${send_to}) ${message}`);
|
||||
agent.openChat(`(To ${send_to}) ${message}`);
|
||||
if (!isOtherAgent(send_to)) {
|
||||
agent.bot.whisper(send_to, message);
|
||||
return;
|
||||
|
|
|
@ -4,10 +4,8 @@ import pf from 'mineflayer-pathfinder';
|
|||
import Vec3 from 'vec3';
|
||||
|
||||
|
||||
export function log(bot, message, chat=false) {
|
||||
export function log(bot, message) {
|
||||
bot.output += message + '\n';
|
||||
if (chat)
|
||||
bot.chat(message);
|
||||
}
|
||||
|
||||
async function autoLight(bot) {
|
||||
|
@ -585,7 +583,9 @@ export async function placeBlock(bot, blockType, x, y, z, placeOn='bottom', dont
|
|||
if (blockType === 'ladder' || blockType === 'repeater' || blockType === 'comparator') {
|
||||
blockType += `[facing=${face}]`;
|
||||
}
|
||||
|
||||
if (blockType.includes('stairs')) {
|
||||
blockType += `[facing=${face}]`;
|
||||
}
|
||||
let msg = '/setblock ' + Math.floor(x) + ' ' + Math.floor(y) + ' ' + Math.floor(z) + ' ' + blockType;
|
||||
bot.chat(msg);
|
||||
if (blockType.includes('door'))
|
||||
|
|
|
@ -9,7 +9,7 @@ async function say(agent, message) {
|
|||
agent.bot.modes.behavior_log += message + '\n';
|
||||
if (agent.shut_up || !settings.narrate_behavior) return;
|
||||
let translation = await handleTranslation(message);
|
||||
agent.bot.chat(translation);
|
||||
agent.openChat(translation);
|
||||
}
|
||||
|
||||
// a mode is a function that is called every tick to respond immediately to the world
|
||||
|
|
|
@ -45,7 +45,7 @@ export class SelfPrompter {
|
|||
no_command_count++;
|
||||
if (no_command_count >= MAX_NO_COMMAND) {
|
||||
let out = `Agent did not use command in the last ${MAX_NO_COMMAND} auto-prompts. Stopping auto-prompting.`;
|
||||
this.agent.bot.chat(out);
|
||||
this.agent.openChat(out);
|
||||
console.warn(out);
|
||||
this.on = false;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue