Open
Description
Could we get some way of visualizing the current tree? For example:
.selector('wander around')
.do('do nothing if unit is already moving', CheckMotion.checkIfMoving())
.sequence('perform wander sequence')
.do('wait for some time', Wait.wait())
.do('locate a fitting tile', Tile.locateFitting())
.do('go to tile', Tile.goToPoint())
.do('reset wait cycle', Wait.reset())
.end()
.end()
.build();
const tree = wanderBehavior.tick();
const treeLooksLike = {
'wander around': {
name: 'wander around',
result: 'RUNNING',
children: {
'do nothing if already moving': {
name: 'do nothing if already moving',
result: 'FAILURE'
},
'perform wander sequence': {
name: 'perform wander sequence',
result: 'RUNNING',
children: {
'wait for some time': {
name: 'wait for some time',
result: 'SUCCESS'
},
'locate fitting tile': {
...,
result: 'SUCCESS'
},
'go to tile': {
...,
result: 'RUNNING'
},
'reset wait cycle': {
...,
result: 'SUCCESS' //or maybe 'UNREACHED'? since the tree hasn't reached this point yet, as the previous action is still RUNNING
}
}
}
}
}
}
Then you can feed this into your console.log
or your tree visualizer package.
I'll see if I can put together a PR if you're interested in having this in the main branch.
Metadata
Metadata
Assignees
Labels
No labels