mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-04 06:15:32 +02:00
commit
0a21561dcb
2 changed files with 9 additions and 2 deletions
|
@ -273,7 +273,14 @@ export class Agent {
|
|||
this.bot.on('messagestr', async (message, _, jsonMsg) => {
|
||||
if (jsonMsg.translate && jsonMsg.translate.startsWith('death') && message.startsWith(this.name)) {
|
||||
console.log('Agent died: ', message);
|
||||
this.handleMessage('system', `You died with the final message: '${message}'. Previous actions were stopped and you have respawned. Notify the user and perform any necessary actions.`);
|
||||
let death_pos = this.bot.entity.position;
|
||||
this.memory_bank.rememberPlace('last_death_position', death_pos.x, death_pos.y, death_pos.z);
|
||||
let death_pos_text = null;
|
||||
if (death_pos) {
|
||||
death_pos_text = `x: ${death_pos.x.toFixed(2)}, y: ${death_pos.y.toFixed(2)}, z: ${death_pos.x.toFixed(2)}`;
|
||||
}
|
||||
let dimention = this.bot.game.dimension;
|
||||
this.handleMessage('system', `You died at position ${death_pos_text || "unknown"} in the ${dimention} dimension with the final message: '${message}'. Your place of death is saved as 'last_death_position' if you want to return. Previous actions were stopped and you have respawned.`);
|
||||
}
|
||||
});
|
||||
this.bot.on('idle', () => {
|
||||
|
|
|
@ -120,7 +120,7 @@ const modes = [
|
|||
update: async function (agent) {
|
||||
const enemy = world.getNearestEntityWhere(agent.bot, entity => mc.isHostile(entity), 16);
|
||||
if (enemy && await world.isClearPath(agent.bot, enemy)) {
|
||||
say(agent, `Aaa! A ${enemy.name}!`);
|
||||
say(agent, `Aaa! A ${enemy.name.replace("_", " ")}!`);
|
||||
execute(this, agent, async () => {
|
||||
await skills.avoidEnemies(agent.bot, 24);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue