mirror of
https://github.com/Relintai/world_generator.git
synced 2025-04-19 21:43:15 +02:00
VoxelChunk is now inherited from Resource.
This commit is contained in:
parent
533c25e96f
commit
35a2ab30fe
@ -136,26 +136,20 @@ void Biome::setup() {
|
||||
}
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
void Biome::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void Biome::generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk, spawn_mobs);
|
||||
}
|
||||
}
|
||||
void Biome::generate_chunk_bind(Node *chunk, bool spawn_mobs) {
|
||||
generate_chunk(Object::cast_to<VoxelChunk>(chunk), spawn_mobs);
|
||||
}
|
||||
void Biome::generate_stack(VoxelChunk *chunk, int x, int z, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void Biome::generate_stack(Ref<VoxelChunk> chunk, int x, int z, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_stack")) {
|
||||
call("_generate_stack", chunk, x, z, spawn_mobs);
|
||||
}
|
||||
}
|
||||
void Biome::generate_stack_bind(Node *chunk, int x, int z, bool spawn_mobs) {
|
||||
generate_stack(Object::cast_to<VoxelChunk>(chunk), x, z, spawn_mobs);
|
||||
}
|
||||
|
||||
void Biome::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
@ -204,8 +198,8 @@ void Biome::setup_library(Ref<Resource> library) {
|
||||
}
|
||||
}
|
||||
|
||||
void Biome::generate_chunk(Node *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void Biome::generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk, spawn_mobs);
|
||||
@ -249,8 +243,8 @@ void Biome::_bind_methods() {
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Biome::_setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Biome::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_stack", "chunk", "x", "z", "spawn_mobs"), &Biome::generate_stack_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Biome::generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("generate_stack", "chunk", "x", "z", "spawn_mobs"), &Biome::generate_stack);
|
||||
#else
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Biome::generate_chunk);
|
||||
#endif
|
||||
|
@ -24,6 +24,7 @@ SOFTWARE.
|
||||
#define BIOME_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "dungeon.h"
|
||||
|
||||
@ -88,15 +89,13 @@ public:
|
||||
void setup();
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_stack(VoxelChunk *chunk, int x, int z, bool spawn_mobs);
|
||||
void generate_stack_bind(Node *chunk, int x, int z, bool spawn_mobs);
|
||||
void generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs);
|
||||
void generate_stack(Ref<VoxelChunk> chunk, int x, int z, bool spawn_mobs);
|
||||
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
#else
|
||||
void generate_chunk(Node *chunk, bool spawn_mobs);
|
||||
void generate_chunk(Ref<Reource> chunk, bool spawn_mobs);
|
||||
|
||||
void setup_library(Ref<Resource> library);
|
||||
#endif
|
||||
|
@ -262,16 +262,13 @@ void Dungeon::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void Dungeon::generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk, spawn_mobs);
|
||||
}
|
||||
}
|
||||
void Dungeon::generate_chunk_bind(Node *chunk, bool spawn_mobs) {
|
||||
generate_chunk(Object::cast_to<VoxelChunk>(chunk), spawn_mobs);
|
||||
}
|
||||
|
||||
void Dungeon::generate_structure(Ref<VoxelStructure> structure, bool spawn_mobs) {
|
||||
if (has_method("_generate_structure")) {
|
||||
@ -288,8 +285,8 @@ void Dungeon::setup_library(Ref<Resource> library) {
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::generate_chunk(Node *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void Dungeon::generate_chunk(Ref<Resource> chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk, spawn_mobs);
|
||||
@ -350,7 +347,7 @@ void Dungeon::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Dungeon::setup_library);
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Dungeon::_setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Dungeon::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Dungeon::generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("generate_structure", "structure", "spawn_mobs"), &Dungeon::generate_structure);
|
||||
#else
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Dungeon::setup_library);
|
||||
|
@ -131,12 +131,11 @@ public:
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs);
|
||||
void generate_structure(Ref<VoxelStructure> structure, bool spawn_mobs);
|
||||
#else
|
||||
void setup_library(Ref<Resource> library);
|
||||
void generate_chunk(Node *chunk, bool spawn_mobs);
|
||||
void generate_chunk(Ref<Resource> chunk, bool spawn_mobs);
|
||||
#endif
|
||||
|
||||
Ref<Image> generate_map();
|
||||
|
@ -203,18 +203,14 @@ void DungeonRoom::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void DungeonRoom::generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk, spawn_mobs);
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::generate_chunk_bind(Node *chunk, bool spawn_mobs) {
|
||||
generate_chunk(Object::cast_to<VoxelChunk>(chunk), spawn_mobs);
|
||||
}
|
||||
|
||||
void DungeonRoom::generate_room(Ref<VoxelStructure> structure, bool spawn_mobs) {
|
||||
if (has_method("_generate_room")) {
|
||||
call("_generate_room", structure, spawn_mobs);
|
||||
@ -231,8 +227,8 @@ void DungeonRoom::setup_library(Ref<Resource> library) {
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::generate_chunk(Node *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void DungeonRoom::generate_chunk(Ref<Resource> chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk, spawn_mobs);
|
||||
@ -286,7 +282,7 @@ void DungeonRoom::_bind_methods() {
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("generate_room", "structure", "spawn_mobs"), &DungeonRoom::generate_room);
|
||||
#else
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk);
|
||||
|
@ -111,8 +111,7 @@ public:
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs);
|
||||
void generate_room(Ref<VoxelStructure> structure, bool spawn_mobs);
|
||||
#else
|
||||
void setup_library(Ref<Resource> library);
|
||||
|
@ -137,17 +137,14 @@ void Planet::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void Planet::generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk, spawn_mobs);
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::generate_chunk_bind(Node *chunk, bool spawn_mobs) {
|
||||
generate_chunk(Object::cast_to<VoxelChunk>(chunk), spawn_mobs);
|
||||
}
|
||||
#else
|
||||
void Planet::setup_library(Ref<Resource> library) {
|
||||
if (!_data.is_valid())
|
||||
@ -158,8 +155,8 @@ void Planet::setup_library(Ref<Resource> library) {
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::generate_chunk(Node *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
void Planet::generate_chunk(Ref<Resource> chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!chunk.is_valid());
|
||||
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk, spawn_mobs);
|
||||
@ -200,7 +197,7 @@ void Planet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Planet::setup);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Planet::_setup_library);
|
||||
#else
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk);
|
||||
|
@ -79,10 +79,9 @@ public:
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs);
|
||||
#else
|
||||
void generate_chunk(Node *chunk, bool spawn_mobs);
|
||||
void generate_chunk(Ref<Resource> chunk, bool spawn_mobs);
|
||||
void setup_library(Ref<Resource> library);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user