Avoidance positions are now using Vector2is in LayeredTileData.

This commit is contained in:
Relintai 2024-05-11 13:48:35 +02:00
parent 4f11a25ef7
commit 37e586ebbc
2 changed files with 7 additions and 7 deletions

View File

@ -6782,14 +6782,14 @@ real_t LayeredTileData::get_avoidance_radius(int p_layer_id) const {
return avoidance[p_layer_id].radius; return avoidance[p_layer_id].radius;
} }
void LayeredTileData::set_avoidance_position(int p_layer_id, const Vector2 &p_position) { void LayeredTileData::set_avoidance_position(int p_layer_id, const Vector2i &p_position) {
ERR_FAIL_INDEX(p_layer_id, avoidance.size()); ERR_FAIL_INDEX(p_layer_id, avoidance.size());
avoidance.write[p_layer_id].position = p_position; avoidance.write[p_layer_id].position = p_position;
emit_signal("changed"); emit_signal("changed");
} }
Vector2 LayeredTileData::get_avoidance_position(int p_layer_id) const { Vector2i LayeredTileData::get_avoidance_position(int p_layer_id) const {
ERR_FAIL_INDEX_V(p_layer_id, avoidance.size(), Vector2()); ERR_FAIL_INDEX_V(p_layer_id, avoidance.size(), Vector2i());
return avoidance[p_layer_id].position; return avoidance[p_layer_id].position;
} }
@ -7215,7 +7215,7 @@ void LayeredTileData::_get_property_list(List<PropertyInfo> *p_list) const {
property_info = PropertyInfo(Variant::REAL, vformat("avoidance_layer_%d/%s", i, "radius")); property_info = PropertyInfo(Variant::REAL, vformat("avoidance_layer_%d/%s", i, "radius"));
p_list->push_back(property_info); p_list->push_back(property_info);
property_info = PropertyInfo(Variant::VECTOR2, vformat("avoidance_layer_%d/%s", i, "position")); property_info = PropertyInfo(Variant::VECTOR2I, vformat("avoidance_layer_%d/%s", i, "position"));
p_list->push_back(property_info); p_list->push_back(property_info);
property_info = PropertyInfo(Variant::POOL_VECTOR2_ARRAY, vformat("avoidance_layer_%d/%s", i, "polygon")); property_info = PropertyInfo(Variant::POOL_VECTOR2_ARRAY, vformat("avoidance_layer_%d/%s", i, "polygon"));

View File

@ -916,7 +916,7 @@ private:
struct AvoidanceLayerTileData { struct AvoidanceLayerTileData {
Vector<Vector2> polygon; Vector<Vector2> polygon;
real_t radius = 0.0; real_t radius = 0.0;
Vector2 position; Vector2i position;
}; };
Vector<AvoidanceLayerTileData> avoidance; Vector<AvoidanceLayerTileData> avoidance;
@ -1029,8 +1029,8 @@ public:
// Avoidance // Avoidance
void set_avoidance_radius(int p_layer_id, const real_t p_radius); void set_avoidance_radius(int p_layer_id, const real_t p_radius);
real_t get_avoidance_radius(int p_layer_id) const; real_t get_avoidance_radius(int p_layer_id) const;
void set_avoidance_position(int p_layer_id, const Vector2 &p_position); void set_avoidance_position(int p_layer_id, const Vector2i &p_position);
Vector2 get_avoidance_position(int p_layer_id) const; Vector2i get_avoidance_position(int p_layer_id) const;
void set_avoidance_polygon_points(int p_layer_id, Vector<Vector2> p_polygon); void set_avoidance_polygon_points(int p_layer_id, Vector<Vector2> p_polygon);
Vector<Vector2> get_avoidance_polygon_points(int p_layer_id) const; Vector<Vector2> get_avoidance_polygon_points(int p_layer_id) const;