Skip to content

Commit

Permalink
加载行为树文件时,载入行为树模块
Browse files Browse the repository at this point in the history
  • Loading branch information
dong50252409 committed May 11, 2022
1 parent 2341376 commit 6d70558
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/behavior_tree.erl
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,13 @@ load_beam_code(JSONConfig, TreeNodes, Titles, Options) ->

Body2 = [
[
io_lib:format("get_node(~w) -> ~w;\n", [ID, TreeNode])
|| #tree_node{id = ID} = TreeNode <- TreeNodes
case code:ensure_loaded(Name) of
{module, _} ->
io_lib:format("get_node(~w) -> ~w;\n", [ID, TreeNode]);
{error, What} ->
error({node_not_implement, Name, What})
end
|| #tree_node{id = ID, name = Name} = TreeNode <- TreeNodes
],
"get_node(_) -> erlang:throw(node_not_exist).\n\n"
],
Expand Down

0 comments on commit 6d70558

Please sign in to comment.