Compare commits
4 Commits
f50e388c39
...
afd2e002df
Author | SHA1 | Date | |
---|---|---|---|
|
afd2e002df | ||
|
3c5ec6b360 | ||
|
b71728e503 | ||
|
d001280383 |
|
@ -47,7 +47,9 @@ function unloadplugin(pluginname, pluginpath) {
|
||||||
const plugin = require.resolve(pluginpath)
|
const plugin = require.resolve(pluginpath)
|
||||||
try {
|
try {
|
||||||
if (plugin && require.cache[plugin]) {
|
if (plugin && require.cache[plugin]) {
|
||||||
require.cache[plugin].exports.unload()
|
// `unload()` isn't exported sometimes,
|
||||||
|
// when plugin isn't properly loaded
|
||||||
|
require.cache[plugin].exports?.unload?.()
|
||||||
delete plugins[pluginname]
|
delete plugins[pluginname]
|
||||||
delete require.cache[plugin]
|
delete require.cache[plugin]
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,19 @@ function initMoves(bot = bot, mcData = bot.mcData) {
|
||||||
movements.push(normalMove)
|
movements.push(normalMove)
|
||||||
movements.defaultMove = movements[0]
|
movements.defaultMove = movements[0]
|
||||||
|
|
||||||
|
const aggresiveMove = new Movements(bot, mcData)
|
||||||
|
//Object.create or assign?
|
||||||
|
Object.assign(aggresiveMove, normalMove)
|
||||||
|
aggresiveMove.canDig = true
|
||||||
|
movements.push(aggresiveMove)
|
||||||
|
|
||||||
|
const safeMove = new Movements(bot, mcData)
|
||||||
|
Object.assign(safeMove, normalMove)
|
||||||
|
safeMove.allowParkour = false
|
||||||
|
safeMove.canDig = false
|
||||||
|
movements.push(safeMove)
|
||||||
|
// console.info("go init: moves:", movements)
|
||||||
|
|
||||||
bot.pathfinder.setMovements(normalMove)
|
bot.pathfinder.setMovements(normalMove)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +156,7 @@ function away(entity = bot.nearestEntity(), invertInvert = true, dynamic = true,
|
||||||
|
|
||||||
function ride(entity) {
|
function ride(entity) {
|
||||||
entity = entity?.entity || entity
|
entity = entity?.entity || entity
|
||||||
const ridableMobs = ["Horse", "Donkey", "Pig", "Strider"]
|
const ridableMobs = ["Horse", "Donkey", "Pig", "Strider", "Mule"]
|
||||||
const vehicle = entity && typeof entity !== "string" ? entity : bot.nearestEntity(e => {
|
const vehicle = entity && typeof entity !== "string" ? entity : bot.nearestEntity(e => {
|
||||||
if (typeof entity === "string") return e.name === entity
|
if (typeof entity === "string") return e.name === entity
|
||||||
const maybeRidableMob = e.mobType?.split(" ")
|
const maybeRidableMob = e.mobType?.split(" ")
|
||||||
|
@ -314,7 +327,7 @@ function command(message_parts, player) {
|
||||||
case "up":
|
case "up":
|
||||||
case "u":
|
case "u":
|
||||||
case "j":
|
case "j":
|
||||||
moveOrRide(1, 1, "left", message_parts2)
|
moveOrRide(1, 1, "jump", message_parts2)
|
||||||
break
|
break
|
||||||
case "back":
|
case "back":
|
||||||
case "forward":
|
case "forward":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user