mirror of
https://github.com/Relintai/world_generator.git
synced 2024-11-12 10:15:07 +01:00
-Added environment to everything.
-Destructors will now clean up vectors. -Fixed a few inheritances.
This commit is contained in:
parent
c702f039c9
commit
fc7e054559
@ -96,6 +96,45 @@ void BiomeData::set_prop_datas(const Vector<Variant> &prop_datas) {
|
||||
}
|
||||
}
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> BiomeData::get_environment_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _environment_datas.size(), Ref<EnvironmentData>());
|
||||
|
||||
return _environment_datas.get(index);
|
||||
}
|
||||
void BiomeData::set_environment_data(const int index, const Ref<EnvironmentData> environment_data) {
|
||||
ERR_FAIL_INDEX(index, _environment_datas.size());
|
||||
|
||||
_environment_datas.set(index, environment_data);
|
||||
}
|
||||
void BiomeData::add_environment_data(const Ref<EnvironmentData> environment_data) {
|
||||
_environment_datas.push_back(environment_data);
|
||||
}
|
||||
void BiomeData::remove_environment_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _environment_datas.size());
|
||||
|
||||
_environment_datas.remove(index);
|
||||
}
|
||||
int BiomeData::get_environment_data_count() const {
|
||||
return _environment_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> BiomeData::get_environment_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _environment_datas.size(); i++) {
|
||||
r.push_back(_environment_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void BiomeData::set_environment_datas(const Vector<Variant> &environment_datas) {
|
||||
_environment_datas.clear();
|
||||
for (int i = 0; i < environment_datas.size(); i++) {
|
||||
Ref<EnvironmentData> environment_data = Ref<EnvironmentData>(environment_datas[i]);
|
||||
|
||||
_environment_datas.push_back(environment_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Biome> BiomeData::setup_biome(int seed) {
|
||||
if (has_method("_setup_biome")) {
|
||||
return call("_setup_biome", seed);
|
||||
@ -148,4 +187,16 @@ void BiomeData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_prop_datas"), &BiomeData::get_prop_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_prop_datas", "prop_datas"), &BiomeData::set_prop_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_datas", PROPERTY_HINT_NONE, "17/17:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_prop_datas", "get_prop_datas");
|
||||
|
||||
//Environments
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &BiomeData::get_environment_data);
|
||||
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");
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "../main/biome.h"
|
||||
#include "dungeon_data.h"
|
||||
#include "prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
class BiomeData : public Resource {
|
||||
GDCLASS(BiomeData, Resource);
|
||||
@ -41,6 +42,17 @@ public:
|
||||
Vector<Variant> get_prop_datas();
|
||||
void set_prop_datas(const Vector<Variant> &prop_datas);
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> get_environment_data(const int index) const;
|
||||
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);
|
||||
|
||||
BiomeData();
|
||||
@ -55,6 +67,7 @@ private:
|
||||
Vector2 _temperature_range;
|
||||
Vector<Ref<DungeonData> > _dungeon_datas;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,6 +39,45 @@ void DungeonData::set_dungeon_room_datas(const Vector<Variant> &dungeon_room_dat
|
||||
}
|
||||
}
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> DungeonData::get_environment_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _environment_datas.size(), Ref<EnvironmentData>());
|
||||
|
||||
return _environment_datas.get(index);
|
||||
}
|
||||
void DungeonData::set_environment_data(const int index, const Ref<EnvironmentData> environment_data) {
|
||||
ERR_FAIL_INDEX(index, _environment_datas.size());
|
||||
|
||||
_environment_datas.set(index, environment_data);
|
||||
}
|
||||
void DungeonData::add_environment_data(const Ref<EnvironmentData> environment_data) {
|
||||
_environment_datas.push_back(environment_data);
|
||||
}
|
||||
void DungeonData::remove_environment_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _environment_datas.size());
|
||||
|
||||
_environment_datas.remove(index);
|
||||
}
|
||||
int DungeonData::get_environment_data_count() const {
|
||||
return _environment_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> DungeonData::get_environment_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _environment_datas.size(); i++) {
|
||||
r.push_back(_environment_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void DungeonData::set_environment_datas(const Vector<Variant> &environment_datas) {
|
||||
_environment_datas.clear();
|
||||
for (int i = 0; i < environment_datas.size(); i++) {
|
||||
Ref<EnvironmentData> environment_data = Ref<EnvironmentData>(environment_datas[i]);
|
||||
|
||||
_environment_datas.push_back(environment_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Dungeon> DungeonData::setup_dungeon(int seed) {
|
||||
if (has_method("_setup_dungeon")) {
|
||||
return call("_setup_dungeon", seed);
|
||||
@ -69,4 +108,16 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_room_datas"), &DungeonData::get_dungeon_room_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_room_datas", "dungeon_room_datas"), &DungeonData::set_dungeon_room_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "dungeon_room_datas", PROPERTY_HINT_NONE, "17/17:DungeonRoomData", PROPERTY_USAGE_DEFAULT, "DungeonRoomData"), "set_dungeon_room_datas", "get_dungeon_room_datas");
|
||||
|
||||
//Environments
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &DungeonData::get_environment_data);
|
||||
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");
|
||||
}
|
||||
|
@ -6,11 +6,13 @@
|
||||
|
||||
#include "../main/dungeon.h"
|
||||
#include "dungeon_room_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
class DungeonData : public Resource {
|
||||
GDCLASS(DungeonData, Resource);
|
||||
|
||||
public:
|
||||
//Rooms
|
||||
Ref<DungeonRoomData> get_dungeon_room_data(const int index) const;
|
||||
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);
|
||||
@ -21,6 +23,17 @@ public:
|
||||
Vector<Variant> get_dungeon_room_datas();
|
||||
void set_dungeon_room_datas(const Vector<Variant> &dungeon_room_datas);
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> get_environment_data(const int index) const;
|
||||
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<Dungeon> setup_dungeon(int seed);
|
||||
|
||||
DungeonData();
|
||||
@ -31,6 +44,7 @@ protected:
|
||||
|
||||
private:
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_room_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "dungeon_room_data.h"
|
||||
|
||||
//Props
|
||||
Ref<PropData> DungeonRoomData::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
|
||||
@ -18,7 +19,6 @@ void DungeonRoomData::remove_prop_data(const int index) {
|
||||
|
||||
_prop_datas.remove(index);
|
||||
}
|
||||
|
||||
int DungeonRoomData::get_prop_data_count() const {
|
||||
return _prop_datas.size();
|
||||
}
|
||||
@ -39,6 +39,45 @@ void DungeonRoomData::set_prop_datas(const Vector<Variant> &prop_datas) {
|
||||
}
|
||||
}
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> DungeonRoomData::get_environment_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _environment_datas.size(), Ref<EnvironmentData>());
|
||||
|
||||
return _environment_datas.get(index);
|
||||
}
|
||||
void DungeonRoomData::set_environment_data(const int index, const Ref<EnvironmentData> environment_data) {
|
||||
ERR_FAIL_INDEX(index, _environment_datas.size());
|
||||
|
||||
_environment_datas.set(index, environment_data);
|
||||
}
|
||||
void DungeonRoomData::add_environment_data(const Ref<EnvironmentData> environment_data) {
|
||||
_environment_datas.push_back(environment_data);
|
||||
}
|
||||
void DungeonRoomData::remove_environment_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _environment_datas.size());
|
||||
|
||||
_environment_datas.remove(index);
|
||||
}
|
||||
int DungeonRoomData::get_environment_data_count() const {
|
||||
return _environment_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> DungeonRoomData::get_environment_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _environment_datas.size(); i++) {
|
||||
r.push_back(_environment_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void DungeonRoomData::set_environment_datas(const Vector<Variant> &environment_datas) {
|
||||
_environment_datas.clear();
|
||||
for (int i = 0; i < environment_datas.size(); i++) {
|
||||
Ref<EnvironmentData> environment_data = Ref<EnvironmentData>(environment_datas[i]);
|
||||
|
||||
_environment_datas.push_back(environment_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<DungeonRoom> DungeonRoomData::setup_room(int seed) {
|
||||
if (has_method("_setup_room")) {
|
||||
return call("_setup_room", seed);
|
||||
@ -59,6 +98,7 @@ void DungeonRoomData::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_room", "seed"), &DungeonRoomData::setup_room);
|
||||
|
||||
//Props
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data", "index"), &DungeonRoomData::get_prop_data);
|
||||
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);
|
||||
@ -69,4 +109,16 @@ void DungeonRoomData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_prop_datas"), &DungeonRoomData::get_prop_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_prop_datas", "prop_datas"), &DungeonRoomData::set_prop_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_datas", PROPERTY_HINT_NONE, "17/17:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_prop_datas", "get_prop_datas");
|
||||
|
||||
//Environments
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &DungeonRoomData::get_environment_data);
|
||||
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");
|
||||
}
|
||||
|
@ -5,11 +5,13 @@
|
||||
|
||||
#include "../main/dungeon_room.h"
|
||||
#include "prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
class DungeonRoomData : public Resource {
|
||||
GDCLASS(DungeonRoomData, Resource);
|
||||
|
||||
public:
|
||||
//Prop Data
|
||||
Ref<PropData> get_prop_data(const int index) const;
|
||||
void set_prop_data(const int index, const Ref<PropData> prop_data);
|
||||
void add_prop_data(const Ref<PropData> prop_data);
|
||||
@ -20,6 +22,17 @@ public:
|
||||
Vector<Variant> get_prop_datas();
|
||||
void set_prop_datas(const Vector<Variant> &prop_datas);
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> get_environment_data(const int index) const;
|
||||
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);
|
||||
|
||||
DungeonRoomData();
|
||||
@ -30,6 +43,7 @@ protected:
|
||||
|
||||
private:
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@ void PlanetData::set_temperature_noise_params(Ref<FastnoiseNoiseParams> value) {
|
||||
_temperature_noise_params = value;
|
||||
}
|
||||
|
||||
//Biomes
|
||||
Ref<BiomeData> PlanetData::get_biome_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _biome_datas.size(), Ref<BiomeData>());
|
||||
|
||||
@ -39,7 +40,6 @@ void PlanetData::remove_biome_data(const int index) {
|
||||
|
||||
_biome_datas.remove(index);
|
||||
}
|
||||
|
||||
int PlanetData::get_biome_data_count() const {
|
||||
return _biome_datas.size();
|
||||
}
|
||||
@ -60,6 +60,45 @@ void PlanetData::set_biome_datas(const Vector<Variant> &biome_datas) {
|
||||
}
|
||||
}
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> PlanetData::get_environment_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _environment_datas.size(), Ref<EnvironmentData>());
|
||||
|
||||
return _environment_datas.get(index);
|
||||
}
|
||||
void PlanetData::set_environment_data(const int index, const Ref<EnvironmentData> environment_data) {
|
||||
ERR_FAIL_INDEX(index, _environment_datas.size());
|
||||
|
||||
_environment_datas.set(index, environment_data);
|
||||
}
|
||||
void PlanetData::add_environment_data(const Ref<EnvironmentData> environment_data) {
|
||||
_environment_datas.push_back(environment_data);
|
||||
}
|
||||
void PlanetData::remove_environment_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _environment_datas.size());
|
||||
|
||||
_environment_datas.remove(index);
|
||||
}
|
||||
int PlanetData::get_environment_data_count() const {
|
||||
return _environment_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> PlanetData::get_environment_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _environment_datas.size(); i++) {
|
||||
r.push_back(_environment_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void PlanetData::set_environment_datas(const Vector<Variant> &environment_datas) {
|
||||
_environment_datas.clear();
|
||||
for (int i = 0; i < environment_datas.size(); i++) {
|
||||
Ref<EnvironmentData> environment_data = Ref<EnvironmentData>(environment_datas[i]);
|
||||
|
||||
_environment_datas.push_back(environment_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Planet> PlanetData::setup_planet(int seed) {
|
||||
if (has_method("_setup_planet")) {
|
||||
return call("_setup_planet", seed);
|
||||
@ -104,4 +143,16 @@ void PlanetData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_biome_datas"), &PlanetData::get_biome_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_biome_datas", "biome_datas"), &PlanetData::set_biome_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "biome_datas", PROPERTY_HINT_NONE, "17/17:BiomeData", PROPERTY_USAGE_DEFAULT, "BiomeData"), "set_biome_datas", "get_biome_datas");
|
||||
|
||||
//Environments
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &PlanetData::get_environment_data);
|
||||
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");
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "../main/planet.h"
|
||||
#include "../data/biome_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
class PlanetData : public Resource {
|
||||
GDCLASS(PlanetData, Resource);
|
||||
@ -21,6 +22,7 @@ public:
|
||||
Ref<FastnoiseNoiseParams> get_temperature_noise_params();
|
||||
void set_temperature_noise_params(Ref<FastnoiseNoiseParams> value);
|
||||
|
||||
//Biomes
|
||||
Ref<BiomeData> get_biome_data(const int index) const;
|
||||
void set_biome_data(const int index, const Ref<BiomeData> biome_data);
|
||||
void add_biome_data(const Ref<BiomeData> biome_data);
|
||||
@ -31,6 +33,17 @@ public:
|
||||
Vector<Variant> get_biome_datas();
|
||||
void set_biome_datas(const Vector<Variant> &biome_datas);
|
||||
|
||||
//Environments
|
||||
Ref<EnvironmentData> get_environment_data(const int index) const;
|
||||
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);
|
||||
|
||||
PlanetData();
|
||||
@ -45,6 +58,7 @@ private:
|
||||
Ref<FastnoiseNoiseParams> _humidity_noise_params;
|
||||
Ref<FastnoiseNoiseParams> _temperature_noise_params;
|
||||
Vector<Ref<BiomeData> > _biome_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,12 @@
|
||||
#include "biome.h"
|
||||
|
||||
Ref<EnvironmentData> Biome::get_environment() {
|
||||
return _environment;
|
||||
}
|
||||
void Biome::set_environment(Ref<EnvironmentData> value) {
|
||||
_environment = value;
|
||||
}
|
||||
|
||||
//// Prop Data ////
|
||||
Ref<PropData> Biome::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
@ -64,7 +71,9 @@ Biome::Biome() {
|
||||
|
||||
}
|
||||
Biome::~Biome() {
|
||||
|
||||
_environment.unref();
|
||||
_prop_datas.clear();
|
||||
_dungeons.clear();
|
||||
}
|
||||
|
||||
void Biome::_bind_methods() {
|
||||
@ -74,6 +83,9 @@ void Biome::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Biome::generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("generate_stack", "chunk", "x", "z"), &Biome::generate_stack);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &Biome::get_environment);
|
||||
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_prop_data", "index"), &Biome::get_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("set_prop_data", "index", "data"), &Biome::set_prop_data);
|
||||
|
13
main/biome.h
13
main/biome.h
@ -1,17 +1,21 @@
|
||||
#ifndef BIOME_H
|
||||
#define BIOME_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../data/prop_data.h"
|
||||
#include "dungeon.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
|
||||
class Biome : public Resource {
|
||||
GDCLASS(Biome, Resource);
|
||||
class Biome : public Reference {
|
||||
GDCLASS(Biome, Reference);
|
||||
|
||||
public:
|
||||
//Environment
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
|
||||
//PropData
|
||||
Ref<PropData> get_prop_data(const int index) const;
|
||||
void set_prop_data(const int index, const Ref<PropData> prop_data);
|
||||
@ -38,6 +42,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Ref<EnvironmentData> _environment;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
Vector<Ref<Dungeon> > _dungeons;
|
||||
};
|
||||
|
@ -1,5 +1,12 @@
|
||||
#include "dungeon.h"
|
||||
|
||||
Ref<EnvironmentData> Dungeon::get_environment() {
|
||||
return _environment;
|
||||
}
|
||||
void Dungeon::set_environment(Ref<EnvironmentData> value) {
|
||||
_environment = value;
|
||||
}
|
||||
|
||||
Ref<DungeonRoom> Dungeon::get_dungeon_room(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _dungeon_rooms.size(), Ref<DungeonRoom>());
|
||||
|
||||
@ -39,7 +46,8 @@ Dungeon::Dungeon() {
|
||||
|
||||
}
|
||||
Dungeon::~Dungeon() {
|
||||
|
||||
_environment.unref();
|
||||
_dungeon_rooms.clear();
|
||||
}
|
||||
|
||||
void Dungeon::_bind_methods() {
|
||||
@ -49,6 +57,10 @@ void Dungeon::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Dungeon::generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("generate_structure", "structure"), &Dungeon::generate_structure);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &Dungeon::get_environment);
|
||||
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_dungeon_room", "index"), &Dungeon::get_dungeon_room);
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_room", "index", "data"), &Dungeon::set_dungeon_room);
|
||||
ClassDB::bind_method(D_METHOD("add_dungeon_room", "dungeon_room"), &Dungeon::add_dungeon_room);
|
||||
|
@ -1,17 +1,22 @@
|
||||
#ifndef DUNGEON_H
|
||||
#define DUNGEON_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "dungeon_room.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
class Dungeon : public Reference {
|
||||
GDCLASS(Dungeon, Reference);
|
||||
|
||||
public:
|
||||
//Environment
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
|
||||
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);
|
||||
@ -29,7 +34,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Ref<EnvironmentData> _environment;
|
||||
Vector<Ref<DungeonRoom> > _dungeon_rooms;
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
#include "dungeon_room.h"
|
||||
|
||||
Ref<EnvironmentData> DungeonRoom::get_environment() {
|
||||
return _environment;
|
||||
}
|
||||
void DungeonRoom::set_environment(Ref<EnvironmentData> value) {
|
||||
_environment = value;
|
||||
}
|
||||
|
||||
Ref<PropData> DungeonRoom::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
|
||||
@ -39,7 +46,8 @@ DungeonRoom::DungeonRoom() {
|
||||
|
||||
}
|
||||
DungeonRoom::~DungeonRoom() {
|
||||
|
||||
_environment.unref();
|
||||
_prop_datas.clear();
|
||||
}
|
||||
|
||||
void DungeonRoom::_bind_methods() {
|
||||
@ -49,6 +57,10 @@ void DungeonRoom::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &DungeonRoom::generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("generate_room", "structure"), &DungeonRoom::generate_room);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &DungeonRoom::get_environment);
|
||||
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_prop_data", "index"), &DungeonRoom::get_prop_data);
|
||||
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);
|
||||
|
@ -7,11 +7,16 @@
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
#include "../data/prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
class DungeonRoom : public Reference {
|
||||
GDCLASS(DungeonRoom, Reference);
|
||||
|
||||
public:
|
||||
//Environment
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
|
||||
Ref<PropData> get_prop_data(const int index) const;
|
||||
void set_prop_data(const int index, const Ref<PropData> prop_data);
|
||||
void add_prop_data(const Ref<PropData> prop_data);
|
||||
@ -29,7 +34,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Ref<EnvironmentData> _environment;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
#include "planet.h"
|
||||
|
||||
Ref<EnvironmentData> Planet::get_environment() {
|
||||
return _environment;
|
||||
}
|
||||
void Planet::set_environment(Ref<EnvironmentData> value) {
|
||||
_environment = value;
|
||||
}
|
||||
|
||||
Ref<Biome> Planet::get_biome(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _biomes.size(), Ref<Biome>());
|
||||
|
||||
@ -33,7 +40,8 @@ Planet::Planet() {
|
||||
|
||||
}
|
||||
Planet::~Planet() {
|
||||
|
||||
_environment.unref();
|
||||
_biomes.clear();
|
||||
}
|
||||
|
||||
void Planet::_bind_methods() {
|
||||
@ -41,6 +49,10 @@ void Planet::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &Planet::get_environment);
|
||||
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_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);
|
||||
|
@ -1,15 +1,20 @@
|
||||
#ifndef PLANET_H
|
||||
#define PLANET_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "biome.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
class Planet : public Resource {
|
||||
GDCLASS(Planet, Resource);
|
||||
class Planet : public Reference {
|
||||
GDCLASS(Planet, Reference);
|
||||
|
||||
public:
|
||||
//Environment
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
|
||||
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);
|
||||
@ -26,6 +31,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Ref<EnvironmentData> _environment;
|
||||
Vector<Ref<Biome> > _biomes;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user