feat(mover): add basic movement commands

Forward, left, etc. Uses bot.controlState.
But left and right does the opposite of expectations.
This commit is contained in:
jay 2021-01-18 15:13:53 +05:00
parent 1d361e04a6
commit 974d460061

View File

@ -194,12 +194,40 @@ function command(message_parts, player) {
break
}
break
case "w":
case "f":
command(["forward"].concat(message_parts.slice(1)))
break
case "s":
case "b":
command(["back"].concat(message_parts.slice(1)))
break
case "a":
case "l":
command(["right"].concat(message_parts.slice(1)))
break
case "d":
case "r":
command(["left"].concat(message_parts.slice(1)))
break
case "back":
case "forward":
case "jump":
case "left":
case "right":
case "sneak":
case "sprint":
console.info(bot.controlState[message_parts[0]], bot.entity.position.floored())
bot.setControlState(message_parts[0], true)
console.info(bot.controlState[message_parts[0]])
setTimeout(bot.setControlState, 200 * (message_parts[1] || 1), message_parts[0], false)
setTimeout(console.info, 5000, bot.controlState[message_parts[0]], bot.entity.position.floored())
break
case "stop":
stop()
break
default:
return cfg.quiet || bot.chat(`unknown command ${message_parts[0]}`)
break;
}
}