Added a "_prop_added" vmethod to Chunk.

This commit is contained in:
Relintai 2019-10-14 23:59:42 +02:00
parent fd3a162126
commit 472b077d3f

View File

@ -429,6 +429,9 @@ void VoxelChunk::clear_baked_lights() {
void VoxelChunk::add_prop(Ref<VoxelChunkPropData> prop) {
_props.push_back(prop);
if (has_method("_prop_added"))
call("_prop_added", prop);
}
Ref<VoxelChunkPropData> VoxelChunk::get_prop(int index) {
return _props.get(index);
@ -731,6 +734,8 @@ void VoxelChunk::_bind_methods() {
BIND_VMETHOD(MethodInfo("_create_mesh"));
BIND_VMETHOD(MethodInfo("_create_mesher"));
BIND_VMETHOD(MethodInfo("_prop_added", PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunkPropData")));
ClassDB::bind_method(D_METHOD("_create_mesher"), &VoxelChunk::_create_mesher);
ClassDB::bind_method(D_METHOD("get_chunk_position_x"), &VoxelChunk::get_chunk_position_x);