mirror of
https://github.com/Relintai/world_generator.git
synced 2025-02-20 17:24:22 +01:00
Brought back the changes from the voxelman Repository.
This commit is contained in:
parent
572d7c7493
commit
42b7cecec6
@ -1,5 +1,19 @@
|
||||
#include "biome_data.h"
|
||||
|
||||
String BiomeData::get_target_class_name() {
|
||||
return _target_class_name;
|
||||
}
|
||||
void BiomeData::set_target_class_name(String name) {
|
||||
_target_class_name = name;
|
||||
}
|
||||
|
||||
Ref<Script> BiomeData::get_target_script() {
|
||||
return _target_script;
|
||||
}
|
||||
void BiomeData::set_target_script(Ref<Script> script) {
|
||||
_target_script = script;
|
||||
}
|
||||
|
||||
Vector2 BiomeData::get_level_range() {
|
||||
return _level_range;
|
||||
}
|
||||
@ -183,12 +197,82 @@ void BiomeData::set_environment_datas(const Vector<Variant> &environment_datas)
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Biome> BiomeData::setup_biome(int seed) {
|
||||
if (has_method("_setup_biome")) {
|
||||
return call("_setup_biome", seed);
|
||||
}
|
||||
//// Surfaces ////
|
||||
Ref<VoxelSurface> BiomeData::get_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return Ref<Biome>(NULL);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//// Liquid Surfaces ////
|
||||
Ref<VoxelSurface> BiomeData::get_liquid_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return _liquid_voxel_surfaces.get(index);
|
||||
}
|
||||
void BiomeData::set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface) {
|
||||
ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size());
|
||||
|
||||
_liquid_voxel_surfaces.set(index, voxel_surface);
|
||||
}
|
||||
void BiomeData::add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
||||
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
void BiomeData::remove_liquid_voxel_surface(const int index) {
|
||||
ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size());
|
||||
|
||||
_liquid_voxel_surfaces.remove(index);
|
||||
}
|
||||
int BiomeData::get_liquid_voxel_surface_count() const {
|
||||
return _liquid_voxel_surfaces.size();
|
||||
}
|
||||
|
||||
Vector<Variant> BiomeData::get_liquid_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _liquid_voxel_surfaces.size(); i++) {
|
||||
r.push_back(_liquid_voxel_surfaces[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void BiomeData::set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
||||
_liquid_voxel_surfaces.clear();
|
||||
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||
|
||||
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
}
|
||||
|
||||
BiomeData::BiomeData() {
|
||||
@ -198,12 +282,20 @@ BiomeData::~BiomeData() {
|
||||
_dungeon_datas.clear();
|
||||
_prop_datas.clear();
|
||||
_entity_datas.clear();
|
||||
|
||||
_environment_datas.clear();
|
||||
_voxel_surfaces.clear();
|
||||
_liquid_voxel_surfaces.clear();
|
||||
}
|
||||
|
||||
void BiomeData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "Biome"), "_setup_biome", PropertyInfo(Variant::INT, "seed")));
|
||||
ClassDB::bind_method(D_METHOD("get_target_class_name"), &BiomeData::get_target_class_name);
|
||||
ClassDB::bind_method(D_METHOD("set_target_class_name", "value"), &BiomeData::set_target_class_name);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "target_class_name"), "set_target_class_name", "get_target_class_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_biome", "seed"), &BiomeData::setup_biome);
|
||||
ClassDB::bind_method(D_METHOD("get_target_script"), &BiomeData::get_target_script);
|
||||
ClassDB::bind_method(D_METHOD("set_target_script", "value"), &BiomeData::set_target_script);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "target_script", PROPERTY_HINT_RESOURCE_TYPE, "Script"), "set_target_script", "get_target_script");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_range"), &BiomeData::get_level_range);
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &BiomeData::set_level_range);
|
||||
@ -222,7 +314,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);
|
||||
@ -234,7 +325,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);
|
||||
@ -246,7 +336,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);
|
||||
@ -258,10 +347,31 @@ 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");
|
||||
|
||||
//Liquid Surfaces
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &BiomeData::get_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "data"), &BiomeData::set_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("add_liquid_voxel_surface", "voxel_surface"), &BiomeData::add_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("remove_liquid_voxel_surface", "index"), &BiomeData::remove_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface_count"), &BiomeData::get_liquid_voxel_surface_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &BiomeData::get_liquid_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &BiomeData::set_liquid_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces");
|
||||
}
|
||||
|
@ -4,17 +4,26 @@
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
#include "core/math/vector2.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/script_language.h"
|
||||
|
||||
#include "../main/biome.h"
|
||||
#include "dungeon_data.h"
|
||||
#include "world_generator_prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../entity_spell_system/entities/data/entity_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);
|
||||
|
||||
public:
|
||||
String get_target_class_name();
|
||||
void set_target_class_name(String name);
|
||||
|
||||
Ref<Script> get_target_script();
|
||||
void set_target_script(Ref<Script> script);
|
||||
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
|
||||
@ -40,7 +49,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 +59,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,13 +69,30 @@ 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);
|
||||
|
||||
Ref<Biome> setup_biome(int seed);
|
||||
//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);
|
||||
|
||||
//Liquid Surfaces
|
||||
Ref<VoxelSurface> get_liquid_voxel_surface(const int index) const;
|
||||
void set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
void add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||
void remove_liquid_voxel_surface(const int index);
|
||||
int get_liquid_voxel_surface_count() const;
|
||||
|
||||
Vector<Variant> get_liquid_voxel_surfaces();
|
||||
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
|
||||
BiomeData();
|
||||
~BiomeData();
|
||||
@ -77,6 +101,9 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
String _target_class_name;
|
||||
Ref<Script> _target_script;
|
||||
|
||||
Vector2 _level_range;
|
||||
|
||||
Vector2 _humidity_range;
|
||||
@ -86,6 +113,8 @@ private:
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,19 @@
|
||||
#include "dungeon_data.h"
|
||||
|
||||
String DungeonData::get_target_class_name() {
|
||||
return _target_class_name;
|
||||
}
|
||||
void DungeonData::set_target_class_name(String name) {
|
||||
_target_class_name = name;
|
||||
}
|
||||
|
||||
Ref<Script> DungeonData::get_target_script() {
|
||||
return _target_script;
|
||||
}
|
||||
void DungeonData::set_target_script(Ref<Script> script) {
|
||||
_target_script = script;
|
||||
}
|
||||
|
||||
Vector2 DungeonData::get_level_range() {
|
||||
return _level_range;
|
||||
}
|
||||
@ -244,7 +258,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 +278,83 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
//// Liquid Surfaces ////
|
||||
Ref<VoxelSurface> DungeonData::get_liquid_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return _liquid_voxel_surfaces.get(index);
|
||||
}
|
||||
void DungeonData::set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface) {
|
||||
ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size());
|
||||
|
||||
_liquid_voxel_surfaces.set(index, voxel_surface);
|
||||
}
|
||||
void DungeonData::add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
||||
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
void DungeonData::remove_liquid_voxel_surface(const int index) {
|
||||
ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size());
|
||||
|
||||
_liquid_voxel_surfaces.remove(index);
|
||||
}
|
||||
int DungeonData::get_liquid_voxel_surface_count() const {
|
||||
return _liquid_voxel_surfaces.size();
|
||||
}
|
||||
|
||||
Vector<Variant> DungeonData::get_liquid_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _liquid_voxel_surfaces.size(); i++) {
|
||||
r.push_back(_liquid_voxel_surfaces[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void DungeonData::set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
||||
_liquid_voxel_surfaces.clear();
|
||||
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||
|
||||
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
}
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> DungeonData::get_environment_data(const int index) const {
|
||||
@ -305,16 +395,6 @@ void DungeonData::set_environment_datas(const Vector<Variant> &environment_datas
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ref<Dungeon> DungeonData::setup_dungeon(int seed) {
|
||||
if (has_method("_setup_dungeon")) {
|
||||
return call("_setup_dungeon", seed);
|
||||
}
|
||||
|
||||
return Ref<Dungeon>();
|
||||
}
|
||||
|
||||
DungeonData::DungeonData() {
|
||||
_min_sizex = 0;
|
||||
_min_sizey = 0;
|
||||
@ -335,12 +415,20 @@ DungeonData::~DungeonData() {
|
||||
_dungeon_end_room_datas.clear();
|
||||
_dungeon_corridor_datas.clear();
|
||||
_entity_datas.clear();
|
||||
|
||||
_entity_datas.clear();
|
||||
_voxel_surfaces.clear();
|
||||
_liquid_voxel_surfaces.clear();
|
||||
}
|
||||
|
||||
void DungeonData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "Dungeon"), "_setup_dungeon", PropertyInfo(Variant::INT, "seed")));
|
||||
ClassDB::bind_method(D_METHOD("get_target_class_name"), &DungeonData::get_target_class_name);
|
||||
ClassDB::bind_method(D_METHOD("set_target_class_name", "value"), &DungeonData::set_target_class_name);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "target_class_name"), "set_target_class_name", "get_target_class_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_dungeon", "seed"), &DungeonData::setup_dungeon);
|
||||
ClassDB::bind_method(D_METHOD("get_target_script"), &DungeonData::get_target_script);
|
||||
ClassDB::bind_method(D_METHOD("set_target_script", "value"), &DungeonData::set_target_script);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "target_script", PROPERTY_HINT_RESOURCE_TYPE, "Script"), "set_target_script", "get_target_script");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_range"), &DungeonData::get_level_range);
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &DungeonData::set_level_range);
|
||||
@ -386,7 +474,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);
|
||||
@ -398,7 +485,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);
|
||||
@ -410,7 +496,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);
|
||||
@ -422,7 +507,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);
|
||||
@ -434,7 +518,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);
|
||||
@ -446,10 +529,31 @@ 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");
|
||||
|
||||
//Liquid Surfaces
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &DungeonData::get_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "data"), &DungeonData::set_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("add_liquid_voxel_surface", "voxel_surface"), &DungeonData::add_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("remove_liquid_voxel_surface", "index"), &DungeonData::remove_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface_count"), &DungeonData::get_liquid_voxel_surface_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &DungeonData::get_liquid_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &DungeonData::set_liquid_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces");
|
||||
}
|
||||
|
@ -3,18 +3,27 @@
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/script_language.h"
|
||||
|
||||
#include "../main/dungeon.h"
|
||||
#include "dungeon_room_data.h"
|
||||
#include "dungeon_corridor_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../world/environment_data.h"
|
||||
|
||||
#include "../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
|
||||
class DungeonData : public Resource {
|
||||
GDCLASS(DungeonData, Resource);
|
||||
|
||||
public:
|
||||
String get_target_class_name();
|
||||
void set_target_class_name(String name);
|
||||
|
||||
Ref<Script> get_target_script();
|
||||
void set_target_script(Ref<Script> script);
|
||||
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
|
||||
@ -50,7 +59,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 +69,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 +79,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 +89,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 +99,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,13 +109,30 @@ 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);
|
||||
|
||||
Ref<Dungeon> setup_dungeon(int seed);
|
||||
//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);
|
||||
|
||||
//Liquid Surfaces
|
||||
Ref<VoxelSurface> get_liquid_voxel_surface(const int index) const;
|
||||
void set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
void add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||
void remove_liquid_voxel_surface(const int index);
|
||||
int get_liquid_voxel_surface_count() const;
|
||||
|
||||
Vector<Variant> get_liquid_voxel_surfaces();
|
||||
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
|
||||
DungeonData();
|
||||
~DungeonData();
|
||||
@ -120,6 +141,9 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
String _target_class_name;
|
||||
Ref<Script> _target_script;
|
||||
|
||||
Vector2 _level_range;
|
||||
|
||||
int _min_sizex;
|
||||
@ -140,6 +164,8 @@ private:
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_end_room_datas;
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_corridor_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,19 @@
|
||||
#include "dungeon_room_data.h"
|
||||
|
||||
String DungeonRoomData::get_target_class_name() {
|
||||
return _target_class_name;
|
||||
}
|
||||
void DungeonRoomData::set_target_class_name(String name) {
|
||||
_target_class_name = name;
|
||||
}
|
||||
|
||||
Ref<Script> DungeonRoomData::get_target_script() {
|
||||
return _target_script;
|
||||
}
|
||||
void DungeonRoomData::set_target_script(Ref<Script> script) {
|
||||
_target_script = script;
|
||||
}
|
||||
|
||||
Vector2 DungeonRoomData::get_level_range() {
|
||||
return _level_range;
|
||||
}
|
||||
@ -168,12 +182,82 @@ void DungeonRoomData::set_entity_datas(const Vector<Variant> &entity_datas) {
|
||||
}
|
||||
}
|
||||
|
||||
Ref<DungeonRoom> DungeonRoomData::setup_room(int seed) {
|
||||
if (has_method("_setup_room")) {
|
||||
return call("_setup_room", seed);
|
||||
}
|
||||
//// Surfaces ////
|
||||
Ref<VoxelSurface> DungeonRoomData::get_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return Ref<DungeonRoom>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//// Liquid Surfaces ////
|
||||
Ref<VoxelSurface> DungeonRoomData::get_liquid_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return _liquid_voxel_surfaces.get(index);
|
||||
}
|
||||
void DungeonRoomData::set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface) {
|
||||
ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size());
|
||||
|
||||
_liquid_voxel_surfaces.set(index, voxel_surface);
|
||||
}
|
||||
void DungeonRoomData::add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
||||
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
void DungeonRoomData::remove_liquid_voxel_surface(const int index) {
|
||||
ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size());
|
||||
|
||||
_liquid_voxel_surfaces.remove(index);
|
||||
}
|
||||
int DungeonRoomData::get_liquid_voxel_surface_count() const {
|
||||
return _liquid_voxel_surfaces.size();
|
||||
}
|
||||
|
||||
Vector<Variant> DungeonRoomData::get_liquid_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _liquid_voxel_surfaces.size(); i++) {
|
||||
r.push_back(_liquid_voxel_surfaces[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void DungeonRoomData::set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
||||
_liquid_voxel_surfaces.clear();
|
||||
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||
|
||||
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
}
|
||||
|
||||
DungeonRoomData::DungeonRoomData() {
|
||||
@ -186,13 +270,21 @@ DungeonRoomData::DungeonRoomData() {
|
||||
_max_sizez = 0;
|
||||
}
|
||||
DungeonRoomData::~DungeonRoomData() {
|
||||
|
||||
_prop_datas.clear();
|
||||
_entity_datas.clear();
|
||||
_environment_datas.clear();
|
||||
_voxel_surfaces.clear();
|
||||
_liquid_voxel_surfaces.clear();
|
||||
}
|
||||
|
||||
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("get_target_class_name"), &DungeonRoomData::get_target_class_name);
|
||||
ClassDB::bind_method(D_METHOD("set_target_class_name", "value"), &DungeonRoomData::set_target_class_name);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "target_class_name"), "set_target_class_name", "get_target_class_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_room", "seed"), &DungeonRoomData::setup_room);
|
||||
ClassDB::bind_method(D_METHOD("get_target_script"), &DungeonRoomData::get_target_script);
|
||||
ClassDB::bind_method(D_METHOD("set_target_script", "value"), &DungeonRoomData::set_target_script);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "target_script", PROPERTY_HINT_RESOURCE_TYPE, "Script"), "set_target_script", "get_target_script");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_range"), &DungeonRoomData::get_level_range);
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &DungeonRoomData::set_level_range);
|
||||
@ -229,7 +321,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);
|
||||
@ -241,7 +332,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);
|
||||
@ -253,10 +343,31 @@ 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");
|
||||
|
||||
//Liquid Surfaces
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &DungeonRoomData::get_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "data"), &DungeonRoomData::set_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("add_liquid_voxel_surface", "voxel_surface"), &DungeonRoomData::add_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("remove_liquid_voxel_surface", "index"), &DungeonRoomData::remove_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface_count"), &DungeonRoomData::get_liquid_voxel_surface_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &DungeonRoomData::get_liquid_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &DungeonRoomData::set_liquid_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces");
|
||||
}
|
||||
|
@ -2,17 +2,26 @@
|
||||
#define DUNGEON_ROOM_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/script_language.h"
|
||||
|
||||
#include "../main/dungeon_room.h"
|
||||
#include "world_generator_prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../world/environment_data.h"
|
||||
|
||||
#include "../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
|
||||
class DungeonRoomData : public Resource {
|
||||
GDCLASS(DungeonRoomData, Resource);
|
||||
|
||||
public:
|
||||
String get_target_class_name();
|
||||
void set_target_class_name(String name);
|
||||
|
||||
Ref<Script> get_target_script();
|
||||
void set_target_script(Ref<Script> script);
|
||||
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
|
||||
@ -41,7 +50,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,25 +60,41 @@ 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);
|
||||
|
||||
Ref<DungeonRoom> setup_room(int seed);
|
||||
|
||||
//Entities
|
||||
Ref<EntityData> get_entity_data(const int index) const;
|
||||
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);
|
||||
|
||||
//Liquid Surfaces
|
||||
Ref<VoxelSurface> get_liquid_voxel_surface(const int index) const;
|
||||
void set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
void add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||
void remove_liquid_voxel_surface(const int index);
|
||||
int get_liquid_voxel_surface_count() const;
|
||||
|
||||
Vector<Variant> get_liquid_voxel_surfaces();
|
||||
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
|
||||
DungeonRoomData();
|
||||
~DungeonRoomData();
|
||||
|
||||
@ -78,6 +102,9 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
String _target_class_name;
|
||||
Ref<Script> _target_script;
|
||||
|
||||
Vector2 _level_range;
|
||||
|
||||
int _min_sizex;
|
||||
@ -91,6 +118,8 @@ private:
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,20 @@ void PlanetData::set_id(const int value) {
|
||||
_id = value;
|
||||
}
|
||||
|
||||
String PlanetData::get_target_class_name() {
|
||||
return _target_class_name;
|
||||
}
|
||||
void PlanetData::set_target_class_name(String name) {
|
||||
_target_class_name = name;
|
||||
}
|
||||
|
||||
Ref<Script> PlanetData::get_target_script() {
|
||||
return _target_script;
|
||||
}
|
||||
void PlanetData::set_target_script(Ref<Script> script) {
|
||||
_target_script = script;
|
||||
}
|
||||
|
||||
Vector2 PlanetData::get_level_range() {
|
||||
return _level_range;
|
||||
}
|
||||
@ -106,31 +120,111 @@ void PlanetData::set_environment_datas(const Vector<Variant> &environment_datas)
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Planet> PlanetData::setup_planet(int seed) {
|
||||
if (has_method("_setup_planet")) {
|
||||
return call("_setup_planet", seed);
|
||||
}
|
||||
|
||||
return Ref<Planet>(NULL);
|
||||
//// 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);
|
||||
}
|
||||
}
|
||||
|
||||
//// Liquid Surfaces ////
|
||||
Ref<VoxelSurface> PlanetData::get_liquid_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _liquid_voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
|
||||
return _liquid_voxel_surfaces.get(index);
|
||||
}
|
||||
void PlanetData::set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface) {
|
||||
ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size());
|
||||
|
||||
_liquid_voxel_surfaces.set(index, voxel_surface);
|
||||
}
|
||||
void PlanetData::add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
||||
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
void PlanetData::remove_liquid_voxel_surface(const int index) {
|
||||
ERR_FAIL_INDEX(index, _liquid_voxel_surfaces.size());
|
||||
|
||||
_liquid_voxel_surfaces.remove(index);
|
||||
}
|
||||
int PlanetData::get_liquid_voxel_surface_count() const {
|
||||
return _liquid_voxel_surfaces.size();
|
||||
}
|
||||
|
||||
Vector<Variant> PlanetData::get_liquid_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _liquid_voxel_surfaces.size(); i++) {
|
||||
r.push_back(_liquid_voxel_surfaces[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void PlanetData::set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces) {
|
||||
_liquid_voxel_surfaces.clear();
|
||||
for (int i = 0; i < voxel_surfaces.size(); i++) {
|
||||
Ref<EnvironmentData> voxel_surface = Ref<EnvironmentData>(voxel_surfaces[i]);
|
||||
|
||||
_liquid_voxel_surfaces.push_back(voxel_surface);
|
||||
}
|
||||
}
|
||||
|
||||
PlanetData::PlanetData() {
|
||||
_id = 0;
|
||||
}
|
||||
PlanetData::~PlanetData() {
|
||||
_humidity_noise_params.unref();
|
||||
_temperature_noise_params.unref();
|
||||
|
||||
_biome_datas.clear();
|
||||
_environment_datas.clear();
|
||||
_voxel_surfaces.clear();
|
||||
_liquid_voxel_surfaces.clear();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &PlanetData::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &PlanetData::set_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_target_class_name"), &PlanetData::get_target_class_name);
|
||||
ClassDB::bind_method(D_METHOD("set_target_class_name", "value"), &PlanetData::set_target_class_name);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "target_class_name"), "set_target_class_name", "get_target_class_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_target_script"), &PlanetData::get_target_script);
|
||||
ClassDB::bind_method(D_METHOD("set_target_script", "value"), &PlanetData::set_target_script);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "target_script", PROPERTY_HINT_RESOURCE_TYPE, "Script"), "set_target_script", "get_target_script");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_range"), &PlanetData::get_level_range);
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &PlanetData::set_level_range);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "level_range"), "set_level_range", "get_level_range");
|
||||
@ -143,12 +237,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);
|
||||
@ -160,10 +253,31 @@ 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");
|
||||
|
||||
//Liquid Surfaces
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &PlanetData::get_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "data"), &PlanetData::set_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("add_liquid_voxel_surface", "voxel_surface"), &PlanetData::add_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("remove_liquid_voxel_surface", "index"), &PlanetData::remove_liquid_voxel_surface);
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface_count"), &PlanetData::get_liquid_voxel_surface_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &PlanetData::get_liquid_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &PlanetData::set_liquid_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces");
|
||||
}
|
||||
|
@ -2,12 +2,15 @@
|
||||
#define biome_data_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/script_language.h"
|
||||
|
||||
#include "../../fastnoise/fastnoise_noise_params.h"
|
||||
#include "../../../fastnoise/fastnoise_noise_params.h"
|
||||
|
||||
#include "../main/planet.h"
|
||||
#include "../data/biome_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../world/environment_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
|
||||
class PlanetData : public Resource {
|
||||
GDCLASS(PlanetData, Resource);
|
||||
@ -16,6 +19,12 @@ public:
|
||||
int get_id() const;
|
||||
void set_id(const int value);
|
||||
|
||||
String get_target_class_name();
|
||||
void set_target_class_name(String name);
|
||||
|
||||
Ref<Script> get_target_script();
|
||||
void set_target_script(Ref<Script> script);
|
||||
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
|
||||
@ -30,7 +39,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,13 +49,30 @@ 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);
|
||||
|
||||
Ref<Planet> setup_planet(int seed);
|
||||
//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);
|
||||
|
||||
//Liquid Surfaces
|
||||
Ref<VoxelSurface> get_liquid_voxel_surface(const int index) const;
|
||||
void set_liquid_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
void add_liquid_voxel_surface(const Ref<VoxelSurface> voxel_surface);
|
||||
void remove_liquid_voxel_surface(const int index);
|
||||
int get_liquid_voxel_surface_count() const;
|
||||
|
||||
Vector<Variant> get_liquid_voxel_surfaces();
|
||||
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
|
||||
PlanetData();
|
||||
~PlanetData();
|
||||
@ -58,12 +83,17 @@ protected:
|
||||
private:
|
||||
int _id;
|
||||
|
||||
String _target_class_name;
|
||||
Ref<Script> _target_script;
|
||||
|
||||
Vector2 _level_range;
|
||||
|
||||
Ref<FastnoiseNoiseParams> _humidity_noise_params;
|
||||
Ref<FastnoiseNoiseParams> _temperature_noise_params;
|
||||
Vector<Ref<BiomeData> > _biome_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "../../voxelman/props/prop_data.h"
|
||||
#include "../../props/prop_data.h"
|
||||
|
||||
class WorldGeneratorPropData : public Resource {
|
||||
GDCLASS(WorldGeneratorPropData, Resource);
|
||||
|
@ -1,5 +1,12 @@
|
||||
#include "biome.h"
|
||||
|
||||
int Biome::get_current_seed() {
|
||||
return _current_seed;
|
||||
}
|
||||
void Biome::set_current_seed(int value) {
|
||||
_current_seed = value;
|
||||
}
|
||||
|
||||
Vector2 Biome::get_level_range() {
|
||||
return _level_range;
|
||||
}
|
||||
@ -14,6 +21,15 @@ void Biome::set_environment(Ref<EnvironmentData> value) {
|
||||
_environment = value;
|
||||
}
|
||||
|
||||
Ref<BiomeData> Biome::get_data() {
|
||||
return _data;
|
||||
}
|
||||
void Biome::set_data(Ref<BiomeData> value) {
|
||||
_data = value;
|
||||
|
||||
setup();
|
||||
}
|
||||
|
||||
//// Prop Data ////
|
||||
Ref<WorldGeneratorPropData> Biome::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<WorldGeneratorPropData>());
|
||||
@ -57,7 +73,6 @@ void Biome::remove_entity_data(const int index) {
|
||||
|
||||
_entity_datas.remove(index);
|
||||
}
|
||||
|
||||
int Biome::get_entity_data_count() const {
|
||||
return _entity_datas.size();
|
||||
}
|
||||
@ -81,12 +96,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));
|
||||
|
||||
@ -108,23 +121,70 @@ void Biome::generate_stack_bind(Node *chunk, int x, int z, bool spawn_mobs) {
|
||||
generate_stack(Object::cast_to<VoxelChunk>(chunk), x, z, spawn_mobs);
|
||||
}
|
||||
|
||||
Biome::Biome() {
|
||||
void Biome::setup() {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void Biome::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void Biome::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
for (int i = 0; i < _data->get_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_liquid_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_liquid_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Biome::Biome() {
|
||||
_current_seed = 0;
|
||||
}
|
||||
Biome::~Biome() {
|
||||
_environment.unref();
|
||||
_data.unref();
|
||||
_prop_datas.clear();
|
||||
_entity_datas.clear();
|
||||
_dungeons.clear();
|
||||
}
|
||||
|
||||
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("_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);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_current_seed"), &Biome::get_current_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &Biome::set_current_seed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_seed"), "set_current_seed", "get_current_seed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_range"), &Biome::get_level_range);
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &Biome::set_level_range);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "level_range"), "set_level_range", "get_level_range");
|
||||
@ -133,12 +193,15 @@ void Biome::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "value"), &Biome::set_environment);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "EnvironmentData"), "set_environment", "get_environment");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &Biome::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &Biome::set_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "PlanetData"), "set_data", "get_data");
|
||||
|
||||
//Props
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data", "index"), &Biome::get_prop_data);
|
||||
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
|
||||
@ -146,7 +209,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
|
||||
@ -154,6 +216,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);
|
||||
}
|
||||
|
26
main/biome.h
26
main/biome.h
@ -3,16 +3,24 @@
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../world/voxel_chunk.h"
|
||||
#include "../data/world_generator_prop_data.h"
|
||||
#include "dungeon.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../world/environment_data.h"
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
|
||||
#include "../data/biome_data.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
class BiomeData;
|
||||
|
||||
class Biome : public Reference {
|
||||
GDCLASS(Biome, Reference);
|
||||
|
||||
public:
|
||||
int get_current_seed();
|
||||
void set_current_seed(int value);
|
||||
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
|
||||
@ -20,6 +28,9 @@ public:
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
|
||||
Ref<BiomeData> get_data();
|
||||
void set_data(Ref<BiomeData> value);
|
||||
|
||||
//WorldGeneratorPropData
|
||||
Ref<WorldGeneratorPropData> get_prop_data(const int index) const;
|
||||
void set_prop_data(const int index, const Ref<WorldGeneratorPropData> prop_data);
|
||||
@ -33,7 +44,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
|
||||
@ -41,7 +51,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);
|
||||
@ -49,6 +58,10 @@ public:
|
||||
void generate_stack(VoxelChunk *chunk, int x, int z, bool spawn_mobs);
|
||||
void generate_stack_bind(Node *chunk, int x, int z, bool spawn_mobs);
|
||||
|
||||
void setup();
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
Biome();
|
||||
~Biome();
|
||||
|
||||
@ -56,9 +69,12 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _current_seed;
|
||||
|
||||
Vector2 _level_range;
|
||||
|
||||
Ref<EnvironmentData> _environment;
|
||||
Ref<BiomeData> _data;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<Dungeon> > _dungeons;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "dungeon.h"
|
||||
|
||||
int Dungeon::get_seed() {
|
||||
return _seed;
|
||||
int Dungeon::get_current_seed() {
|
||||
return _current_seed;
|
||||
}
|
||||
void Dungeon::set_seed(int value) {
|
||||
_seed = value;
|
||||
void Dungeon::set_current_seed(int value) {
|
||||
_current_seed = value;
|
||||
}
|
||||
|
||||
Vector2 Dungeon::get_level_range() {
|
||||
@ -72,6 +72,15 @@ void Dungeon::set_environment(Ref<EnvironmentData> value) {
|
||||
_environment = value;
|
||||
}
|
||||
|
||||
Ref<DungeonData> Dungeon::get_data() {
|
||||
return _data;
|
||||
}
|
||||
void Dungeon::set_data(Ref<DungeonData> value) {
|
||||
_data = value;
|
||||
|
||||
setup();
|
||||
}
|
||||
|
||||
//Rooms
|
||||
Ref<DungeonRoom> Dungeon::get_dungeon_room(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _dungeon_rooms.size(), Ref<DungeonRoom>());
|
||||
@ -163,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();
|
||||
}
|
||||
@ -187,18 +195,46 @@ 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 (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
for (int i = 0; i < _data->get_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_liquid_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_liquid_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -223,7 +259,7 @@ Ref<Image> Dungeon::generate_map() {
|
||||
}
|
||||
|
||||
Dungeon::Dungeon() {
|
||||
_seed = 0;
|
||||
_current_seed = 0;
|
||||
|
||||
_posx = 0;
|
||||
_posy = 0;
|
||||
@ -237,6 +273,7 @@ Dungeon::Dungeon() {
|
||||
}
|
||||
Dungeon::~Dungeon() {
|
||||
_environment.unref();
|
||||
_data.unref();
|
||||
_dungeon_rooms.clear();
|
||||
_dungeon_start_rooms.clear();
|
||||
_dungeon_end_rooms.clear();
|
||||
@ -246,16 +283,20 @@ 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("_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);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_seed"), &Dungeon::get_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_seed", "value"), &Dungeon::set_seed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed");
|
||||
ClassDB::bind_method(D_METHOD("get_current_seed"), &Dungeon::get_current_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &Dungeon::set_current_seed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_seed"), "set_current_seed", "get_current_seed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_range"), &Dungeon::get_level_range);
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &Dungeon::set_level_range);
|
||||
@ -297,6 +338,10 @@ void Dungeon::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "value"), &Dungeon::set_environment);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "EnvironmentData"), "set_environment", "get_environment");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &Dungeon::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &Dungeon::set_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "PlanetData"), "set_data", "get_data");
|
||||
|
||||
//Rooms
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_room", "index"), &Dungeon::get_dungeon_room);
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_room", "index", "data"), &Dungeon::set_dungeon_room);
|
||||
@ -318,7 +363,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
|
||||
@ -326,7 +370,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
|
||||
@ -334,7 +377,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"));
|
||||
|
@ -6,18 +6,23 @@
|
||||
#include "dungeon_room.h"
|
||||
#include "dungeon_corridor.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../world/voxel_chunk.h"
|
||||
#include "../../world/voxel_structure.h"
|
||||
#include "../../world/environment_data.h"
|
||||
|
||||
#include "../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
|
||||
#include "../data/dungeon_data.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
class DungeonData;
|
||||
|
||||
class Dungeon : public Reference {
|
||||
GDCLASS(Dungeon, Reference);
|
||||
|
||||
public:
|
||||
int get_seed();
|
||||
void set_seed(int value);
|
||||
int get_current_seed();
|
||||
void set_current_seed(int value);
|
||||
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
@ -50,12 +55,14 @@ public:
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
|
||||
Ref<DungeonData> get_data();
|
||||
void set_data(Ref<DungeonData> value);
|
||||
|
||||
//Rooms
|
||||
Ref<DungeonRoom> get_dungeon_room(const int index) const;
|
||||
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
|
||||
@ -63,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
|
||||
@ -71,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
|
||||
@ -79,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
|
||||
@ -87,10 +91,12 @@ 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 _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);
|
||||
@ -104,7 +110,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _seed;
|
||||
int _current_seed;
|
||||
|
||||
Vector2 _level_range;
|
||||
|
||||
@ -119,6 +125,7 @@ private:
|
||||
int _room_count;
|
||||
|
||||
Ref<EnvironmentData> _environment;
|
||||
Ref<DungeonData> _data;
|
||||
Vector<Ref<DungeonRoom> > _dungeon_rooms;
|
||||
Vector<Ref<DungeonRoom> > _dungeon_start_rooms;
|
||||
Vector<Ref<DungeonRoom> > _dungeon_end_rooms;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "dungeon_room.h"
|
||||
|
||||
int DungeonRoom::get_seed() {
|
||||
return _seed;
|
||||
int DungeonRoom::get_current_seed() {
|
||||
return _current_seed;
|
||||
}
|
||||
void DungeonRoom::set_seed(int value) {
|
||||
_seed = value;
|
||||
void DungeonRoom::set_current_seed(int value) {
|
||||
_current_seed = value;
|
||||
}
|
||||
|
||||
Vector2 DungeonRoom::get_level_range() {
|
||||
@ -65,6 +65,15 @@ void DungeonRoom::set_environment(Ref<EnvironmentData> value) {
|
||||
_environment = value;
|
||||
}
|
||||
|
||||
Ref<DungeonRoomData> DungeonRoom::get_data() {
|
||||
return _data;
|
||||
}
|
||||
void DungeonRoom::set_data(Ref<DungeonRoomData> value) {
|
||||
_data = value;
|
||||
|
||||
setup();
|
||||
}
|
||||
|
||||
Ref<VoxelStructure> DungeonRoom::get_structure() {
|
||||
return _structure;
|
||||
}
|
||||
@ -91,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();
|
||||
}
|
||||
@ -115,18 +123,46 @@ 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 (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
for (int i = 0; i < _data->get_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_liquid_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_liquid_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -146,7 +182,7 @@ void DungeonRoom::generate_room(Ref<VoxelStructure> structure, bool spawn_mobs)
|
||||
}
|
||||
|
||||
DungeonRoom::DungeonRoom() {
|
||||
_seed = 0;
|
||||
_current_seed = 0;
|
||||
|
||||
_posx = 0;
|
||||
_posy = 0;
|
||||
@ -158,22 +194,28 @@ DungeonRoom::DungeonRoom() {
|
||||
}
|
||||
DungeonRoom::~DungeonRoom() {
|
||||
_environment.unref();
|
||||
_data.unref();
|
||||
_structure.unref();
|
||||
_prop_datas.clear();
|
||||
_entity_datas.clear();
|
||||
}
|
||||
|
||||
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("_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);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_seed"), &DungeonRoom::get_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_seed", "value"), &DungeonRoom::set_seed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed");
|
||||
ClassDB::bind_method(D_METHOD("get_current_seed"), &DungeonRoom::get_current_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &DungeonRoom::set_current_seed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_seed"), "set_current_seed", "get_current_seed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_range"), &DungeonRoom::get_level_range);
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &DungeonRoom::set_level_range);
|
||||
@ -209,6 +251,10 @@ void DungeonRoom::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "value"), &DungeonRoom::set_environment);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "EnvironmentData"), "set_environment", "get_environment");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &DungeonRoom::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &DungeonRoom::set_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "PlanetData"), "set_data", "get_data");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_structure"), &DungeonRoom::get_structure);
|
||||
ClassDB::bind_method(D_METHOD("set_structure", "value"), &DungeonRoom::set_structure);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure"), "set_structure", "get_structure");
|
||||
@ -218,7 +264,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
|
||||
@ -226,6 +271,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);
|
||||
}
|
||||
|
@ -4,18 +4,23 @@
|
||||
#include "core/reference.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
#include "../../world/voxel_chunk.h"
|
||||
#include "../../world/voxel_structure.h"
|
||||
#include "../data/world_generator_prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../entity_spell_system/entities/data/entity_data.h"
|
||||
#include "../../world/environment_data.h"
|
||||
#include "../../../entity_spell_system/entities/data/entity_data.h"
|
||||
|
||||
#include "../data/dungeon_room_data.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
class DungeonRoomData;
|
||||
|
||||
class DungeonRoom : public Reference {
|
||||
GDCLASS(DungeonRoom, Reference);
|
||||
|
||||
public:
|
||||
int get_seed();
|
||||
void set_seed(int value);
|
||||
int get_current_seed();
|
||||
void set_current_seed(int value);
|
||||
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
@ -44,6 +49,9 @@ public:
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
|
||||
Ref<DungeonRoomData> get_data();
|
||||
void set_data(Ref<DungeonRoomData> value);
|
||||
|
||||
//Structure
|
||||
Ref<VoxelStructure> get_structure();
|
||||
void set_structure(Ref<VoxelStructure> structure);
|
||||
@ -53,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
|
||||
@ -61,10 +68,12 @@ 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 _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);
|
||||
@ -76,7 +85,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _seed;
|
||||
int _current_seed;
|
||||
|
||||
Vector2 _level_range;
|
||||
|
||||
@ -89,6 +98,7 @@ private:
|
||||
int _sizez;
|
||||
|
||||
Ref<EnvironmentData> _environment;
|
||||
Ref<DungeonRoomData> _data;
|
||||
Ref<VoxelStructure> _structure;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "planet.h"
|
||||
|
||||
int Planet::get_seed() {
|
||||
return _seed;
|
||||
int Planet::get_current_seed() {
|
||||
return _current_seed;
|
||||
}
|
||||
void Planet::set_seed(int value) {
|
||||
_seed = value;
|
||||
void Planet::set_current_seed(int value) {
|
||||
_current_seed = value;
|
||||
}
|
||||
|
||||
Vector2 Planet::get_level_range() {
|
||||
@ -21,6 +21,15 @@ void Planet::set_environment(Ref<EnvironmentData> value) {
|
||||
_environment = value;
|
||||
}
|
||||
|
||||
Ref<PlanetData> Planet::get_data() {
|
||||
return _data;
|
||||
}
|
||||
void Planet::set_data(Ref<PlanetData> value) {
|
||||
_data = value;
|
||||
|
||||
setup();
|
||||
}
|
||||
|
||||
Ref<Biome> Planet::get_biome(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _biomes.size(), Ref<Biome>());
|
||||
|
||||
@ -44,12 +53,65 @@ int Planet::get_biome_count() const {
|
||||
return _biomes.size();
|
||||
}
|
||||
|
||||
//// Dungeons ////
|
||||
Ref<Dungeon> Planet::get_dungeon(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _dungeons.size(), Ref<Dungeon>());
|
||||
|
||||
return _dungeons.get(index);
|
||||
}
|
||||
void Planet::set_dungeon(const int index, const Ref<Dungeon> dungeon) {
|
||||
ERR_FAIL_INDEX(index, _dungeons.size());
|
||||
|
||||
_dungeons.set(index, dungeon);
|
||||
}
|
||||
void Planet::add_dungeon(const Ref<Dungeon> dungeon) {
|
||||
_dungeons.push_back(dungeon);
|
||||
}
|
||||
void Planet::remove_dungeon(const int index) {
|
||||
ERR_FAIL_INDEX(index, _dungeons.size());
|
||||
|
||||
_dungeons.remove(index);
|
||||
}
|
||||
int Planet::get_dungeon_count() const {
|
||||
return _dungeons.size();
|
||||
}
|
||||
|
||||
void Planet::setup() {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
for (int i = 0; i < _data->get_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _data->get_liquid_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_liquid_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_liquid_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -69,23 +131,28 @@ Ref<Image> Planet::generate_map() {
|
||||
}
|
||||
|
||||
Planet::Planet() {
|
||||
_seed = 0;
|
||||
_current_seed = 0;
|
||||
}
|
||||
Planet::~Planet() {
|
||||
_environment.unref();
|
||||
_data.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("_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);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed");
|
||||
ClassDB::bind_method(D_METHOD("get_current_seed"), &Planet::get_current_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &Planet::set_current_seed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_seed"), "set_current_seed", "get_current_seed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_range"), &Planet::get_level_range);
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &Planet::set_level_range);
|
||||
@ -95,13 +162,24 @@ void Planet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "value"), &Planet::set_environment);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "EnvironmentData"), "set_environment", "get_environment");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &Planet::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &Planet::set_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "PlanetData"), "set_data", "get_data");
|
||||
|
||||
//biomes
|
||||
ClassDB::bind_method(D_METHOD("get_biome", "index"), &Planet::get_biome);
|
||||
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
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon", "index"), &Planet::get_dungeon);
|
||||
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"));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_map"), &Planet::generate_map);
|
||||
|
@ -4,16 +4,23 @@
|
||||
#include "core/reference.h"
|
||||
#include "core/image.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../world/voxel_chunk.h"
|
||||
#include "biome.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "dungeon.h"
|
||||
#include "../../world/environment_data.h"
|
||||
|
||||
#include "../data/planet_data.h"
|
||||
#include "../../library/voxel_surface.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
class PlanetData;
|
||||
|
||||
class Planet : public Reference {
|
||||
GDCLASS(Planet, Reference);
|
||||
|
||||
public:
|
||||
int get_seed();
|
||||
void set_seed(int value);
|
||||
int get_current_seed();
|
||||
void set_current_seed(int value);
|
||||
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
@ -22,14 +29,27 @@ public:
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
|
||||
Ref<PlanetData> get_data();
|
||||
void set_data(Ref<PlanetData> value);
|
||||
|
||||
//Biomes
|
||||
Ref<Biome> get_biome(const int index) const;
|
||||
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
|
||||
Ref<Dungeon> get_dungeon(const int index) const;
|
||||
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 _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();
|
||||
@ -41,10 +61,12 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _seed;
|
||||
int _current_seed;
|
||||
Vector2 _level_range;
|
||||
Ref<EnvironmentData> _environment;
|
||||
Ref<PlanetData> _data;
|
||||
Vector<Ref<Biome> > _biomes;
|
||||
Vector<Ref<Dungeon> > _dungeons;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user