File tree 3 files changed +41
-1
lines changed
3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { Bot } from "mineflayer"
2
2
import { Heuristics , Goal } from "./src/heuristics/"
3
3
4
- export interface Movement {
4
+ declare interface Goals {
5
+ Default : Goal
6
+ }
7
+
8
+ declare interface Movement {
5
9
heuristic : Heuristics
10
+ goals : Goals
6
11
Goal : ( heuristics : object ) => Goal
7
12
setGoal : ( goal : Goal ) => void
8
13
getYaw : ( fov ?: number , rotations ?: number , blend ?: number ) => number
Original file line number Diff line number Diff line change 1
1
const Heuristics = require ( "./src/heuristics" )
2
+ const Goals = require ( "./src/goals" )
2
3
3
4
module . exports . plugin = function inject ( bot ) {
4
5
bot . movement = new Plugin ( bot )
@@ -12,6 +13,8 @@ function Goal(heuristicMap) {
12
13
13
14
function Plugin ( bot ) {
14
15
this . heuristic = new Heuristics ( bot )
16
+ this . goals = new Goals ( bot )
17
+
15
18
this . setGoal = setGoal
16
19
this . getYaw = getYaw
17
20
this . steer = steer
Original file line number Diff line number Diff line change
1
+ module . exports = function Goals ( bot ) {
2
+ this . Default = new bot . movement . Goal ( {
3
+ distance : bot . movement . heuristic . new ( 'distance' )
4
+ . configure ( {
5
+ weight : 0.4 ,
6
+ radius : 10 ,
7
+ spread : 25 ,
8
+ offset : 1 ,
9
+ count : 5 ,
10
+ increment : 0.2
11
+ } ) ,
12
+ danger : bot . movement . heuristic . new ( 'danger' )
13
+ . configure ( {
14
+ weight : 0.6 ,
15
+ radius : 3 ,
16
+ count : 6 ,
17
+ depth : 2 ,
18
+ descend : false ,
19
+ increment : 0.2
20
+ } ) ,
21
+ proximity : bot . movement . heuristic . new ( 'proximity' )
22
+ . configure ( {
23
+ weight : 0.6 ,
24
+ avoid : false
25
+ } ) ,
26
+ conformity : bot . movement . heuristic . new ( 'conformity' )
27
+ . configure ( {
28
+ weight : 0.2 ,
29
+ avoid : false
30
+ } )
31
+ } )
32
+ }
You can’t perform that action at this time.
0 commit comments