summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJosh Jones <kilauea.jones@gmail.com>2022-09-19 22:56:54 -0700
committerJosh Jones <kilauea.jones@gmail.com>2022-09-28 23:01:12 -0600
commita2c53b881b1a54c95036f27577ee7d9b6e583d62 (patch)
treeaa84002a7cb9f54d3347f8e9c827a991e44b49ef /servers
parentc2f66648f1cb7f26adf77cc3cf91052c95be5dbe (diff)
Update NavigationAgent to use query_path
This paves the way for having agents respond to link traversal.
Diffstat (limited to 'servers')
-rw-r--r--servers/navigation/navigation_path_query_result_2d.cpp6
-rw-r--r--servers/navigation/navigation_path_query_result_2d.h2
-rw-r--r--servers/navigation/navigation_path_query_result_3d.cpp6
-rw-r--r--servers/navigation/navigation_path_query_result_3d.h2
4 files changed, 16 insertions, 0 deletions
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<Vector2> &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<Vector2> &p_path);
const Vector<Vector2> &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<Vector3> &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<Vector3> &p_path);
const Vector<Vector3> &get_path() const;
+
+ void reset();
};
#endif // NAVIGATION_PATH_QUERY_RESULT_3D_H