Complete some of the _setup_library methods.

This commit is contained in:
Relintai 2020-07-20 18:30:39 +02:00
parent 882008ac7f
commit 59dde526b9
3 changed files with 60 additions and 0 deletions

View File

@ -150,6 +150,8 @@ void Biome::generate_stack(Ref<VoxelChunk> chunk, int x, int z, bool spawn_mobs)
}
void Biome::setup_library(Ref<VoxelmanLibrary> library) {
ERR_FAIL_COND(!library.is_valid());
if (!_data.is_valid())
return;
@ -167,6 +169,14 @@ void Biome::_setup_library(Ref<VoxelmanLibrary> library) {
}
}
for (int i = 0; i < get_dungeon_count(); ++i) {
Ref<Dungeon> d = get_dungeon(i);
if (d.is_valid()) {
d->setup_library(library);
}
}
#ifdef PROPS_PRESENT
for (int i = 0; i < _data->get_prop_data_count(); ++i) {
Ref<WorldGeneratorPropData> s = _data->get_prop_data(i);

View File

@ -250,6 +250,38 @@ void Dungeon::_setup_library(Ref<VoxelmanLibrary> library) {
library->add_voxel_surface(s);
}
}
for (int i = 0; i < get_dungeon_corridor_count(); ++i) {
Ref<DungeonCorridor> d = get_dungeon_corridor(i);
if (d.is_valid()) {
d->setup_library(library);
}
}
for (int i = 0; i < get_dungeon_end_room_count(); ++i) {
Ref<DungeonRoom> d = get_dungeon_end_room(i);
if (d.is_valid()) {
d->setup_library(library);
}
}
for (int i = 0; i < get_dungeon_room_count(); ++i) {
Ref<DungeonRoom> d = get_dungeon_room(i);
if (d.is_valid()) {
d->setup_library(library);
}
}
for (int i = 0; i < get_dungeon_start_room_count(); ++i) {
Ref<DungeonRoom> d = get_dungeon_start_room(i);
if (d.is_valid()) {
d->setup_library(library);
}
}
}
void Dungeon::generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs) {

View File

@ -109,6 +109,8 @@ void Planet::setup() {
#ifdef VOXELMAN_PRESENT
void Planet::setup_library(Ref<VoxelmanLibrary> library) {
ERR_FAIL_COND(!library.is_valid());
if (!_data.is_valid())
return;
@ -125,6 +127,22 @@ void Planet::_setup_library(Ref<VoxelmanLibrary> library) {
library->add_voxel_surface(s);
}
}
for (int i = 0; i < get_biome_count(); ++i) {
Ref<Biome> s = get_biome(i);
if (s.is_valid()) {
s->setup_library(library);
}
}
for (int i = 0; i < get_dungeon_count(); ++i) {
Ref<Dungeon> d = get_dungeon(i);
if (d.is_valid()) {
d->setup_library(library);
}
}
}
void Planet::generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs) {