mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-06-08 10:15:55 +02:00
Merge 2dd0694042
into f2f06fcf3f
This commit is contained in:
commit
790ec02dc9
1 changed files with 480 additions and 435 deletions
|
@ -96,6 +96,9 @@ export const actionsList = [
|
|||
'closeness': { type: 'float', description: 'How close to get to the player.', domain: [0, Infinity] }
|
||||
},
|
||||
perform: runAsAction(async (agent, player_name, closeness) => {
|
||||
if (agent.bot.entity.vehicle) {
|
||||
await agent.bot.dismount(); // Dismount from the vehicle if it's currently mounted as the bot can't control it
|
||||
}
|
||||
await skills.goToPlayer(agent.bot, player_name, closeness);
|
||||
})
|
||||
},
|
||||
|
@ -107,6 +110,9 @@ export const actionsList = [
|
|||
'follow_dist': { type: 'float', description: 'The distance to follow from.', domain: [0, Infinity] }
|
||||
},
|
||||
perform: runAsAction(async (agent, player_name, follow_dist) => {
|
||||
if (agent.bot.entity.vehicle) {
|
||||
await agent.bot.dismount(); // Dismount from the vehicle if it's currently mounted as the bot can't control it
|
||||
}
|
||||
await skills.followPlayer(agent.bot, player_name, follow_dist);
|
||||
}, true)
|
||||
},
|
||||
|
@ -120,6 +126,9 @@ export const actionsList = [
|
|||
'closeness': { type: 'float', description: 'How close to get to the location.', domain: [0, Infinity] }
|
||||
},
|
||||
perform: runAsAction(async (agent, x, y, z, closeness) => {
|
||||
if (agent.bot.entity.vehicle) {
|
||||
await agent.bot.dismount(); // Dismount from the vehicle if it's currently mounted as the bot can't control it
|
||||
}
|
||||
await skills.goToPosition(agent.bot, x, y, z, closeness);
|
||||
})
|
||||
},
|
||||
|
@ -339,6 +348,42 @@ export const actionsList = [
|
|||
await skills.activateNearestBlock(agent.bot, type);
|
||||
})
|
||||
},
|
||||
{
|
||||
name: '!ride',
|
||||
description: 'Ride the nearest entity of a given type.',
|
||||
params: {
|
||||
'entity_type': { type: 'string', description: 'The type of entity to ride.' }
|
||||
},
|
||||
perform: runAsAction(async (agent, entity_type) => {
|
||||
const entity = agent.bot.entities[Object.keys(agent.bot.entities).find(uuid => agent.bot.entities[uuid].name === entity_type)];
|
||||
if (!entity) {
|
||||
skills.log(agent.bot, `Could not find entity of type ${entity_type}.`);
|
||||
return `Could not find entity of type ${entity_type}.`;
|
||||
}
|
||||
// Walk to the entity coordinates
|
||||
await skills.goToPosition(agent.bot, entity.position.x, entity.position.y, entity.position.z, 3);
|
||||
try {
|
||||
// Bug with sneaking? Force control state.
|
||||
await agent.bot.setControlState('sneak', false)
|
||||
// Mount the entity
|
||||
await agent.bot.mount(entity);
|
||||
skills.log(agent.bot, `Riding entity of type ${entity_type}.`);
|
||||
return `Riding entity of type ${entity_type}.`;
|
||||
} catch (error) {
|
||||
skills.log(agent.bot, `Failed to ride entity of type ${entity_type}: ${error.message}`);
|
||||
return `Failed to ride entity of type ${entity_type}.`;
|
||||
}
|
||||
})
|
||||
},
|
||||
{
|
||||
name: '!dismount',
|
||||
description: 'Dismount the currently ridden entity.',
|
||||
params: {},
|
||||
perform: runAsAction(async (agent) => {
|
||||
await agent.bot.dismount();
|
||||
return 'Dismounted entity.';
|
||||
})
|
||||
},
|
||||
{
|
||||
name: '!stay',
|
||||
description: 'Stay in the current location no matter what. Pauses all modes.',
|
||||
|
|
Loading…
Add table
Reference in a new issue