Fix compile without voxelman.

This commit is contained in:
Relintai 2021-04-19 10:13:14 +02:00
parent 4d8de70db8
commit 8bfe7efe69
3 changed files with 15 additions and 3 deletions

8
SCsub
View File

@ -4,9 +4,11 @@ Import('env')
module_env = env.Clone() module_env = env.Clone()
#Should work with just arrays if os.path.isdir('../voxelman'):
#if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['VOXELMAN_PRESENT'])
# module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
if os.path.isdir('../terraman'):
module_env.Append(CPPDEFINES=['TERRAMAN_PRESENT'])
sources = [ sources = [

View File

@ -32,8 +32,10 @@ SOFTWARE.
#include "core/math/math_funcs.h" #include "core/math/math_funcs.h"
#ifdef VOXELMAN_PRESENT
#include "../voxelman/world/default/voxel_chunk_default.h" #include "../voxelman/world/default/voxel_chunk_default.h"
#include "../voxelman/world/voxel_chunk.h" #include "../voxelman/world/voxel_chunk.h"
#endif
#include "../entity_spell_system/singletons/ess.h" #include "../entity_spell_system/singletons/ess.h"
#include "../entity_spell_system/spawners/ess_entity_spawner.h" #include "../entity_spell_system/spawners/ess_entity_spawner.h"
@ -46,6 +48,7 @@ void BiomeTerrarinGenerator::set_current_seed(int value) {
_current_seed = value; _current_seed = value;
} }
#ifdef VOXELMAN_PRESENT
void BiomeTerrarinGenerator::generate_simple_terrarin(Ref<VoxelChunk> chunk, bool spawn_mobs) { void BiomeTerrarinGenerator::generate_simple_terrarin(Ref<VoxelChunk> chunk, bool spawn_mobs) {
Ref<OpenSimplexNoise> noise; Ref<OpenSimplexNoise> noise;
noise.instance(); noise.instance();
@ -118,6 +121,7 @@ void BiomeTerrarinGenerator::generate_simple_terrarin(Ref<VoxelChunk> chunk, boo
// ESS::get_singleton()->get_entity_spawner()->call("spawn_mob", 0, Math::rand() % 3, v); // ESS::get_singleton()->get_entity_spawner()->call("spawn_mob", 0, Math::rand() % 3, v);
// } // }
} }
#endif
BiomeTerrarinGenerator::BiomeTerrarinGenerator() { BiomeTerrarinGenerator::BiomeTerrarinGenerator() {
_current_seed = 0; _current_seed = 0;
@ -131,5 +135,7 @@ void BiomeTerrarinGenerator::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &BiomeTerrarinGenerator::set_current_seed); ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &BiomeTerrarinGenerator::set_current_seed);
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_seed"), "set_current_seed", "get_current_seed"); ADD_PROPERTY(PropertyInfo(Variant::INT, "current_seed"), "set_current_seed", "get_current_seed");
#ifdef VOXELMAN_PRESENT
ClassDB::bind_method(D_METHOD("generate_simple_terrarin", "chunk", "spawn_mobs"), &BiomeTerrarinGenerator::generate_simple_terrarin); ClassDB::bind_method(D_METHOD("generate_simple_terrarin", "chunk", "spawn_mobs"), &BiomeTerrarinGenerator::generate_simple_terrarin);
#endif
} }

View File

@ -31,7 +31,9 @@ SOFTWARE.
#include "core/reference.h" #include "core/reference.h"
#endif #endif
#ifdef VOXELMAN_PRESENT
class VoxelChunk; class VoxelChunk;
#endif
class BiomeTerrarinGenerator : public Reference { class BiomeTerrarinGenerator : public Reference {
GDCLASS(BiomeTerrarinGenerator, Reference); GDCLASS(BiomeTerrarinGenerator, Reference);
@ -40,7 +42,9 @@ public:
int get_current_seed(); int get_current_seed();
void set_current_seed(int value); void set_current_seed(int value);
#ifdef VOXELMAN_PRESENT
void generate_simple_terrarin(Ref<VoxelChunk> chunk, bool spawn_mobs); void generate_simple_terrarin(Ref<VoxelChunk> chunk, bool spawn_mobs);
#endif
BiomeTerrarinGenerator(); BiomeTerrarinGenerator();
~BiomeTerrarinGenerator(); ~BiomeTerrarinGenerator();