MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / BehaviorState

Method BehaviorState

source/game/StarBehaviorState.cpp:134–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134BehaviorState::BehaviorState(BehaviorTreeConstPtr tree, LuaTable context, Maybe<BlackboardWeakPtr> blackboard) : m_tree(tree), m_luaContext(std::move(context)) {
135 if (blackboard)
136 m_board = *blackboard;
137 else
138 m_board = make_shared<Blackboard>(m_luaContext);
139
140 LuaFunction require = m_luaContext.get<LuaFunction>("require");
141 for (auto script : m_tree->scripts)
142 require.invoke(script);
143
144 for (String const& name : m_tree->functions)
145 m_functions.set(name, m_luaContext.get<LuaFunction>(name));
146}
147
148NodeStatus BehaviorState::run(float dt) {
149 m_lastDt = dt;

Callers

nothing calls this directly

Calls 2

invokeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected