Fix not baking behavior tree
This commit is contained in:
parent
49d6cb0d89
commit
5c0316746e
@ -275,13 +275,25 @@ private fun createBehaviorTree(args: LuaThread.ArgStack): Int {
|
||||
val root = createNode(args.lua, mergedParams.root, mergedParams.mappedParameters, blackboard, scripts, functions, handles)
|
||||
handles.add(root)
|
||||
|
||||
args.lua.loadGlobal("require")
|
||||
|
||||
scripts.forEach {
|
||||
args.lua.dup()
|
||||
args.lua.push(it)
|
||||
args.lua.call(1)
|
||||
}
|
||||
|
||||
check(args.lua.loadGlobal("BehaviorState") == LuaType.FUNCTION) { "Global BehaviorState is not a Lua function" }
|
||||
|
||||
args.lua.push(blackboard)
|
||||
args.lua.push(root)
|
||||
|
||||
args.lua.call(2, 1)
|
||||
|
||||
args.lua.push("bake")
|
||||
check(args.lua.loadTableValue() == LuaType.FUNCTION) { "BehaviorTree.bake is not a Lua function" }
|
||||
args.lua.dup(-2)
|
||||
args.lua.call(1)
|
||||
|
||||
handles.forEach { it.close() }
|
||||
return 1
|
||||
}
|
||||
|
@ -665,6 +665,10 @@ function statePrototype:clear()
|
||||
self.tree:reset()
|
||||
end
|
||||
|
||||
function statePrototype:bake()
|
||||
self.tree:bake()
|
||||
end
|
||||
|
||||
function statePrototype:blackboard()
|
||||
return self._blackboard
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user