diff --git a/SCsub b/SCsub index 44a4201..7d2dd93 100644 --- a/SCsub +++ b/SCsub @@ -12,7 +12,7 @@ sources = [ "register_types.cpp", - "biome_base.cpp" + "biome_terrarin_generator.cpp" ] if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': diff --git a/biome_base.cpp b/biome_terrarin_generator.cpp similarity index 83% rename from biome_base.cpp rename to biome_terrarin_generator.cpp index 3081fcd..1b897cb 100644 --- a/biome_base.cpp +++ b/biome_terrarin_generator.cpp @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "biome_base.h" +#include "biome_terrarin_generator.h" #include "core/math/math_funcs.h" @@ -33,7 +33,14 @@ SOFTWARE. #include "../entity_spell_system/spawners/ess_entity_spawner.h" #include "../opensimplex/open_simplex_noise.h" -void BiomeBase::generate_simple_terrarin(Ref chunk, bool spawn_mobs) { +int BiomeTerrarinGenerator::get_current_seed() { + return _current_seed; +} +void BiomeTerrarinGenerator::set_current_seed(int value) { + _current_seed = value; +} + +void BiomeTerrarinGenerator::generate_simple_terrarin(Ref chunk, bool spawn_mobs) { Ref noise; noise.instance(); noise->set_seed(10 * get_current_seed()); @@ -106,12 +113,17 @@ void BiomeBase::generate_simple_terrarin(Ref chunk, bool spawn_mobs) // } } -BiomeBase::BiomeBase() { +BiomeTerrarinGenerator::BiomeTerrarinGenerator() { + _current_seed = 0; } -BiomeBase::~BiomeBase() { +BiomeTerrarinGenerator::~BiomeTerrarinGenerator() { } -void BiomeBase::_bind_methods() { - ClassDB::bind_method(D_METHOD("generate_simple_terrarin", "chunk", "spawn_mobs"), &BiomeBase::generate_simple_terrarin); +void BiomeTerrarinGenerator::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_current_seed"), &BiomeTerrarinGenerator::get_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"); + + ClassDB::bind_method(D_METHOD("generate_simple_terrarin", "chunk", "spawn_mobs"), &BiomeTerrarinGenerator::generate_simple_terrarin); } \ No newline at end of file diff --git a/biome_base.h b/biome_terrarin_generator.h similarity index 78% rename from biome_base.h rename to biome_terrarin_generator.h index 4fa6bc1..0b6f117 100644 --- a/biome_base.h +++ b/biome_terrarin_generator.h @@ -20,24 +20,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef BIOME_BASE_H -#define BIOME_BASE_H +#ifndef BIOME_TERRARIN_GENERATOR_H +#define BIOME_TERRARIN_GENERATOR_H -#include "../world_generator/main/biome.h" +#include "core/reference.h" class VoxelChunk; -class BiomeBase : public Biome { - GDCLASS(BiomeBase, Biome); +class BiomeTerrarinGenerator : public Reference { + GDCLASS(BiomeTerrarinGenerator, Reference); public: + int get_current_seed(); + void set_current_seed(int value); + void generate_simple_terrarin(Ref chunk, bool spawn_mobs); - BiomeBase(); - ~BiomeBase(); + BiomeTerrarinGenerator(); + ~BiomeTerrarinGenerator(); protected: static void _bind_methods(); + +private: + int _current_seed; }; #endif \ No newline at end of file diff --git a/config.py b/config.py index daf4429..10c2648 100644 --- a/config.py +++ b/config.py @@ -32,7 +32,7 @@ def configure(env): def get_doc_classes(): return [ - "BiomeBase" + "BiomeTerrarinGenerator" ] def get_doc_path(): diff --git a/register_types.cpp b/register_types.cpp index 9fc2ec8..3febb2e 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -24,10 +24,10 @@ SOFTWARE. */ -#include "biome_base.h" +#include "biome_terrarin_generator.h" void register_broken_seals_module_types() { - ClassDB::register_class(); + ClassDB::register_class(); } void unregister_broken_seals_module_types() {