From a2c53b881b1a54c95036f27577ee7d9b6e583d62 Mon Sep 17 00:00:00 2001 From: Josh Jones Date: Mon, 19 Sep 2022 22:56:54 -0700 Subject: Update NavigationAgent to use query_path This paves the way for having agents respond to link traversal. --- servers/navigation/navigation_path_query_result_2d.cpp | 6 ++++++ servers/navigation/navigation_path_query_result_2d.h | 2 ++ servers/navigation/navigation_path_query_result_3d.cpp | 6 ++++++ servers/navigation/navigation_path_query_result_3d.h | 2 ++ 4 files changed, 16 insertions(+) (limited to 'servers/navigation') diff --git a/servers/navigation/navigation_path_query_result_2d.cpp b/servers/navigation/navigation_path_query_result_2d.cpp index 23f001057b..8a55451e40 100644 --- a/servers/navigation/navigation_path_query_result_2d.cpp +++ b/servers/navigation/navigation_path_query_result_2d.cpp @@ -38,9 +38,15 @@ const Vector &NavigationPathQueryResult2D::get_path() const { return path; } +void NavigationPathQueryResult2D::reset() { + path.clear(); +} + void NavigationPathQueryResult2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_path", "path"), &NavigationPathQueryResult2D::set_path); ClassDB::bind_method(D_METHOD("get_path"), &NavigationPathQueryResult2D::get_path); + ClassDB::bind_method(D_METHOD("reset"), &NavigationPathQueryResult2D::reset); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "path"), "set_path", "get_path"); } diff --git a/servers/navigation/navigation_path_query_result_2d.h b/servers/navigation/navigation_path_query_result_2d.h index c98462016e..da251ef32d 100644 --- a/servers/navigation/navigation_path_query_result_2d.h +++ b/servers/navigation/navigation_path_query_result_2d.h @@ -45,6 +45,8 @@ protected: public: void set_path(const Vector &p_path); const Vector &get_path() const; + + void reset(); }; #endif // NAVIGATION_PATH_QUERY_RESULT_2D_H diff --git a/servers/navigation/navigation_path_query_result_3d.cpp b/servers/navigation/navigation_path_query_result_3d.cpp index 8335d70c4b..1e28352995 100644 --- a/servers/navigation/navigation_path_query_result_3d.cpp +++ b/servers/navigation/navigation_path_query_result_3d.cpp @@ -38,9 +38,15 @@ const Vector &NavigationPathQueryResult3D::get_path() const { return path; } +void NavigationPathQueryResult3D::reset() { + path.clear(); +} + void NavigationPathQueryResult3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_path", "path"), &NavigationPathQueryResult3D::set_path); ClassDB::bind_method(D_METHOD("get_path"), &NavigationPathQueryResult3D::get_path); + ClassDB::bind_method(D_METHOD("reset"), &NavigationPathQueryResult3D::reset); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "path"), "set_path", "get_path"); } diff --git a/servers/navigation/navigation_path_query_result_3d.h b/servers/navigation/navigation_path_query_result_3d.h index ff698c285f..fc143ac389 100644 --- a/servers/navigation/navigation_path_query_result_3d.h +++ b/servers/navigation/navigation_path_query_result_3d.h @@ -45,6 +45,8 @@ protected: public: void set_path(const Vector &p_path); const Vector &get_path() const; + + void reset(); }; #endif // NAVIGATION_PATH_QUERY_RESULT_3D_H -- cgit v1.2.3