mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-27 15:19:18 +01:00
More work on the generator interface.
This commit is contained in:
parent
ca1740ee04
commit
c4432b4c2b
@ -183,6 +183,45 @@ void BiomeData::set_environment_datas(const Vector<Variant> &environment_datas)
|
||||
}
|
||||
}
|
||||
|
||||
//// Surfaces ////
|
||||
Ref<VoxelSurface> BiomeData::get_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return _voxel_surfaces.get(index);
|
||||
}
|
||||
void BiomeData::set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface) {
|
||||
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.set(index, voxel_surface);
|
||||
}
|
||||
void BiomeData::add_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
||||
_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
void BiomeData::remove_voxel_surface(const int index) {
|
||||
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.remove(index);
|
||||
}
|
||||
int BiomeData::get_voxel_surface_count() const {
|
||||
return _voxel_surfaces.size();
|
||||
}
|
||||
|
||||
Vector<Variant> BiomeData::get_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _voxel_surfaces.size(); i++) {
|
||||
r.push_back(_voxel_surfaces[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void BiomeData::set_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
||||
_voxel_surfaces.clear();
|
||||
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||
|
||||
_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
}
|
||||
|
||||
BiomeData::BiomeData() {
|
||||
|
||||
}
|
||||
@ -210,7 +249,6 @@ void BiomeData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_data", "index", "data"), &BiomeData::set_dungeon_data);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon_data", "dungeon_data"), &BiomeData::add_dungeon_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_data", "index"), &BiomeData::remove_dungeon_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_data_count"), &BiomeData::get_dungeon_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_datas"), &BiomeData::get_dungeon_datas);
|
||||
@ -222,7 +260,6 @@ void BiomeData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_prop_data", "index", "data"), &BiomeData::set_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("add_prop_data", "prop_data"), &BiomeData::add_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_prop_data", "index"), &BiomeData::remove_prop_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data_count"), &BiomeData::get_prop_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_prop_datas"), &BiomeData::get_prop_datas);
|
||||
@ -234,7 +271,6 @@ void BiomeData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &BiomeData::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &BiomeData::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &BiomeData::remove_entity_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &BiomeData::get_entity_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_datas"), &BiomeData::get_entity_datas);
|
||||
@ -246,10 +282,20 @@ void BiomeData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &BiomeData::set_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("add_environment_data", "environment_data"), &BiomeData::add_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_environment_data", "index"), &BiomeData::remove_environment_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data_count"), &BiomeData::get_environment_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment_datas"), &BiomeData::get_environment_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_environment_datas", "environment_datas"), &BiomeData::set_environment_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "environment_datas", PROPERTY_HINT_NONE, "17/17:EnvironmentData", PROPERTY_USAGE_DEFAULT, "EnvironmentData"), "set_environment_datas", "get_environment_datas");
|
||||
|
||||
//Surfaces
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surface", "index"), &BiomeData::get_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_surface", "index", "data"), &BiomeData::set_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("add_voxel_surface", "voxel_surface"), &BiomeData::add_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("remove_voxel_surface", "index"), &BiomeData::remove_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surface_count"), &BiomeData::get_voxel_surface_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &BiomeData::get_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &BiomeData::set_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_voxel_surfaces", "get_voxel_surfaces");
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "world_generator_prop_data.h"
|
||||
#include "../../world/environment_data.h"
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
|
||||
class BiomeData : public Resource {
|
||||
GDCLASS(BiomeData, Resource);
|
||||
@ -40,7 +41,6 @@ public:
|
||||
void set_prop_data(const int index, const Ref<WorldGeneratorPropData> prop_data);
|
||||
void add_prop_data(const Ref<WorldGeneratorPropData> prop_data);
|
||||
void remove_prop_data(const int index);
|
||||
|
||||
int get_prop_data_count() const;
|
||||
|
||||
Vector<Variant> get_prop_datas();
|
||||
@ -51,7 +51,6 @@ public:
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
void add_entity_data(const Ref<EntityData> entity_data);
|
||||
void remove_entity_data(const int index);
|
||||
|
||||
int get_entity_data_count() const;
|
||||
|
||||
Vector<Variant> get_entity_datas();
|
||||
@ -62,12 +61,21 @@ public:
|
||||
void set_environment_data(const int index, const Ref<EnvironmentData> environment_data);
|
||||
void add_environment_data(const Ref<EnvironmentData> environment_data);
|
||||
void remove_environment_data(const int index);
|
||||
|
||||
int get_environment_data_count() const;
|
||||
|
||||
Vector<Variant> get_environment_datas();
|
||||
void set_environment_datas(const Vector<Variant> &environment_datas);
|
||||
|
||||
//Surfaces
|
||||
Ref<VoxelSurface> get_voxel_surface(const int index) const;
|
||||
void set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
void add_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||
void remove_voxel_surface(const int index);
|
||||
int get_voxel_surface_count() const;
|
||||
|
||||
Vector<Variant> get_voxel_surfaces();
|
||||
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
|
||||
BiomeData();
|
||||
~BiomeData();
|
||||
|
||||
@ -84,6 +92,7 @@ private:
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -244,7 +244,6 @@ void DungeonData::remove_entity_data(const int index) {
|
||||
|
||||
_entity_datas.remove(index);
|
||||
}
|
||||
|
||||
int DungeonData::get_entity_data_count() const {
|
||||
return _entity_datas.size();
|
||||
}
|
||||
@ -265,6 +264,44 @@ void DungeonData::set_entity_datas(const Vector<Variant> &entity_datas) {
|
||||
}
|
||||
}
|
||||
|
||||
//// Surfaces ////
|
||||
Ref<VoxelSurface> DungeonData::get_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return _voxel_surfaces.get(index);
|
||||
}
|
||||
void DungeonData::set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface) {
|
||||
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.set(index, voxel_surface);
|
||||
}
|
||||
void DungeonData::add_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
||||
_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
void DungeonData::remove_voxel_surface(const int index) {
|
||||
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.remove(index);
|
||||
}
|
||||
int DungeonData::get_voxel_surface_count() const {
|
||||
return _voxel_surfaces.size();
|
||||
}
|
||||
|
||||
Vector<Variant> DungeonData::get_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _voxel_surfaces.size(); i++) {
|
||||
r.push_back(_voxel_surfaces[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void DungeonData::set_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
||||
_voxel_surfaces.clear();
|
||||
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||
|
||||
_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
}
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> DungeonData::get_environment_data(const int index) const {
|
||||
@ -372,7 +409,6 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_room_data", "index", "data"), &DungeonData::set_dungeon_room_data);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon_room_data", "dungeon_room_data"), &DungeonData::add_dungeon_room_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_room_data", "index"), &DungeonData::remove_dungeon_room_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_room_data_count"), &DungeonData::get_dungeon_room_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_room_datas"), &DungeonData::get_dungeon_room_datas);
|
||||
@ -384,7 +420,6 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_start_room_data", "index", "data"), &DungeonData::set_dungeon_start_room_data);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon_start_room_data", "dungeon_start_room_data"), &DungeonData::add_dungeon_start_room_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_start_room_data", "index"), &DungeonData::remove_dungeon_start_room_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_start_room_data_count"), &DungeonData::get_dungeon_start_room_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_start_room_datas"), &DungeonData::get_dungeon_start_room_datas);
|
||||
@ -396,7 +431,6 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_end_room_data", "index", "data"), &DungeonData::set_dungeon_end_room_data);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon_end_room_data", "dungeon_end_room_data"), &DungeonData::add_dungeon_end_room_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_end_room_data", "index"), &DungeonData::remove_dungeon_end_room_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_end_room_data_count"), &DungeonData::get_dungeon_end_room_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_end_room_datas"), &DungeonData::get_dungeon_end_room_datas);
|
||||
@ -408,7 +442,6 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_corridor_data", "index", "data"), &DungeonData::set_dungeon_corridor_data);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon_corridor_data", "dungeon_corridor_data"), &DungeonData::add_dungeon_corridor_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_corridor_data", "index"), &DungeonData::remove_dungeon_corridor_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_corridor_data_count"), &DungeonData::get_dungeon_corridor_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_corridor_datas"), &DungeonData::get_dungeon_corridor_datas);
|
||||
@ -420,7 +453,6 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &DungeonData::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &DungeonData::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &DungeonData::remove_entity_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &DungeonData::get_entity_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_datas"), &DungeonData::get_entity_datas);
|
||||
@ -432,10 +464,20 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &DungeonData::set_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("add_environment_data", "environment_data"), &DungeonData::add_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_environment_data", "index"), &DungeonData::remove_environment_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data_count"), &DungeonData::get_environment_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment_datas"), &DungeonData::get_environment_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_environment_datas", "environment_datas"), &DungeonData::set_environment_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "environment_datas", PROPERTY_HINT_NONE, "17/17:EnvironmentData", PROPERTY_USAGE_DEFAULT, "EnvironmentData"), "set_environment_datas", "get_environment_datas");
|
||||
|
||||
//Surfaces
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surface", "index"), &DungeonData::get_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_surface", "index", "data"), &DungeonData::set_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("add_voxel_surface", "voxel_surface"), &DungeonData::add_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("remove_voxel_surface", "index"), &DungeonData::remove_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surface_count"), &DungeonData::get_voxel_surface_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &DungeonData::get_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &DungeonData::set_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_voxel_surfaces", "get_voxel_surfaces");
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "../../world/environment_data.h"
|
||||
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
|
||||
class DungeonData : public Resource {
|
||||
GDCLASS(DungeonData, Resource);
|
||||
@ -50,7 +51,6 @@ public:
|
||||
void set_environment_data(const int index, const Ref<EnvironmentData> environment_data);
|
||||
void add_environment_data(const Ref<EnvironmentData> environment_data);
|
||||
void remove_environment_data(const int index);
|
||||
|
||||
int get_environment_data_count() const;
|
||||
|
||||
Vector<Variant> get_environment_datas();
|
||||
@ -61,7 +61,6 @@ public:
|
||||
void set_dungeon_room_data(const int index, const Ref<DungeonRoomData> dungeon_room_data);
|
||||
void add_dungeon_room_data(const Ref<DungeonRoomData> dungeon_room_data);
|
||||
void remove_dungeon_room_data(const int index);
|
||||
|
||||
int get_dungeon_room_data_count() const;
|
||||
|
||||
Vector<Variant> get_dungeon_room_datas();
|
||||
@ -72,7 +71,6 @@ public:
|
||||
void set_dungeon_start_room_data(const int index, const Ref<DungeonRoomData> dungeon_start_room_data);
|
||||
void add_dungeon_start_room_data(const Ref<DungeonRoomData> dungeon_start_room_data);
|
||||
void remove_dungeon_start_room_data(const int index);
|
||||
|
||||
int get_dungeon_start_room_data_count() const;
|
||||
|
||||
Vector<Variant> get_dungeon_start_room_datas();
|
||||
@ -83,7 +81,6 @@ public:
|
||||
void set_dungeon_end_room_data(const int index, const Ref<DungeonRoomData> dungeon_end_room_data);
|
||||
void add_dungeon_end_room_data(const Ref<DungeonRoomData> dungeon_end_room_data);
|
||||
void remove_dungeon_end_room_data(const int index);
|
||||
|
||||
int get_dungeon_end_room_data_count() const;
|
||||
|
||||
Vector<Variant> get_dungeon_end_room_datas();
|
||||
@ -94,7 +91,6 @@ public:
|
||||
void set_dungeon_corridor_data(const int index, const Ref<DungeonRoomData> dungeon_corridor_data);
|
||||
void add_dungeon_corridor_data(const Ref<DungeonRoomData> dungeon_corridor_data);
|
||||
void remove_dungeon_corridor_data(const int index);
|
||||
|
||||
int get_dungeon_corridor_data_count() const;
|
||||
|
||||
Vector<Variant> get_dungeon_corridor_datas();
|
||||
@ -105,12 +101,21 @@ public:
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
void add_entity_data(const Ref<EntityData> entity_data);
|
||||
void remove_entity_data(const int index);
|
||||
|
||||
int get_entity_data_count() const;
|
||||
|
||||
Vector<Variant> get_entity_datas();
|
||||
void set_entity_datas(const Vector<Variant> &entity_datas);
|
||||
|
||||
//Surfaces
|
||||
Ref<VoxelSurface> get_voxel_surface(const int index) const;
|
||||
void set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
void add_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||
void remove_voxel_surface(const int index);
|
||||
int get_voxel_surface_count() const;
|
||||
|
||||
Vector<Variant> get_voxel_surfaces();
|
||||
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
|
||||
DungeonData();
|
||||
~DungeonData();
|
||||
|
||||
@ -138,6 +143,7 @@ private:
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_end_room_datas;
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_corridor_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -168,6 +168,45 @@ void DungeonRoomData::set_entity_datas(const Vector<Variant> &entity_datas) {
|
||||
}
|
||||
}
|
||||
|
||||
//// Surfaces ////
|
||||
Ref<VoxelSurface> DungeonRoomData::get_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return _voxel_surfaces.get(index);
|
||||
}
|
||||
void DungeonRoomData::set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface) {
|
||||
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.set(index, voxel_surface);
|
||||
}
|
||||
void DungeonRoomData::add_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
||||
_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
void DungeonRoomData::remove_voxel_surface(const int index) {
|
||||
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.remove(index);
|
||||
}
|
||||
int DungeonRoomData::get_voxel_surface_count() const {
|
||||
return _voxel_surfaces.size();
|
||||
}
|
||||
|
||||
Vector<Variant> DungeonRoomData::get_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _voxel_surfaces.size(); i++) {
|
||||
r.push_back(_voxel_surfaces[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void DungeonRoomData::set_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
||||
_voxel_surfaces.clear();
|
||||
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||
|
||||
_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
}
|
||||
|
||||
DungeonRoomData::DungeonRoomData() {
|
||||
_min_sizex = 0;
|
||||
_min_sizey = 0;
|
||||
@ -217,7 +256,6 @@ void DungeonRoomData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_prop_data", "index", "data"), &DungeonRoomData::set_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("add_prop_data", "prop_data"), &DungeonRoomData::add_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_prop_data", "index"), &DungeonRoomData::remove_prop_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data_count"), &DungeonRoomData::get_prop_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_prop_datas"), &DungeonRoomData::get_prop_datas);
|
||||
@ -229,7 +267,6 @@ void DungeonRoomData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &DungeonRoomData::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &DungeonRoomData::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &DungeonRoomData::remove_entity_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &DungeonRoomData::get_entity_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_datas"), &DungeonRoomData::get_entity_datas);
|
||||
@ -241,10 +278,20 @@ void DungeonRoomData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &DungeonRoomData::set_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("add_environment_data", "environment_data"), &DungeonRoomData::add_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_environment_data", "index"), &DungeonRoomData::remove_environment_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data_count"), &DungeonRoomData::get_environment_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment_datas"), &DungeonRoomData::get_environment_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_environment_datas", "environment_datas"), &DungeonRoomData::set_environment_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "environment_datas", PROPERTY_HINT_NONE, "17/17:EnvironmentData", PROPERTY_USAGE_DEFAULT, "EnvironmentData"), "set_environment_datas", "get_environment_datas");
|
||||
|
||||
//Surfaces
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surface", "index"), &DungeonRoomData::get_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_surface", "index", "data"), &DungeonRoomData::set_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("add_voxel_surface", "voxel_surface"), &DungeonRoomData::add_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("remove_voxel_surface", "index"), &DungeonRoomData::remove_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surface_count"), &DungeonRoomData::get_voxel_surface_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &DungeonRoomData::get_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &DungeonRoomData::set_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_voxel_surfaces", "get_voxel_surfaces");
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "../../world/environment_data.h"
|
||||
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
|
||||
class DungeonRoomData : public Resource {
|
||||
GDCLASS(DungeonRoomData, Resource);
|
||||
@ -41,7 +42,6 @@ public:
|
||||
void set_prop_data(const int index, const Ref<WorldGeneratorPropData> prop_data);
|
||||
void add_prop_data(const Ref<WorldGeneratorPropData> prop_data);
|
||||
void remove_prop_data(const int index);
|
||||
|
||||
int get_prop_data_count() const;
|
||||
|
||||
Vector<Variant> get_prop_datas();
|
||||
@ -52,7 +52,6 @@ public:
|
||||
void set_environment_data(const int index, const Ref<EnvironmentData> environment_data);
|
||||
void add_environment_data(const Ref<EnvironmentData> environment_data);
|
||||
void remove_environment_data(const int index);
|
||||
|
||||
int get_environment_data_count() const;
|
||||
|
||||
Vector<Variant> get_environment_datas();
|
||||
@ -63,12 +62,21 @@ public:
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
void add_entity_data(const Ref<EntityData> entity_data);
|
||||
void remove_entity_data(const int index);
|
||||
|
||||
int get_entity_data_count() const;
|
||||
|
||||
Vector<Variant> get_entity_datas();
|
||||
void set_entity_datas(const Vector<Variant> &entity_datas);
|
||||
|
||||
//Surfaces
|
||||
Ref<VoxelSurface> get_voxel_surface(const int index) const;
|
||||
void set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
void add_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||
void remove_voxel_surface(const int index);
|
||||
int get_voxel_surface_count() const;
|
||||
|
||||
Vector<Variant> get_voxel_surfaces();
|
||||
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
|
||||
DungeonRoomData();
|
||||
~DungeonRoomData();
|
||||
|
||||
@ -89,6 +97,7 @@ private:
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -106,6 +106,46 @@ void PlanetData::set_environment_datas(const Vector<Variant> &environment_datas)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// Surfaces ////
|
||||
Ref<VoxelSurface> PlanetData::get_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return _voxel_surfaces.get(index);
|
||||
}
|
||||
void PlanetData::set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface) {
|
||||
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.set(index, voxel_surface);
|
||||
}
|
||||
void PlanetData::add_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
||||
_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
void PlanetData::remove_voxel_surface(const int index) {
|
||||
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.remove(index);
|
||||
}
|
||||
int PlanetData::get_voxel_surface_count() const {
|
||||
return _voxel_surfaces.size();
|
||||
}
|
||||
|
||||
Vector<Variant> PlanetData::get_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _voxel_surfaces.size(); i++) {
|
||||
r.push_back(_voxel_surfaces[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void PlanetData::set_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
||||
_voxel_surfaces.clear();
|
||||
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||
|
||||
_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
}
|
||||
|
||||
PlanetData::PlanetData() {
|
||||
_id = 0;
|
||||
}
|
||||
@ -130,12 +170,11 @@ void PlanetData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_temperature_noise_params", "value"), &PlanetData::set_temperature_noise_params);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "temperature_noise_params", PROPERTY_HINT_RESOURCE_TYPE, "FastnoiseNoiseParams"), "set_temperature_noise_params", "get_temperature_noise_params");
|
||||
|
||||
|
||||
//Biomes
|
||||
ClassDB::bind_method(D_METHOD("get_biome_data", "index"), &PlanetData::get_biome_data);
|
||||
ClassDB::bind_method(D_METHOD("set_biome_data", "index", "data"), &PlanetData::set_biome_data);
|
||||
ClassDB::bind_method(D_METHOD("add_biome_data", "biome_data"), &PlanetData::add_biome_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_biome_data", "index"), &PlanetData::remove_biome_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_biome_data_count"), &PlanetData::get_biome_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_biome_datas"), &PlanetData::get_biome_datas);
|
||||
@ -147,10 +186,20 @@ void PlanetData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &PlanetData::set_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("add_environment_data", "environment_data"), &PlanetData::add_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_environment_data", "index"), &PlanetData::remove_environment_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data_count"), &PlanetData::get_environment_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment_datas"), &PlanetData::get_environment_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_environment_datas", "environment_datas"), &PlanetData::set_environment_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "environment_datas", PROPERTY_HINT_NONE, "17/17:EnvironmentData", PROPERTY_USAGE_DEFAULT, "EnvironmentData"), "set_environment_datas", "get_environment_datas");
|
||||
|
||||
//Surfaces
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surface", "index"), &PlanetData::get_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_surface", "index", "data"), &PlanetData::set_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("add_voxel_surface", "voxel_surface"), &PlanetData::add_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("remove_voxel_surface", "index"), &PlanetData::remove_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surface_count"), &PlanetData::get_voxel_surface_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &PlanetData::get_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &PlanetData::set_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_voxel_surfaces", "get_voxel_surfaces");
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "../main/planet.h"
|
||||
#include "../data/biome_data.h"
|
||||
#include "../../world/environment_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
|
||||
class PlanetData : public Resource {
|
||||
GDCLASS(PlanetData, Resource);
|
||||
@ -30,7 +31,6 @@ public:
|
||||
void set_biome_data(const int index, const Ref<BiomeData> biome_data);
|
||||
void add_biome_data(const Ref<BiomeData> biome_data);
|
||||
void remove_biome_data(const int index);
|
||||
|
||||
int get_biome_data_count() const;
|
||||
|
||||
Vector<Variant> get_biome_datas();
|
||||
@ -41,12 +41,21 @@ public:
|
||||
void set_environment_data(const int index, const Ref<EnvironmentData> environment_data);
|
||||
void add_environment_data(const Ref<EnvironmentData> environment_data);
|
||||
void remove_environment_data(const int index);
|
||||
|
||||
int get_environment_data_count() const;
|
||||
|
||||
Vector<Variant> get_environment_datas();
|
||||
void set_environment_datas(const Vector<Variant> &environment_datas);
|
||||
|
||||
//Surfaces
|
||||
Ref<VoxelSurface> get_voxel_surface(const int index) const;
|
||||
void set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
void add_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||
void remove_voxel_surface(const int index);
|
||||
int get_voxel_surface_count() const;
|
||||
|
||||
Vector<Variant> get_voxel_surfaces();
|
||||
void set_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
|
||||
PlanetData();
|
||||
~PlanetData();
|
||||
|
||||
@ -62,6 +71,7 @@ private:
|
||||
Ref<FastnoiseNoiseParams> _temperature_noise_params;
|
||||
Vector<Ref<BiomeData> > _biome_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -66,7 +66,6 @@ void Biome::remove_entity_data(const int index) {
|
||||
|
||||
_entity_datas.remove(index);
|
||||
}
|
||||
|
||||
int Biome::get_entity_data_count() const {
|
||||
return _entity_datas.size();
|
||||
}
|
||||
@ -90,12 +89,10 @@ void Biome::remove_dungeon(const int index) {
|
||||
|
||||
_dungeons.remove(index);
|
||||
}
|
||||
|
||||
int Biome::get_dungeon_count() const {
|
||||
return _dungeons.size();
|
||||
}
|
||||
|
||||
|
||||
void Biome::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -123,6 +120,12 @@ void Biome::setup() {
|
||||
}
|
||||
}
|
||||
|
||||
void Biome::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
Biome::Biome() {
|
||||
|
||||
}
|
||||
@ -135,10 +138,12 @@ Biome::~Biome() {
|
||||
|
||||
void Biome::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup"));
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_stack", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "z"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Biome::setup);
|
||||
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);
|
||||
|
||||
@ -159,7 +164,6 @@ void Biome::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_prop_data", "index", "data"), &Biome::set_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("add_prop_data", "prop_data"), &Biome::add_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_prop_data", "index"), &Biome::remove_prop_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data_count"), &Biome::get_prop_data_count);
|
||||
|
||||
//Entities
|
||||
@ -167,7 +171,6 @@ void Biome::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &Biome::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &Biome::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &Biome::remove_entity_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &Biome::get_entity_data_count);
|
||||
|
||||
//Dungeons
|
||||
@ -175,6 +178,5 @@ void Biome::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon", "index", "data"), &Biome::set_dungeon);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon", "dungeon"), &Biome::add_dungeon);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon", "index"), &Biome::remove_dungeon);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_count"), &Biome::get_dungeon_count);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
|
||||
#include "../data/biome_data.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
class BiomeData;
|
||||
|
||||
@ -40,7 +41,6 @@ public:
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
void add_entity_data(const Ref<EntityData> entity_data);
|
||||
void remove_entity_data(const int index);
|
||||
|
||||
int get_entity_data_count() const;
|
||||
|
||||
//Dungeons
|
||||
@ -48,7 +48,6 @@ public:
|
||||
void set_dungeon(const int index, const Ref<Dungeon> dungeon);
|
||||
void add_dungeon(const Ref<Dungeon> dungeon);
|
||||
void remove_dungeon(const int index);
|
||||
|
||||
int get_dungeon_count() const;
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
@ -57,6 +56,7 @@ public:
|
||||
void generate_stack_bind(Node *chunk, int x, int z, bool spawn_mobs);
|
||||
|
||||
void setup();
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
Biome();
|
||||
~Biome();
|
||||
|
@ -172,7 +172,6 @@ void Dungeon::remove_dungeon_corridor(const int index) {
|
||||
|
||||
_dungeon_corridors.remove(index);
|
||||
}
|
||||
|
||||
int Dungeon::get_dungeon_corridor_count() const {
|
||||
return _dungeon_corridors.size();
|
||||
}
|
||||
@ -196,18 +195,22 @@ void Dungeon::remove_entity_data(const int index) {
|
||||
|
||||
_entity_datas.remove(index);
|
||||
}
|
||||
|
||||
int Dungeon::get_entity_data_count() const {
|
||||
return _entity_datas.size();
|
||||
}
|
||||
|
||||
|
||||
void Dungeon::setup() {
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -255,10 +258,12 @@ Dungeon::~Dungeon() {
|
||||
|
||||
void Dungeon::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup"));
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_structure", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Dungeon::setup);
|
||||
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_structure", "structure", "spawn_mobs"), &Dungeon::generate_structure);
|
||||
|
||||
@ -331,7 +336,6 @@ void Dungeon::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_end_room", "index", "data"), &Dungeon::set_dungeon_end_room);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon_end_room", "dungeon_end_room"), &Dungeon::add_dungeon_end_room);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_end_room", "index"), &Dungeon::remove_dungeon_end_room);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_end_room_count"), &Dungeon::get_dungeon_end_room_count);
|
||||
|
||||
//Corridors
|
||||
@ -339,7 +343,6 @@ void Dungeon::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_corridor", "index", "data"), &Dungeon::set_dungeon_corridor);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon_corridor", "dungeon_corridor"), &Dungeon::add_dungeon_corridor);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_corridor", "index"), &Dungeon::remove_dungeon_corridor);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_corridor_count"), &Dungeon::get_dungeon_corridor_count);
|
||||
|
||||
//Entities
|
||||
@ -347,7 +350,6 @@ void Dungeon::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &Dungeon::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &Dungeon::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &Dungeon::remove_entity_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &Dungeon::get_entity_data_count);
|
||||
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "image", PROPERTY_HINT_RESOURCE_TYPE, "Image"), "_generate_map"));
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
|
||||
#include "../data/dungeon_data.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
class DungeonData;
|
||||
|
||||
@ -62,7 +63,6 @@ public:
|
||||
void set_dungeon_room(const int index, const Ref<DungeonRoom> dungeon_room);
|
||||
void add_dungeon_room(const Ref<DungeonRoom> dungeon_room);
|
||||
void remove_dungeon_room(const int index);
|
||||
|
||||
int get_dungeon_room_count() const;
|
||||
|
||||
//Start Rooms
|
||||
@ -70,7 +70,6 @@ public:
|
||||
void set_dungeon_start_room(const int index, const Ref<DungeonRoom> dungeon_start_room);
|
||||
void add_dungeon_start_room(const Ref<DungeonRoom> dungeon_start_room);
|
||||
void remove_dungeon_start_room(const int index);
|
||||
|
||||
int get_dungeon_start_room_count() const;
|
||||
|
||||
//End Rooms
|
||||
@ -78,7 +77,6 @@ public:
|
||||
void set_dungeon_end_room(const int index, const Ref<DungeonRoom> dungeon_end_room);
|
||||
void add_dungeon_end_room(const Ref<DungeonRoom> dungeon_end_room);
|
||||
void remove_dungeon_end_room(const int index);
|
||||
|
||||
int get_dungeon_end_room_count() const;
|
||||
|
||||
//Corridors
|
||||
@ -86,7 +84,6 @@ public:
|
||||
void set_dungeon_corridor(const int index, const Ref<DungeonCorridor> dungeon_corridors);
|
||||
void add_dungeon_corridor(const Ref<DungeonCorridor> dungeon_corridors);
|
||||
void remove_dungeon_corridor(const int index);
|
||||
|
||||
int get_dungeon_corridor_count() const;
|
||||
|
||||
//Entities
|
||||
@ -94,10 +91,10 @@ public:
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_datas);
|
||||
void add_entity_data(const Ref<EntityData> entity_datas);
|
||||
void remove_entity_data(const int index);
|
||||
|
||||
int get_entity_data_count() const;
|
||||
|
||||
void setup();
|
||||
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_structure(Ref<VoxelStructure> structure, bool spawn_mobs);
|
||||
|
@ -100,7 +100,6 @@ void DungeonRoom::remove_prop_data(const int index) {
|
||||
|
||||
_prop_datas.remove(index);
|
||||
}
|
||||
|
||||
int DungeonRoom::get_prop_data_count() const {
|
||||
return _prop_datas.size();
|
||||
}
|
||||
@ -124,18 +123,22 @@ void DungeonRoom::remove_entity_data(const int index) {
|
||||
|
||||
_entity_datas.remove(index);
|
||||
}
|
||||
|
||||
int DungeonRoom::get_entity_data_count() const {
|
||||
return _entity_datas.size();
|
||||
}
|
||||
|
||||
|
||||
void DungeonRoom::setup() {
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -173,10 +176,12 @@ DungeonRoom::~DungeonRoom() {
|
||||
|
||||
void DungeonRoom::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup"));
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_room", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &DungeonRoom::setup);
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &DungeonRoom::setup_library);
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_room", "structure", "spawn_mobs"), &DungeonRoom::generate_room);
|
||||
|
||||
@ -231,7 +236,6 @@ void DungeonRoom::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_prop_data", "index", "data"), &DungeonRoom::set_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("add_prop_data", "prop_data"), &DungeonRoom::add_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_prop_data", "index"), &DungeonRoom::remove_prop_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data_count"), &DungeonRoom::get_prop_data_count);
|
||||
|
||||
//Entities
|
||||
@ -239,6 +243,5 @@ void DungeonRoom::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &DungeonRoom::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &DungeonRoom::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &DungeonRoom::remove_entity_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &DungeonRoom::get_entity_data_count);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
|
||||
#include "../data/dungeon_room_data.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
class DungeonRoomData;
|
||||
|
||||
@ -60,7 +61,6 @@ public:
|
||||
void set_prop_data(const int index, const Ref<WorldGeneratorPropData> prop_data);
|
||||
void add_prop_data(const Ref<WorldGeneratorPropData> prop_data);
|
||||
void remove_prop_data(const int index);
|
||||
|
||||
int get_prop_data_count() const;
|
||||
|
||||
//Entities
|
||||
@ -68,10 +68,10 @@ public:
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
void add_entity_data(const Ref<EntityData> entity_data);
|
||||
void remove_entity_data(const int index);
|
||||
|
||||
int get_entity_data_count() const;
|
||||
|
||||
void setup();
|
||||
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_room(Ref<VoxelStructure> structure, bool spawn_mobs);
|
||||
|
@ -72,7 +72,6 @@ void Planet::remove_dungeon(const int index) {
|
||||
|
||||
_dungeons.remove(index);
|
||||
}
|
||||
|
||||
int Planet::get_dungeon_count() const {
|
||||
return _dungeons.size();
|
||||
}
|
||||
@ -83,6 +82,12 @@ void Planet::setup() {
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -107,14 +112,17 @@ Planet::Planet() {
|
||||
Planet::~Planet() {
|
||||
_environment.unref();
|
||||
_biomes.clear();
|
||||
_dungeons.clear();
|
||||
}
|
||||
|
||||
void Planet::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup"));
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Planet::setup);
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Planet::setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_seed"), &Planet::get_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_seed", "value"), &Planet::set_seed);
|
||||
@ -137,7 +145,6 @@ void Planet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_biome", "index", "data"), &Planet::set_biome);
|
||||
ClassDB::bind_method(D_METHOD("add_biome", "biome"), &Planet::add_biome);
|
||||
ClassDB::bind_method(D_METHOD("remove_biome", "index"), &Planet::remove_biome);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_biome_count"), &Planet::get_biome_count);
|
||||
|
||||
//Dungeons
|
||||
@ -145,7 +152,6 @@ void Planet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon", "index", "data"), &Planet::set_dungeon);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon", "dungeon"), &Planet::add_dungeon);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon", "index"), &Planet::remove_dungeon);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_count"), &Planet::get_dungeon_count);
|
||||
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "image", PROPERTY_HINT_RESOURCE_TYPE, "Image"), "_generate_map"));
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "../../world/environment_data.h"
|
||||
|
||||
#include "../data/planet_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
class PlanetData;
|
||||
|
||||
@ -35,7 +37,6 @@ public:
|
||||
void set_biome(const int index, const Ref<Biome> biome);
|
||||
void add_biome(const Ref<Biome> biome);
|
||||
void remove_biome(const int index);
|
||||
|
||||
int get_biome_count() const;
|
||||
|
||||
//Dungeons
|
||||
@ -43,10 +44,10 @@ public:
|
||||
void set_dungeon(const int index, const Ref<Dungeon> dungeon);
|
||||
void add_dungeon(const Ref<Dungeon> dungeon);
|
||||
void remove_dungeon(const int index);
|
||||
|
||||
int get_dungeon_count() const;
|
||||
|
||||
void setup();
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
Ref<Image> generate_map();
|
||||
|
Loading…
Reference in New Issue
Block a user