summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-08 16:05:38 +0200
committerGitHub <noreply@github.com>2022-06-08 16:05:38 +0200
commite4994e28179c2cd854e551201e5761317e6508ba (patch)
treef68be436beeefdeebb9293cc2ff456ed669b9b41 /servers
parent07029e94f4c641df9bb33bffecb8657746f6f8ef (diff)
parentcfdfd304f1ad08b0498eda97b502aaccd95f559d (diff)
Merge pull request #61739 from smix8/navigation_region_cost_4.x
Diffstat (limited to 'servers')
-rw-r--r--servers/navigation_server_2d.cpp10
-rw-r--r--servers/navigation_server_2d.h8
-rw-r--r--servers/navigation_server_3d.cpp4
-rw-r--r--servers/navigation_server_3d.h8
4 files changed, 30 insertions, 0 deletions
diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp
index 901d335017..ab323e76e8 100644
--- a/servers/navigation_server_2d.cpp
+++ b/servers/navigation_server_2d.cpp
@@ -174,6 +174,10 @@ void NavigationServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("map_get_agents", "map"), &NavigationServer2D::map_get_agents);
ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer2D::region_create);
+ ClassDB::bind_method(D_METHOD("region_set_enter_cost", "region", "enter_cost"), &NavigationServer2D::region_set_enter_cost);
+ ClassDB::bind_method(D_METHOD("region_get_enter_cost", "region"), &NavigationServer2D::region_get_enter_cost);
+ ClassDB::bind_method(D_METHOD("region_set_travel_cost", "region", "travel_cost"), &NavigationServer2D::region_set_travel_cost);
+ ClassDB::bind_method(D_METHOD("region_get_travel_cost", "region"), &NavigationServer2D::region_get_travel_cost);
ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &NavigationServer2D::region_set_map);
ClassDB::bind_method(D_METHOD("region_get_map", "region"), &NavigationServer2D::region_get_map);
ClassDB::bind_method(D_METHOD("region_set_layers", "region", "layers"), &NavigationServer2D::region_set_layers);
@@ -239,6 +243,12 @@ Vector2 FORWARD_2_R_C(v3_to_v2, map_get_closest_point, RID, p_map, const Vector2
RID FORWARD_2_C(map_get_closest_point_owner, RID, p_map, const Vector2 &, p_point, rid_to_rid, v2_to_v3);
RID FORWARD_0_C(region_create);
+
+void FORWARD_2_C(region_set_enter_cost, RID, p_region, real_t, p_enter_cost, rid_to_rid, real_to_real);
+real_t FORWARD_1_C(region_get_enter_cost, RID, p_region, rid_to_rid);
+void FORWARD_2_C(region_set_travel_cost, RID, p_region, real_t, p_travel_cost, rid_to_rid, real_to_real);
+real_t FORWARD_1_C(region_get_travel_cost, RID, p_region, rid_to_rid);
+
void FORWARD_2_C(region_set_map, RID, p_region, RID, p_map, rid_to_rid, rid_to_rid);
void FORWARD_2_C(region_set_layers, RID, p_region, uint32_t, p_layers, rid_to_rid, uint32_to_uint32);
uint32_t FORWARD_1_C(region_get_layers, RID, p_region, rid_to_rid);
diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h
index dfdcf5fca8..8e285147b1 100644
--- a/servers/navigation_server_2d.h
+++ b/servers/navigation_server_2d.h
@@ -86,6 +86,14 @@ public:
/// Creates a new region.
virtual RID region_create() const;
+ /// Set the enter_cost of a region
+ virtual void region_set_enter_cost(RID p_region, real_t p_enter_cost) const;
+ virtual real_t region_get_enter_cost(RID p_region) const;
+
+ /// Set the travel_cost of a region
+ virtual void region_set_travel_cost(RID p_region, real_t p_travel_cost) const;
+ virtual real_t region_get_travel_cost(RID p_region) const;
+
/// Set the map of this region.
virtual void region_set_map(RID p_region, RID p_map) const;
virtual RID region_get_map(RID p_region) const;
diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp
index 0ce869ad1a..6d99f6dfbb 100644
--- a/servers/navigation_server_3d.cpp
+++ b/servers/navigation_server_3d.cpp
@@ -52,6 +52,10 @@ void NavigationServer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("map_get_agents", "map"), &NavigationServer3D::map_get_agents);
ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer3D::region_create);
+ ClassDB::bind_method(D_METHOD("region_set_enter_cost", "region", "enter_cost"), &NavigationServer3D::region_set_enter_cost);
+ ClassDB::bind_method(D_METHOD("region_get_enter_cost", "region"), &NavigationServer3D::region_get_enter_cost);
+ ClassDB::bind_method(D_METHOD("region_set_travel_cost", "region", "travel_cost"), &NavigationServer3D::region_set_travel_cost);
+ ClassDB::bind_method(D_METHOD("region_get_travel_cost", "region"), &NavigationServer3D::region_get_travel_cost);
ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &NavigationServer3D::region_set_map);
ClassDB::bind_method(D_METHOD("region_get_map", "region"), &NavigationServer3D::region_get_map);
ClassDB::bind_method(D_METHOD("region_set_layers", "region", "layers"), &NavigationServer3D::region_set_layers);
diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h
index c3d3a589a9..9b7e48e8d1 100644
--- a/servers/navigation_server_3d.h
+++ b/servers/navigation_server_3d.h
@@ -97,6 +97,14 @@ public:
/// Creates a new region.
virtual RID region_create() const = 0;
+ /// Set the enter_cost of a region
+ virtual void region_set_enter_cost(RID p_region, real_t p_enter_cost) const = 0;
+ virtual real_t region_get_enter_cost(RID p_region) const = 0;
+
+ /// Set the travel_cost of a region
+ virtual void region_set_travel_cost(RID p_region, real_t p_travel_cost) const = 0;
+ virtual real_t region_get_travel_cost(RID p_region) const = 0;
+
/// Set the map of this region.
virtual void region_set_map(RID p_region, RID p_map) const = 0;
virtual RID region_get_map(RID p_region) const = 0;