Simple skeleton bingings.

This commit is contained in:
Relintai 2019-09-24 02:42:42 +02:00
parent 2b71488e6f
commit 16ae08568a
21 changed files with 240 additions and 192 deletions

12
SCsub
View File

@ -1,4 +1,16 @@
Import('env') Import('env')
env.add_source_files(env.modules_sources,"register_types.cpp") env.add_source_files(env.modules_sources,"register_types.cpp")
env.add_source_files(env.modules_sources,"main/dungeon_room.cpp")
env.add_source_files(env.modules_sources,"main/dungeon.cpp")
env.add_source_files(env.modules_sources,"main/biome.cpp")
env.add_source_files(env.modules_sources,"main/planet.cpp")
env.add_source_files(env.modules_sources,"data/dungeon_room_data.cpp")
env.add_source_files(env.modules_sources,"data/dungeon_data.cpp")
env.add_source_files(env.modules_sources,"data/biome_data.cpp")
env.add_source_files(env.modules_sources,"data/planet_data.cpp")
env.add_source_files(env.modules_sources,"world_generator.cpp")

View File

@ -1,21 +1,22 @@
#include "voxelman_prop_entry.h" #include "biome_data.h"
Transform VoxelmanPropEntry::get_transform() const { Ref<Biome> BiomeData::setup_biome(int seed) {
return _transform; if (has_method("_setup_biome")) {
} return call("_setup_biome", seed);
void VoxelmanPropEntry::set_transform(const Transform value) { }
_transform = value;
return Ref<Biome>(NULL);
} }
VoxelmanPropEntry::VoxelmanPropEntry() { BiomeData::BiomeData() {
} }
VoxelmanPropEntry::~VoxelmanPropEntry() { BiomeData::~BiomeData() {
} }
void VoxelmanPropEntry::_bind_methods() { void BiomeData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "Biome"), "_setup_biome", PropertyInfo(Variant::INT, "seed")));
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); ClassDB::bind_method(D_METHOD("setup_biome", "seed"), &BiomeData::setup_biome);
} }

View File

@ -1,28 +1,29 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef BIOME_DATA_H
#define VOXELMAN_PROP_DATA_H #define BIOME_DATA_H
#include "core/resource.h" #include "core/resource.h"
#include "core/math/transform.h"
class VoxelmanPropEntry : public Resource { #include "../main/biome.h"
GDCLASS(VoxelmanPropEntry, Resource);
class BiomeData : public Resource {
GDCLASS(BiomeData, Resource);
public: public:
Ref<Biome> setup_biome(); Ref<Biome> setup_biome(int seed);
VoxelmanPropEntry(); BiomeData();
~VoxelmanPropEntry(); ~BiomeData();
protected: protected:
static void _bind_methods(); static void _bind_methods();
private: private:
Vector2 _humidity_range; //Vector2 _humidity_range;
Vector2 _temperature_range; //Vector2 _temperature_range;
Vector<DungeonData> _dungeon_datas; //Vector<DungeonData> _dungeon_datas;
Vector<Ref<VoxelmanProp> > _props; //Vector<Ref<VoxelmanProp> > _props;
}; };
#endif #endif

View File

@ -1,21 +1,22 @@
#include "voxelman_prop_entry.h" #include "dungeon_data.h"
Transform VoxelmanPropEntry::get_transform() const { Ref<Dungeon> DungeonData::setup_dungeon(int seed) {
return _transform; if (has_method("_setup_dungeon")) {
} return call("_setup_dungeon", seed);
void VoxelmanPropEntry::set_transform(const Transform value) { }
_transform = value;
return Ref<Dungeon>(NULL);
} }
VoxelmanPropEntry::VoxelmanPropEntry() { DungeonData::DungeonData() {
} }
VoxelmanPropEntry::~VoxelmanPropEntry() { DungeonData::~DungeonData() {
} }
void VoxelmanPropEntry::_bind_methods() { void DungeonData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "Dungeon"), "_setup_dungeon", PropertyInfo(Variant::INT, "seed")));
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); ClassDB::bind_method(D_METHOD("setup_dungeon", "seed"), &DungeonData::setup_dungeon);
} }

View File

@ -1,25 +1,24 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef DUNGEON_DATA_H
#define VOXELMAN_PROP_DATA_H #define DUNGEON_DATA_H
#include "core/resource.h" #include "core/resource.h"
#include "core/math/transform.h"
class VoxelmanPropEntry : public Resource { #include "../main/dungeon.h"
GDCLASS(VoxelmanPropEntry, Resource);
class DungeonData : public Resource {
GDCLASS(DungeonData, Resource);
public: public:
Ref<Dungeon> setup_dungeon(int seed); Ref<Dungeon> setup_dungeon(int seed);
VoxelmanPropEntry(); DungeonData();
~VoxelmanPropEntry(); ~DungeonData();
protected: protected:
static void _bind_methods(); static void _bind_methods();
private: private:
//Vector<Ref<DungeonRoomData> > _rooms;
Vector<Ref<DungeonRoomData> > _rooms;
}; };
#endif #endif

View File

@ -0,0 +1,22 @@
#include "dungeon_room_data.h"
Ref<DungeonRoom> DungeonRoomData::setup_room(int seed) {
if (has_method("_setup_room")) {
return call("_setup_room", seed);
}
return Ref<DungeonRoom>(NULL);
}
DungeonRoomData::DungeonRoomData() {
}
DungeonRoomData::~DungeonRoomData() {
}
void DungeonRoomData::_bind_methods() {
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "DungeonRoom"), "_setup_room", PropertyInfo(Variant::INT, "seed")));
ClassDB::bind_method(D_METHOD("setup_room", "seed"), &DungeonRoomData::setup_room);
}

View File

@ -1,25 +1,25 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef DUNGEON_ROOM_DATA_H
#define VOXELMAN_PROP_DATA_H #define DUNGEON_ROOM_DATA_H
#include "core/resource.h" #include "core/resource.h"
#include "core/math/transform.h"
class VoxelmanPropEntry : public Resource { #include "../main/dungeon_room.h"
GDCLASS(VoxelmanPropEntry, Resource);
class DungeonRoomData : public Resource {
GDCLASS(DungeonRoomData, Resource);
public: public:
Ref<DungeonRoom> setup_room(int seed); Ref<DungeonRoom> setup_room(int seed);
VoxelmanPropEntry(); DungeonRoomData();
~VoxelmanPropEntry(); ~DungeonRoomData();
protected: protected:
static void _bind_methods(); static void _bind_methods();
private: private:
//Vector<VoxelmanProp> _props;
Vector<VoxelmanProp> _props;
}; };
#endif #endif

View File

@ -1,21 +0,0 @@
#include "voxelman_prop_entry.h"
Transform VoxelmanPropEntry::get_transform() const {
return _transform;
}
void VoxelmanPropEntry::set_transform(const Transform value) {
_transform = value;
}
VoxelmanPropEntry::VoxelmanPropEntry() {
}
VoxelmanPropEntry::~VoxelmanPropEntry() {
}
void VoxelmanPropEntry::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
}

View File

@ -1,10 +1,11 @@
#include "voxelman_prop_entry.h" #include "planet_data.h"
Transform PlanetData::get_transform() const { Ref<Planet> PlanetData::setup_planet(int seed) {
return _transform; if (has_method("_setup_planet")) {
} return call("_setup_planet", seed);
void PlanetData::set_transform(const Transform value) { }
_transform = value;
return Ref<Planet>(NULL);
} }
PlanetData::PlanetData() { PlanetData::PlanetData() {
@ -15,5 +16,7 @@ PlanetData::~PlanetData() {
} }
void PlanetData::_bind_methods() { void PlanetData::_bind_methods() {
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "biome", PROPERTY_HINT_RESOURCE_TYPE, "Planet"), "_setup_planet", PropertyInfo(Variant::INT, "seed")));
ClassDB::bind_method(D_METHOD("setup_planet", "seed"), &PlanetData::setup_planet);
} }

View File

@ -1,13 +1,15 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef PLANET_DATA_H
#define VOXELMAN_PROP_DATA_H #define PLANET_DATA_H
#include "core/resource.h" #include "core/resource.h"
#include "core/math/transform.h"
#include "../main/planet.h"
class PlanetData : public Resource { class PlanetData : public Resource {
GDCLASS(PlanetData, Resource); GDCLASS(PlanetData, Resource);
public: public:
/*
Ref<PlanetData> get_planet_data(const int index) const; Ref<PlanetData> get_planet_data(const int index) const;
void set_planet_data(const int index, const Ref<PlanetData> planet_data); void set_planet_data(const int index, const Ref<PlanetData> planet_data);
void add_planet_data(const Ref<PlanetData> planet_data); void add_planet_data(const Ref<PlanetData> planet_data);
@ -17,6 +19,7 @@ public:
Vector<Variant> get_planet_datas(); Vector<Variant> get_planet_datas();
void set_planet_datas(const Vector<Variant> &planet_datas); void set_planet_datas(const Vector<Variant> &planet_datas);
*/
Ref<Planet> setup_planet(int seed); Ref<Planet> setup_planet(int seed);
@ -28,10 +31,10 @@ protected:
private: private:
int _id; //int _id;
Vector<BiomeData> _biome_datas; //Vector<BiomeData> _biome_datas;
Ref<NoiseParams> _humidity_noise_params; //Ref<NoiseParams> _humidity_noise_params;
Ref<NoiseParams> _temperature_noise_params; //Ref<NoiseParams> _temperature_noise_params;
}; };
#endif #endif

View File

@ -1,21 +1,27 @@
#include "voxelman_prop_entry.h" #include "biome.h"
Transform VoxelmanPropEntry::get_transform() const { void Biome::generate_chunk(Ref<VoxelChunk> chunk) {
return _transform; if (has_method("_generate")) {
call("_generate", chunk);
}
} }
void VoxelmanPropEntry::set_transform(const Transform value) { void Biome::generate_stack(Ref<VoxelChunk> chunk, int x, int z) {
_transform = value; if (has_method("_generate")) {
call("_generate", chunk, x, z);
}
} }
VoxelmanPropEntry::VoxelmanPropEntry() { Biome::Biome() {
} }
VoxelmanPropEntry::~VoxelmanPropEntry() { Biome::~Biome() {
} }
void VoxelmanPropEntry::_bind_methods() { void Biome::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform); BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform); BIND_VMETHOD(MethodInfo("_generate_stack", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "z")));
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Biome::generate_chunk);
ClassDB::bind_method(D_METHOD("generate_stack", "chunk", "x", "z"), &Biome::generate_stack);
} }

View File

@ -1,27 +1,26 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef BIOME_H
#define VOXELMAN_PROP_DATA_H #define BIOME_H
#include "core/resource.h" #include "core/resource.h"
#include "core/math/transform.h"
class VoxelmanPropEntry : public Resource { #include "../../voxelman/world/voxel_chunk.h"
GDCLASS(VoxelmanPropEntry, Resource);
class Biome : public Resource {
GDCLASS(Biome, Resource);
public: public:
void generate_chunk(Ref<VoxelChunk> chunk); void generate_chunk(Ref<VoxelChunk> chunk);
void generate_stack(int x, int z, Ref<VoxelChunk> chunk); void generate_stack(Ref<VoxelChunk> chunk, int x, int z);
VoxelmanPropEntry(); Biome();
~VoxelmanPropEntry(); ~Biome();
protected: protected:
static void _bind_methods(); static void _bind_methods();
private: private:
//Vector<Ref<VoxelmanProp> > _props;
Vector<Ref<VoxelmanProp> > _props; //Vector<Ref<Dungeon> > _dungeons;
Vector<Ref<Dungeon> > _dungeons;
}; };
#endif #endif

View File

@ -1,21 +1,20 @@
#include "voxelman_prop_entry.h" #include "dungeon.h"
Transform VoxelmanPropEntry::get_transform() const { void Dungeon::generate(Ref<VoxelStructure> structure) {
return _transform; if (has_method("_generate")) {
} call("_generate", structure);
void VoxelmanPropEntry::set_transform(const Transform value) { }
_transform = value;
} }
VoxelmanPropEntry::VoxelmanPropEntry() { Dungeon::Dungeon() {
} }
VoxelmanPropEntry::~VoxelmanPropEntry() { Dungeon::~Dungeon() {
} }
void VoxelmanPropEntry::_bind_methods() { void Dungeon::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform); BIND_VMETHOD(MethodInfo("_generate", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure")));
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); ClassDB::bind_method(D_METHOD("generate", "structure"), &Dungeon::generate);
} }

View File

@ -1,25 +1,26 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef DUNGEON_H
#define VOXELMAN_PROP_DATA_H #define DUNGEON_H
#include "core/resource.h" #include "core/resource.h"
#include "core/math/transform.h"
class VoxelmanPropEntry : public Resource { #include "../../voxelman/world/voxel_structure.h"
GDCLASS(VoxelmanPropEntry, Resource);
class Dungeon : public Reference {
GDCLASS(Dungeon, Reference);
public: public:
Ref<VoxelmanStructure> generate_dungeon(); void generate(Ref<VoxelStructure> structure);
VoxelmanPropEntry(); Dungeon();
~VoxelmanPropEntry(); ~Dungeon();
protected: protected:
static void _bind_methods(); static void _bind_methods();
private: private:
Vector<Ref<DungeonRoopm> > _rooms; //Vector<Ref<DungeonRoopm> > _rooms;
}; };
#endif #endif

View File

@ -1,21 +1,20 @@
#include "voxelman_prop_entry.h" #include "dungeon_room.h"
Transform VoxelmanPropEntry::get_transform() const { void DungeonRoom::generate_room(Ref<VoxelStructure> structure) {
return _transform; if (has_method("_generate_room")) {
} call("_generate_room", structure);
void VoxelmanPropEntry::set_transform(const Transform value) { }
_transform = value;
} }
VoxelmanPropEntry::VoxelmanPropEntry() { DungeonRoom::DungeonRoom() {
} }
VoxelmanPropEntry::~VoxelmanPropEntry() { DungeonRoom::~DungeonRoom() {
} }
void VoxelmanPropEntry::_bind_methods() { void DungeonRoom::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform); BIND_VMETHOD(MethodInfo("_generate_room", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure")));
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); ClassDB::bind_method(D_METHOD("generate_room", "structure"), &DungeonRoom::generate_room);
} }

View File

@ -1,26 +1,26 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef DUNGEON_ROOM_H
#define VOXELMAN_PROP_DATA_H #define DUNGEON_ROOM_H
#include "core/resource.h" #include "core/reference.h"
#include "core/math/transform.h"
class VoxelmanPropEntry : public Resource { #include "../../voxelman/world/voxel_structure.h"
GDCLASS(VoxelmanPropEntry, Resource);
class DungeonRoom : public Reference {
GDCLASS(DungeonRoom, Reference);
public: public:
void write_room(Ref<VoxelmanStructure> structure, Vector3i position, Vector3i size); void generate_room(Ref<VoxelStructure> structure);
void generate_room(Ref<VoxelmanStructure> structure);
VoxelmanPropEntry(); DungeonRoom();
~VoxelmanPropEntry(); ~DungeonRoom();
protected: protected:
static void _bind_methods(); static void _bind_methods();
private: private:
Vector<Ref<VoxelmanProp> > _props; //Vector<Ref<VoxelmanProp> > _props;
}; };
#endif #endif

View File

@ -1,21 +1,20 @@
#include "voxelman_prop_entry.h" #include "planet.h"
Transform VoxelmanPropEntry::get_transform() const { void Planet::generate_chunk(Ref<VoxelChunk> chunk) {
return _transform; if (has_method("_generate_chunk")) {
} call("_generate_chunk", chunk);
void VoxelmanPropEntry::set_transform(const Transform value) { }
_transform = value;
} }
VoxelmanPropEntry::VoxelmanPropEntry() { Planet::Planet() {
} }
VoxelmanPropEntry::~VoxelmanPropEntry() { Planet::~Planet() {
} }
void VoxelmanPropEntry::_bind_methods() { void Planet::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform); BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk);
} }

View File

@ -1,25 +1,24 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef PLANET_H
#define VOXELMAN_PROP_DATA_H #define PLANET_H
#include "core/resource.h" #include "core/resource.h"
#include "core/math/transform.h"
class VoxelmanPropEntry : public Resource { #include "../../voxelman/world/voxel_chunk.h"
GDCLASS(VoxelmanPropEntry, Resource);
class Planet : public Resource {
GDCLASS(Planet, Resource);
public: public:
void generate_chunk(Ref<VoxelChunk> chunk); void generate_chunk(Ref<VoxelChunk> chunk);
VoxelmanPropEntry(); Planet();
~VoxelmanPropEntry(); ~Planet();
protected: protected:
static void _bind_methods(); static void _bind_methods();
private: private:
//Vector<Ref<Biome> > _biomes;
Vector<Ref<Biome> > _biomes;
}; };
#endif #endif

View File

@ -1,7 +1,29 @@
#include "register_types.h" #include "register_types.h"
#include "data/dungeon_room_data.h"
#include "data/dungeon_data.h"
#include "data/biome_data.h"
#include "data/planet_data.h"
#include "main/dungeon_room.h"
#include "main/dungeon.h"
#include "main/biome.h"
#include "main/planet.h"
#include "world_generator.h"
void register_world_generator_types() { void register_world_generator_types() {
//ClassDB::register_class<BSInputModifier>(); ClassDB::register_class<DungeonRoomData>();
ClassDB::register_class<DungeonData>();
ClassDB::register_class<BiomeData>();
ClassDB::register_class<PlanetData>();
ClassDB::register_class<DungeonRoom>();
ClassDB::register_class<Dungeon>();
ClassDB::register_class<Biome>();
ClassDB::register_class<Planet>();
ClassDB::register_class<WorldGenerator>();
} }
void unregister_world_generator_types() { void unregister_world_generator_types() {

View File

@ -39,7 +39,7 @@ void WorldGenerator::set_planet_datas(const Vector<Variant> &planet_datas) {
} }
} }
Ref<Planet> WorldGenerator::setup_planet() { Ref<Planet> WorldGenerator::setup_planet(int seed) {
if (has_method("_setup_planet")) { if (has_method("_setup_planet")) {
return call("_setup_planet"); return call("_setup_planet");
} }
@ -55,16 +55,18 @@ WorldGenerator::~WorldGenerator() {
} }
void WorldGenerator::_bind_methods() { void WorldGenerator::_bind_methods() {
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "planet", PROPERTY_HINT_RESOURCE_TYPE, "Planet") , "_setup_planet")); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "planet", PROPERTY_HINT_RESOURCE_TYPE, "Planet"), "_setup_planet", PropertyInfo(Variant::INT, "seed")));
ClassDB::bind_method(D_METHOD("get_planet_data", "index"), &VoxelmanProp::get_planet_data); ClassDB::bind_method(D_METHOD("setup_planet", "seed"), &WorldGenerator::setup_planet);
ClassDB::bind_method(D_METHOD("set_planet_data", "index", "data"), &VoxelmanProp::set_planet_data);
ClassDB::bind_method(D_METHOD("add_planet_data", "planet_data"), &VoxelmanProp::add_planet_data);
ClassDB::bind_method(D_METHOD("remove_planet_data", "index"), &VoxelmanProp::remove_planet_data);
ClassDB::bind_method(D_METHOD("get_planet_data_count"), &VoxelmanProp::get_planet_data_count); ClassDB::bind_method(D_METHOD("get_planet_data", "index"), &WorldGenerator::get_planet_data);
ClassDB::bind_method(D_METHOD("set_planet_data", "index", "data"), &WorldGenerator::set_planet_data);
ClassDB::bind_method(D_METHOD("add_planet_data", "planet_data"), &WorldGenerator::add_planet_data);
ClassDB::bind_method(D_METHOD("remove_planet_data", "index"), &WorldGenerator::remove_planet_data);
ClassDB::bind_method(D_METHOD("get_planet_datas"), &VoxelmanProp::get_planet_datas); ClassDB::bind_method(D_METHOD("get_planet_data_count"), &WorldGenerator::get_planet_data_count);
ClassDB::bind_method(D_METHOD("set_planet_datas", "planet_datas"), &VoxelmanProp::set_planet_datas);
ClassDB::bind_method(D_METHOD("get_planet_datas"), &WorldGenerator::get_planet_datas);
ClassDB::bind_method(D_METHOD("set_planet_datas", "planet_datas"), &WorldGenerator::set_planet_datas);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "planet_datas", PROPERTY_HINT_NONE, "17/17:PlanetData", PROPERTY_USAGE_DEFAULT, "PlanetData"), "set_planet_datas", "get_planet_datas"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "planet_datas", PROPERTY_HINT_NONE, "17/17:PlanetData", PROPERTY_USAGE_DEFAULT, "PlanetData"), "set_planet_datas", "get_planet_datas");
} }

View File

@ -4,8 +4,9 @@
#include "core/resource.h" #include "core/resource.h"
#include "core/vector.h" #include "core/vector.h"
#include "planet_data.h" #include "data/planet_data.h"
#include "../main/planet.h"
#include "main/planet.h"
class WorldGenerator : public Resource { class WorldGenerator : public Resource {
@ -22,7 +23,7 @@ public:
Vector<Variant> get_planet_datas(); Vector<Variant> get_planet_datas();
void set_planet_datas(const Vector<Variant> &planet_datas); void set_planet_datas(const Vector<Variant> &planet_datas);
Ref<Planet> setup_planet(); Ref<Planet> setup_planet(int seed);
WorldGenerator(); WorldGenerator();
~WorldGenerator(); ~WorldGenerator();
@ -32,7 +33,7 @@ protected:
private: private:
Vector<PlanetData> _planet_datas; Vector<Ref<PlanetData> > _planet_datas;
}; };
#endif #endif