From d4fcca4545b0747ebbc3cc126454d129e74d9211 Mon Sep 17 00:00:00 2001
From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Date: Tue, 26 Mar 2024 16:07:38 +0100
Subject: [PATCH] [TileSet] Expose `TileData.is_valid_terrain_peering_bit`
---
doc/classes/TileData.xml | 11 +++++++++--
scene/resources/2d/tile_set.cpp | 1 +
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/doc/classes/TileData.xml b/doc/classes/TileData.xml
index c5b86f079e9..91df90580c7 100644
--- a/doc/classes/TileData.xml
+++ b/doc/classes/TileData.xml
@@ -93,7 +93,7 @@
- Returns the tile's terrain bit for the given [param peering_bit] direction.
+ Returns the tile's terrain bit for the given [param peering_bit] direction. To check that a direction is valid, use [method is_valid_terrain_peering_bit].
@@ -104,6 +104,13 @@
Returns whether one-way collisions are enabled for the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
+
+
+
+
+ Returns whether the given [param peering_bit] direction is valid for this tile.
+
+
@@ -200,7 +207,7 @@
- Sets the tile's terrain bit for the given [param peering_bit] direction.
+ Sets the tile's terrain bit for the given [param peering_bit] direction. To check that a direction is valid, use [method is_valid_terrain_peering_bit].
diff --git a/scene/resources/2d/tile_set.cpp b/scene/resources/2d/tile_set.cpp
index 66d97398b9f..6ae97944e08 100644
--- a/scene/resources/2d/tile_set.cpp
+++ b/scene/resources/2d/tile_set.cpp
@@ -6918,6 +6918,7 @@ void TileData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_terrain"), &TileData::get_terrain);
ClassDB::bind_method(D_METHOD("set_terrain_peering_bit", "peering_bit", "terrain"), &TileData::set_terrain_peering_bit);
ClassDB::bind_method(D_METHOD("get_terrain_peering_bit", "peering_bit"), &TileData::get_terrain_peering_bit);
+ ClassDB::bind_method(D_METHOD("is_valid_terrain_peering_bit", "peering_bit"), &TileData::is_valid_terrain_peering_bit);
// Navigation
ClassDB::bind_method(D_METHOD("set_navigation_polygon", "layer_id", "navigation_polygon"), &TileData::set_navigation_polygon);