Skip to content

Commit

Permalink
DD2: Tentative fix for BHVT action list
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Nov 13, 2024
1 parent 0147b74 commit cc6ed91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion shared/sdk/MotionFsm2Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,23 @@ void BehaviorTree::set_current_node(sdk::behaviortree::TreeNode* node, uint32_t
method->call(sdk::get_thread_context(), this, node->get_id(), tree_idx, set_node_info);
}

bool is_delayed() {
bool TreeObject::is_delayed() const {
#if TDB_VER >= 69
static auto bhvt_manager = sdk::get_native_singleton("via.behaviortree.BehaviorTreeManager");
static auto bhvt_manager_t = sdk::find_type_definition("via.behaviortree.BehaviorTreeManager");
static auto bhvt_manager_retype = bhvt_manager_t->get_type();
static auto is_delay_setup_objects_prop = utility::re_type::get_field_desc(bhvt_manager_retype, "DelaySetupObjects");

const auto is_delay_setup_objects = utility::re_managed_object::get_field<bool>((::REManagedObject*)bhvt_manager, is_delay_setup_objects_prop);

if (!is_delay_setup_objects) {
// For some reason this can happen
if (this->actions.count == 0 && this->conditions.count == 0 && this->transitions.count == 0) {
if (this->delayed_actions.count > 0 || this->delayed_conditions.count > 0 || this->delayed_transitions.count > 0) {
return true;
}
}
}
#else
const auto is_delay_setup_objects = false;
#endif
Expand Down
1 change: 1 addition & 0 deletions shared/sdk/MotionFsm2Layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ class TreeObjectData : public regenny::via::behaviortree::TreeObjectData {

class TreeObject : public regenny::via::behaviortree::TreeObject {
public:
bool is_delayed() const;
void relocate(uintptr_t old_start, uintptr_t old_end, sdk::NativeArrayNoCapacity<TreeNode>& new_nodes);
void relocate_datas(uintptr_t old_start, uintptr_t old_end, sdk::NativeArrayNoCapacity<TreeNodeData>& new_nodes);

Expand Down

0 comments on commit cc6ed91

Please sign in to comment.