Commit Graph
100 Commits
Author SHA1 Message Date
jay 984c9490c3 fix(informer): 🥅 make player undefined if nul
This allows to fallback to defaults in functions
2021-05-11 17:34:25 +05:00
jay 3379f75ab9 feat(informer): 🚸 make entity search case insensitive 2021-05-11 17:32:38 +05:00
jay 69b1ab0b0b feat(informer): add reverse mcdata lookup by block or item id 2021-05-11 14:44:22 +05:00
jay 3c9d62441f feat(informer): add block info based on player's relative position
Relative position includes simple words like "feet", "standing", "head", etc
2021-05-11 10:39:53 +05:00
jay 665102e19c fix(informer): 🚑 remove extra let cfg declaration left over from refactor 2021-05-11 09:46:07 +05:00
jay db459f52e6 fix(informer): ✏️ fix typo in isVec3 check function 2021-05-11 09:32:54 +05:00
jay 360eeff02f feat(informer): add item info based on player
Change the parameter order of `item` function to accomodate this
2021-05-11 07:32:05 +05:00
jay 25faac2f4c feat(informer): add command me for block info based on player position 2021-05-10 18:37:48 +05:00
jay ccf0c598e8 feat(informer): add block info based on player position or manually provided coords
This paves the way to get block info based on positions relative from the player
2021-05-07 16:27:44 +05:00
jay 050e2b3bd9 feat(informer): 🚸 add sub-command for module level quiet 2021-05-07 12:53:24 +05:00
jay e879d1f4ad refactor(informer): ♻️ reorder config loading 2021-05-07 12:40:17 +05:00
jay df193da779 feat(command): 🚧 add stub for bot._client events
Not sure how these are different:
- `bot._client.on("chat")`
- `bot.on("message(str)")`
2021-05-06 13:15:38 +05:00
jay 269d258763 feat(command): use a simpler text based system for receiving server commands 2021-05-06 13:11:31 +05:00
jay cbb105fe49 fix(command): 🚸 make bot address regex (prefix) more lenient
Should also accept server commands now on address
2021-05-03 07:20:33 +05:00
jay 356f83e39b fix(command): 👽 fix whisper event api change with an extra parameter
Whisper also now includes who it was whispered to
2021-05-03 07:14:45 +05:00
jay 5b3804893b feat(command): fix to show web (including extra [MODE]) messages
There's no way to remove `bot.addChatPattern`, so only does once on load
2021-04-29 08:37:46 +05:00
jay 9f6fea2423 feat(command): 🔊 add system (non-chat) messages to console log
This includes anything that doesn't return a `.text`.
Such as an `extra`, `translate` or other `json` formatted message.
Ex:
- afk
- errors
- player leave and joins
2021-04-29 08:24:51 +05:00
jay 3686bab167 fix: 🐛 fix plugin reload for multi-file/dir based plugins
Now, it also (un-)loads the whole plugin (sub and master).

This appears to be the most stable option.
Loading behaviour is unchanged from before (load only top level plugin).
However as a precaution, loading tries to unload bad plugins on error.
This helps to not end up in a bad state during reload.
2021-04-29 08:14:40 +05:00
jay e0c477a46f feat: 🔨 make fs.watch recursive, so it reloadplugin works also on directories 2021-04-27 11:47:25 +05:00
jay 6046123074 build: ⬆️ update deps 2021-04-25 07:13:55 +05:00
jay ae1f7cf269 feat: 🔧 extract the hardcoded admin and mod list out into environment variables 2021-04-23 06:07:29 +05:00
jay afd2e002df feat(mover): add new pathfinder Movements
- safeMove without parkour
- aggresiveMove that digs
2021-04-19 13:34:22 +05:00
jay 3c5ec6b360 fix(mover): ✏️ fix !go up moving left instead 2021-04-19 13:31:36 +05:00
jay b71728e503 feat(mover): add Mule to ridable mobs 2021-04-19 13:25:04 +05:00
jay d001280383 fix: 🥅 fix a plugin loading error
While reloading, plugin cache may not be deleted.
This happens when a loaded plugin encounters an error during reload.
This causes a deadlock in the unloading code.

So make sure cache is always deleted:
- ignore when an `unload()` function doesn't exist
- delete cache even if there are no `exports`
2021-04-19 13:15:25 +05:00
jay f50e388c39 feat: 🔊 fix path in plugin reload log so that it actually works 2021-04-14 09:59:48 +05:00
jay 135ce6567b fix(mover): 🐛 attempt to fix move while riding vehicle
Try to give a larger range and more freedom to see if other values work.
Specifically, attempt turning.
No test on vehicles or mobs appear to behave consistently so far.
Tried: pigs, minecarts, horse.
2021-04-14 09:57:36 +05:00
jay e5803eee59 fix(mover): ✏️ fix missed variable during rename 2021-04-11 23:30:34 +05:00
jay 1b21fcb096 refactor(mover): ♻️ use a better name for default move 2021-04-07 07:02:40 +05:00
jay 4b3e58ceb3 fix(mover): 🐛 attempt to fix move while riding vehicle
This never worked previously.
Using one of `-1 0 1` instead of a larger number appears to work.
2021-04-07 06:42:11 +05:00
jay 8e854a0a2f refactor(mover): 🔊 improve debug logging code 2021-04-07 06:37:26 +05:00
jay c42a3a2304 feat(mover): add an action to move / run away from an entity or goal
based on `pathfinder` goal `GoalInvert`; behaves slightly strange
2021-04-07 06:26:16 +05:00
jay b453b7d6bd feat(mover): add shortcuts and aliases for the jump command 2021-04-05 18:16:13 +05:00
jay 6b79f1fc60 refactor(plugins): ♻️ change plugin load order 2021-04-05 17:47:06 +05:00
jay 6e1ef5aada refactor(statemachine): 🔇 remove debug
code
2021-04-05 17:43:48 +05:00
jay e2ae7e5ad2 fix(statemachine): ✏️ fix SM action function sending Lower instead of Upper case commands 2021-04-03 15:16:46 +05:00
jay 42138a421b fix(statemachine): 🥅 fix for lookatPlayer when no or invalid player
Fixes the case when player isn't nearby or entity is invalid due to teleport
2021-04-03 15:15:08 +05:00
jay aded1e4193 style: 🎨 fix crlf -> lf for real this time, using .gitattributes
Add a .gitattributes file to permanentyl fix crlf issues.

For explanantion:
https://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/#the-new-system
2021-03-24 15:07:45 +05:00
jay 60394e38eb refactor: ♻️ replace add with vec3.offset
This avoids having to import and creat a `new vec3.v()`
2021-03-24 00:40:54 +05:00
jay 22490f7ec1 fix(command): 🐛 fix bot address regex returning undefined
Waits till spawn to make sure `bot.username` is definitely initialized
2021-03-23 23:10:58 +05:00
jay 72c4622091 feat(informer): various improvements and fixes
Feat:
- Letter aliases for subcommands.
- Most recent command when no input.
- Start player relative info stub.

Fix:
- Player username not shown.
2021-03-23 15:14:13 +05:00
jay 0757776d8b feat(command): 🎨 make botaddress prefix and regex more flexible and configurable 2021-03-23 14:39:07 +05:00
jay a0ffaf1654 build(typescript): 🚨 add @types dep to satisfy typescript errors
Typescript linter had an error that `require` was undefined.
This happened after updating Nodejs from 14.15 to 14.16.
Not sure if this should be a global dep or local
2021-03-23 13:25:26 +05:00
jay 1597acca72 fix(eater): 🥅 catch async error on full food
Attempt to fix async error returned by `bot.consume`.
Fixed by wrapping in a `try{}` block and using `.catch`.
Still don't know why or how this works 🤷.
2021-03-22 17:32:56 +05:00
jay 1e82045221 build: ⬆️ update deps 2021-03-22 15:59:22 +05:00
jay 33c4fc0c77 ci: 🔧 add vscode conventional commits scopes 2021-03-22 14:51:02 +05:00
jay 33c4233223 feat(statemachine): 🚧 first draft of new xstate based statemachine implementation
Replaces the old statemachine.
Done so far:
- Basic command interface
- Machine saving and loading
- Sample dummy machine
2021-03-22 14:32:08 +05:00
jay 3f3ebbae10 build: ⬆️ update deps 2021-03-07 12:10:14 +05:00
jay fd0e1e1347 build(statemachine): add xstate for state machines 2021-01-30 23:08:20 +05:00
jay 2f88eedce9 fix(mover): lessen move duration for more precise control 2021-01-28 03:52:12 +05:00
jay a0893f2b29 feat(mover): allow riding specific entity by name 2021-01-28 02:50:08 +05:00
jay b1a592dbbd fix(mover): 🐛 workaround for vehicle not being removed in api on dismount
`bot.vehicle` isn't removed on dismount, so this done manually
2021-01-28 02:24:59 +05:00
jay f336e3d736 feat(mover): switch between moving and riding automatically for manual movement 2021-01-28 02:18:42 +05:00
jay d953bd4cf6 fix(mover): 🎨 fix quiet not being "followed" 2021-01-28 02:10:52 +05:00
jay fc43985337 fix(mover): 🐛 fix crash when no mobs nearby while searching for rides 2021-01-28 01:28:37 +05:00
jay 6b1157147d feat(mover): implement more featureful and robust ride command
Now does the following:
- finds entities (both vehicles and animals) which are suitable for riding.
- moves to get into range.

However:
- while in a vehicle, pathfinder doesn't appear to detec coords.
- `bot.moveVehicle` doesn't work, so bot doesn't move when riding
2021-01-28 00:48:45 +05:00
jay e6d29576e7 refactor(command): 🚚 move vehicle commands near other moves
Move the following:
- vehicle commands next to other movement related commands like `go`.
- move `ride` / `mount` command functionality into mover plugin
2021-01-26 22:49:23 +05:00
jay 974d460061 feat(mover): add basic movement commands
Forward, left, etc. Uses bot.controlState.
But left and right does the opposite of expectations.
2021-01-18 15:13:53 +05:00
jay 1d361e04a6 build: ⬆️ update deps 2021-01-18 01:54:05 +05:00
jay 7597620626 ci: 🔧 add vscode conventional commits scopes 2021-01-18 01:47:32 +05:00
jay e5faa6f022 feat(informer): add more detail to item info
Gives detail of traversing the item's nbt data
2021-01-18 01:24:47 +05:00
jay cc18ac5c2e refactor(mover): 🚚 move commands inside mover plugin itself
This reduces the code inside the command plugin.
Most of the logic was only relevant to moving anyway.
Command aliases like `come` and `follow` still remain in command plugin.
2021-01-17 23:59:39 +05:00
jay 7050a1621b fix(informer): 🐛 add missing name for entity info when entity is a player
Uses `username` when `entity.name` is missing; should check other cases
2021-01-17 18:32:05 +05:00
jay 7cbfa16476 feat(informer): add case for when sub command is passed a single param
Currently returns:
- Item at given slot number
- Entity that matches given name
2021-01-17 16:20:20 +05:00
jay 63849e0729 fix(informer): 🥅 catch and report when objects are missing 2021-01-17 16:16:41 +05:00
jay 4e7f8d59fd feat(informer): add more detailed block metadata info
Uses `block.getProperties()`. Thanks to a [comment][1]

[1]: https://github.com/PrismarineJS/mineflayer-pathfinder/pull/84/files#r541196424
2021-01-17 15:54:31 +05:00
jay 7b2b936f81 feat(mover): implement moveY (vertical move up or down)
Doesn't appear to be working properly, bot assumes XZ is goal reached
2021-01-17 13:56:18 +05:00
jay 8a39596b1d feat(informer): add info for block at given position 2021-01-17 13:02:05 +05:00
jay 2601b7cfb1 fix(informer): 🥅 fix crash for block info when no block or an empty block is found 2021-01-17 12:20:49 +05:00
jay 67932b2f6a fix(sleeper): 🥅 catch sleeping edge case errors
Happens when trying to sleep while previously unable to move.
Or maybe when trying to sleep during dawn.
2021-01-16 16:39:42 +05:00
jay 9a6e684b11 feat(informer): add info about nearest entities 2021-01-16 16:17:42 +05:00
jay 3488a94233 feat(informer): info about held item(s) 2021-01-16 14:51:49 +05:00
jay 4d21327086 fix(mover): 🚸 better messages 2021-01-16 13:57:21 +05:00
jay e74d796124 fix(command): 🐛 make follow command work again without params 2021-01-16 13:50:35 +05:00
jay 3d5ffe38cd feat(mover): inform when goal reached 2021-01-16 13:25:26 +05:00
jay b519913355 feat(mover): implement moving to X Z goal (without y) 2021-01-15 00:36:17 +05:00
jay b1dab1968c fix(command): ✏️ fix follow command not working 2021-01-05 11:34:49 +05:00
jay 3219ec6155 feat(informer): actually add a command for info plugin 2021-01-05 11:32:33 +05:00
jay f38ad8c819 fix(command): 🚧 fix and workaround bot look at this
Workaround being unable to look at what player is looking at.
Currently looks at what player is standing on.
2021-01-05 09:30:14 +05:00
jay 4b8a39d38c feat(informer): add optional metadata to block info display 2021-01-05 09:20:35 +05:00
jay 6b71de0356 refactor(informer): 🚚 proper name to block info function
Be more specific: `block` instead of `info`.
In anticipation of future functions in this module.
2021-01-05 08:52:38 +05:00
jay 96214ffe37 fix(informer): 🐛 use block.type instead of block.id
`block.id` is nonexistent when tested live
2021-01-05 08:32:30 +05:00
jay 034f8d331a fix(informer): 🐛 convert array to string for chat
`bot.chat` only supports strings
2021-01-05 08:18:21 +05:00
jay 69d0f5830d feat(mover): add close(er) command to follow / come closer 2021-01-05 08:11:11 +05:00
jay 8e719d5ccf feat(sleeper): add and adjust functionality to properly sleep
Can now use beds in inventory but with a hacky block placing workaround.
`findBlock` returns a null position.
So it uses the closest adjacent block and assumes it'll work.

Bot also is more robust at sleeping,
2020-12-27 05:50:16 +05:00
jay 112eb04a8d refactor(sleeper): ♻️ simplify and make sleeping code more robust 2020-12-27 01:58:17 +05:00
jay ba7c53be0c refactor(command): ♻️ make toss exit early if non-existent block 2020-12-27 00:30:46 +05:00
jay 5b4718fa5d fix(command): 🐛 add missing return 2020-12-25 07:29:06 +05:00
jay 902732c6dd chore: ⬆️ update deps 2020-12-25 07:20:05 +05:00
jay 65d13a3379 style: fix crlf -> lf 2020-12-25 07:17:54 +05:00
jay 288b7045b6 feat: add informer plugin to show info
Data and information plugin.
Expose methods in mcData with acceptable ux.
Also central place for all kinds of debug features.
2020-12-24 21:39:50 +05:00
jay 94574a4296 refactor: ♻️ reorder plugin loading
Load in order of simplicity and dependance.

TODO: Use `bot.waitForChunksToLoad`:
Split plugins based on whether it requires blocks to be loaded or no.
2020-12-24 21:32:08 +05:00
jay 68e60921b1 refactor(mover): 🔥 remove unused code + comments, minor fixes
Refactoring and fixing code.
 No major functionality change.
 Probably will have less bugs.
 - carry over how mcData is loaded
 - stop bot on unload
 - fix wrong magma block name
2020-12-24 19:57:45 +05:00
jay f2281a7cb3 feat(command): temp. move inventory chat handling to command
This is temporary, and only the `toss` function.
Old functionality is still intact.
New code will eventually move back as a subcommand to replace the old.
2020-12-24 19:41:52 +05:00
jay e9f2080556 refactor(command): ♻️ refactor how mcData is loaded
`mcData` is now directly put on bot and loaded once.
It can be accessed from anywhere `bot` is accessible.
2020-12-24 17:51:44 +05:00
jay 086251bce6 feat: add a basic feature to rejoin on server restart 2020-12-24 13:38:16 +05:00
jay 0ae961521f feat(command): expand follow to include rest of the !go follow sub commands 2020-12-24 11:57:23 +05:00
jay eae4e95803 Merge branch 'nogameplay' into master 2020-12-24 11:28:22 +05:00
jay fb066ee8a5 refactor: ♻️ use array in pathfinder movements list 2020-12-24 11:26:19 +05:00
jay f4445749e6 fix: ✏️ add missing plugin name 2020-12-24 11:23:16 +05:00