diff --git a/modules/props/tiled_wall/tiled_wall_data.cpp b/modules/props/tiled_wall/tiled_wall_data.cpp index c2fe57b72..f979a2936 100644 --- a/modules/props/tiled_wall/tiled_wall_data.cpp +++ b/modules/props/tiled_wall/tiled_wall_data.cpp @@ -41,6 +41,7 @@ SOFTWARE. #include "../material_cache/prop_material_cache.h" const String TiledWallData::BINDING_STRING_TILED_WALL_TILING_TYPE = "None,Horizontal,Vertical,Both"; +const String TiledWallData::BINDING_STRING_TILED_WALL_COLLIDER_TYPE = "None,Plane,Box,Convex Mesh,Concave Mesh"; TiledWallData::TiledWallTilingType TiledWallData::get_tiling_type() const { return _tiling_type; @@ -51,6 +52,15 @@ void TiledWallData::set_tiling_type(const TiledWallData::TiledWallTilingType val emit_changed(); } +TiledWallData::TiledWallColliderType TiledWallData::get_collider_type() const { + return _collider_type; +} +void TiledWallData::set_collider_type(const TiledWallData::TiledWallColliderType value) { + _collider_type = value; + + emit_changed(); +} + void TiledWallData::add_tile(const Ref &texture, const Vector2 &val, const float z_offset) { _textures.push_back(texture); } @@ -299,6 +309,7 @@ void TiledWallData::copy_from(const Ref &tiled_wall_data) { TiledWallData::TiledWallData() { _tiling_type = TILED_WALL_TILING_TYPE_NONE; + _collider_type = TILED_WALL_COLLIDER_TYPE_PLANE; _flavour_chance = 0.15; } TiledWallData::~TiledWallData() { @@ -430,6 +441,10 @@ void TiledWallData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_tiling_type", "texture"), &TiledWallData::set_tiling_type); ADD_PROPERTY(PropertyInfo(Variant::INT, "tiling_type", PROPERTY_HINT_ENUM, TiledWallData::BINDING_STRING_TILED_WALL_TILING_TYPE), "set_tiling_type", "get_tiling_type"); + ClassDB::bind_method(D_METHOD("get_collider_type"), &TiledWallData::get_collider_type); + ClassDB::bind_method(D_METHOD("set_collider_type", "texture"), &TiledWallData::set_collider_type); + ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_type", PROPERTY_HINT_ENUM, TiledWallData::BINDING_STRING_TILED_WALL_COLLIDER_TYPE), "set_collider_type", "get_collider_type"); + //textures ClassDB::bind_method(D_METHOD("add_tile", "texture", "size", "z_offset"), &TiledWallData::add_tile, Vector2(1, 1), 0); ClassDB::bind_method(D_METHOD("remove_tile", "index"), &TiledWallData::remove_tile); diff --git a/modules/props/tiled_wall/tiled_wall_data.h b/modules/props/tiled_wall/tiled_wall_data.h index 2612124b0..205ba6ccf 100644 --- a/modules/props/tiled_wall/tiled_wall_data.h +++ b/modules/props/tiled_wall/tiled_wall_data.h @@ -51,12 +51,24 @@ public: TILED_WALL_TILING_TYPE_BOTH }; + enum TiledWallColliderType { + TILED_WALL_COLLIDER_TYPE_NONE = 0, + TILED_WALL_COLLIDER_TYPE_PLANE, + TILED_WALL_COLLIDER_TYPE_BOX, + TILED_WALL_COLLIDER_TYPE_CONVEX_MESH, + TILED_WALL_COLLIDER_TYPE_CONCAVE_MESH + }; + static const String BINDING_STRING_TILED_WALL_TILING_TYPE; + static const String BINDING_STRING_TILED_WALL_COLLIDER_TYPE; public: TiledWallTilingType get_tiling_type() const; void set_tiling_type(const TiledWallTilingType value); + TiledWallColliderType get_collider_type() const; + void set_collider_type(const TiledWallColliderType value); + //textures void add_tile(const Ref &texture, const Vector2 &val = Vector2(1, 1), const float z_offset = 0); void remove_tile(const int index); @@ -124,8 +136,6 @@ protected: static void _bind_methods(); private: - TiledWallTilingType _tiling_type; - struct TextureEntry { Ref texture; Vector2 size; @@ -143,6 +153,9 @@ private: } }; + TiledWallTilingType _tiling_type; + TiledWallColliderType _collider_type; + Vector _textures; Vector _flavour_textures; float _flavour_chance; @@ -151,5 +164,6 @@ private: }; VARIANT_ENUM_CAST(TiledWallData::TiledWallTilingType); +VARIANT_ENUM_CAST(TiledWallData::TiledWallColliderType); #endif