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()
#Should work with just arrays
#if os.path.isdir('../mesh_data_resource'):
# module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
if os.path.isdir('../voxelman'):
module_env.Append(CPPDEFINES=['VOXELMAN_PRESENT'])
if os.path.isdir('../terraman'):
module_env.Append(CPPDEFINES=['TERRAMAN_PRESENT'])
sources = [

View File

@ -32,8 +32,10 @@ SOFTWARE.
#include "core/math/math_funcs.h"
#ifdef VOXELMAN_PRESENT
#include "../voxelman/world/default/voxel_chunk_default.h"
#include "../voxelman/world/voxel_chunk.h"
#endif
#include "../entity_spell_system/singletons/ess.h"
#include "../entity_spell_system/spawners/ess_entity_spawner.h"
@ -46,6 +48,7 @@ void BiomeTerrarinGenerator::set_current_seed(int value) {
_current_seed = value;
}
#ifdef VOXELMAN_PRESENT
void BiomeTerrarinGenerator::generate_simple_terrarin(Ref<VoxelChunk> chunk, bool spawn_mobs) {
Ref<OpenSimplexNoise> noise;
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);
// }
}
#endif
BiomeTerrarinGenerator::BiomeTerrarinGenerator() {
_current_seed = 0;
@ -131,5 +135,7 @@ void BiomeTerrarinGenerator::_bind_methods() {
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");
#ifdef VOXELMAN_PRESENT
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"
#endif
#ifdef VOXELMAN_PRESENT
class VoxelChunk;
#endif
class BiomeTerrarinGenerator : public Reference {
GDCLASS(BiomeTerrarinGenerator, Reference);
@ -40,7 +42,9 @@ public:
int get_current_seed();
void set_current_seed(int value);
#ifdef VOXELMAN_PRESENT
void generate_simple_terrarin(Ref<VoxelChunk> chunk, bool spawn_mobs);
#endif
BiomeTerrarinGenerator();
~BiomeTerrarinGenerator();