Skip to content

Commit d4fcca4

Browse files
[TileSet] Expose TileData.is_valid_terrain_peering_bit
1 parent 7d151c8 commit d4fcca4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

doc/classes/TileData.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
<return type="int" />
9494
<param index="0" name="peering_bit" type="int" enum="TileSet.CellNeighbor" />
9595
<description>
96-
Returns the tile's terrain bit for the given [param peering_bit] direction.
96+
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].
9797
</description>
9898
</method>
9999
<method name="is_collision_polygon_one_way" qualifiers="const">
@@ -104,6 +104,13 @@
104104
Returns whether one-way collisions are enabled for the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
105105
</description>
106106
</method>
107+
<method name="is_valid_terrain_peering_bit" qualifiers="const">
108+
<return type="bool" />
109+
<param index="0" name="peering_bit" type="int" enum="TileSet.CellNeighbor" />
110+
<description>
111+
Returns whether the given [param peering_bit] direction is valid for this tile.
112+
</description>
113+
</method>
107114
<method name="remove_collision_polygon">
108115
<return type="void" />
109116
<param index="0" name="layer_id" type="int" />
@@ -200,7 +207,7 @@
200207
<param index="0" name="peering_bit" type="int" enum="TileSet.CellNeighbor" />
201208
<param index="1" name="terrain" type="int" />
202209
<description>
203-
Sets the tile's terrain bit for the given [param peering_bit] direction.
210+
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].
204211
</description>
205212
</method>
206213
</methods>

scene/resources/2d/tile_set.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6918,6 +6918,7 @@ void TileData::_bind_methods() {
69186918
ClassDB::bind_method(D_METHOD("get_terrain"), &TileData::get_terrain);
69196919
ClassDB::bind_method(D_METHOD("set_terrain_peering_bit", "peering_bit", "terrain"), &TileData::set_terrain_peering_bit);
69206920
ClassDB::bind_method(D_METHOD("get_terrain_peering_bit", "peering_bit"), &TileData::get_terrain_peering_bit);
6921+
ClassDB::bind_method(D_METHOD("is_valid_terrain_peering_bit", "peering_bit"), &TileData::is_valid_terrain_peering_bit);
69216922

69226923
// Navigation
69236924
ClassDB::bind_method(D_METHOD("set_navigation_polygon", "layer_id", "navigation_polygon"), &TileData::set_navigation_polygon);

0 commit comments

Comments
 (0)