mirror of
https://github.com/Relintai/world_generator.git
synced 2024-11-12 10:15:07 +01:00
Added in the bindings, and variables that I planned.
This commit is contained in:
parent
16ae08568a
commit
e60f95da9a
27
SCsub
27
SCsub
@ -1,16 +1,17 @@
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.modules_sources,"register_types.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"main/dungeon_room.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/dungeon.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/biome.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/planet.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"data/dungeon_room_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/dungeon_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/biome_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/planet_data.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"world_generator.cpp")
|
||||
env.add_source_files(env.modules_sources,"register_types.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"main/dungeon_room.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/dungeon.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/biome.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/planet.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"data/dungeon_room_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/dungeon_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/biome_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/planet_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/prop_data.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"world_generator.cpp")
|
||||
|
||||
|
@ -1,5 +1,101 @@
|
||||
#include "biome_data.h"
|
||||
|
||||
Vector2 BiomeData::get_humidity_range() {
|
||||
return _humidity_range;
|
||||
}
|
||||
void BiomeData::set_humidity_range(Vector2 range) {
|
||||
_humidity_range = range;
|
||||
}
|
||||
|
||||
Vector2 BiomeData::get_temperature_range() {
|
||||
return _temperature_range;
|
||||
}
|
||||
void BiomeData::set_temperature_range(Vector2 range) {
|
||||
_temperature_range = range;
|
||||
}
|
||||
|
||||
//// DungeonData ////
|
||||
|
||||
Ref<DungeonData> BiomeData::get_dungeon_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _dungeon_datas.size(), Ref<DungeonData>());
|
||||
|
||||
return _dungeon_datas.get(index);
|
||||
}
|
||||
void BiomeData::set_dungeon_data(const int index, const Ref<DungeonData> dungeon_data) {
|
||||
ERR_FAIL_INDEX(index, _dungeon_datas.size());
|
||||
|
||||
_dungeon_datas.set(index, dungeon_data);
|
||||
}
|
||||
void BiomeData::add_dungeon_data(const Ref<DungeonData> dungeon_data) {
|
||||
_dungeon_datas.push_back(dungeon_data);
|
||||
}
|
||||
void BiomeData::remove_dungeon_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _dungeon_datas.size());
|
||||
|
||||
_dungeon_datas.remove(index);
|
||||
}
|
||||
|
||||
int BiomeData::get_dungeon_data_count() const {
|
||||
return _dungeon_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> BiomeData::get_dungeon_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _dungeon_datas.size(); i++) {
|
||||
r.push_back(_dungeon_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void BiomeData::set_dungeon_datas(const Vector<Variant> &dungeon_datas) {
|
||||
_dungeon_datas.clear();
|
||||
for (int i = 0; i < dungeon_datas.size(); i++) {
|
||||
Ref<DungeonData> dungeon_data = Ref<DungeonData>(dungeon_datas[i]);
|
||||
|
||||
_dungeon_datas.push_back(dungeon_data);
|
||||
}
|
||||
}
|
||||
|
||||
//// PROP DATA ////
|
||||
|
||||
Ref<PropData> BiomeData::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
|
||||
return _prop_datas.get(index);
|
||||
}
|
||||
void BiomeData::set_prop_data(const int index, const Ref<PropData> prop_data) {
|
||||
ERR_FAIL_INDEX(index, _prop_datas.size());
|
||||
|
||||
_prop_datas.set(index, prop_data);
|
||||
}
|
||||
void BiomeData::add_prop_data(const Ref<PropData> prop_data) {
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
void BiomeData::remove_prop_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _prop_datas.size());
|
||||
|
||||
_prop_datas.remove(index);
|
||||
}
|
||||
|
||||
int BiomeData::get_prop_data_count() const {
|
||||
return _prop_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> BiomeData::get_prop_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _prop_datas.size(); i++) {
|
||||
r.push_back(_prop_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void BiomeData::set_prop_datas(const Vector<Variant> &prop_datas) {
|
||||
_prop_datas.clear();
|
||||
for (int i = 0; i < prop_datas.size(); i++) {
|
||||
Ref<PropData> prop_data = Ref<PropData>(prop_datas[i]);
|
||||
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Biome> BiomeData::setup_biome(int seed) {
|
||||
if (has_method("_setup_biome")) {
|
||||
return call("_setup_biome", seed);
|
||||
@ -12,11 +108,44 @@ BiomeData::BiomeData() {
|
||||
|
||||
}
|
||||
BiomeData::~BiomeData() {
|
||||
|
||||
_dungeon_datas.clear();
|
||||
_prop_datas.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("setup_biome", "seed"), &BiomeData::setup_biome);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_humidity_range"), &BiomeData::get_humidity_range);
|
||||
ClassDB::bind_method(D_METHOD("set_humidity_range", "value"), &BiomeData::set_humidity_range);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "humidity_range"), "set_humidity_range", "get_humidity_range");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_temperature_range"), &BiomeData::get_temperature_range);
|
||||
ClassDB::bind_method(D_METHOD("set_temperature_range", "value"), &BiomeData::set_temperature_range);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "temperature_range"), "set_temperature_range", "get_temperature_range");
|
||||
|
||||
//DungeonDatas
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_data", "index"), &BiomeData::get_dungeon_data);
|
||||
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);
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_datas", "dungeon_datas"), &BiomeData::set_dungeon_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "dungeon_datas", PROPERTY_HINT_NONE, "17/17:DungeonData", PROPERTY_USAGE_DEFAULT, "DungeonData"), "set_dungeon_datas", "get_dungeon_datas");
|
||||
|
||||
//PropData
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data", "index"), &BiomeData::get_prop_data);
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
@ -1,14 +1,45 @@
|
||||
#ifndef BIOME_DATA_H
|
||||
#define BIOME_DATA_H
|
||||
#ifndef dungeon_data_H
|
||||
#define dungeon_data_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
#include "core/math/vector2.h"
|
||||
|
||||
#include "../main/biome.h"
|
||||
#include "dungeon_data.h"
|
||||
#include "prop_data.h"
|
||||
|
||||
class BiomeData : public Resource {
|
||||
GDCLASS(BiomeData, Resource);
|
||||
|
||||
public:
|
||||
Vector2 get_humidity_range();
|
||||
void set_humidity_range(Vector2 range);
|
||||
|
||||
Vector2 get_temperature_range();
|
||||
void set_temperature_range(Vector2 range);
|
||||
|
||||
//DungeonData
|
||||
Ref<DungeonData> get_dungeon_data(const int index) const;
|
||||
void set_dungeon_data(const int index, const Ref<DungeonData> dungeon_data);
|
||||
void add_dungeon_data(const Ref<DungeonData> dungeon_data);
|
||||
void remove_dungeon_data(const int index);
|
||||
|
||||
int get_dungeon_data_count() const;
|
||||
|
||||
Vector<Variant> get_dungeon_datas();
|
||||
void set_dungeon_datas(const Vector<Variant> &dungeon_datas);
|
||||
|
||||
//PropData
|
||||
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);
|
||||
void remove_prop_data(const int index);
|
||||
|
||||
int get_prop_data_count() const;
|
||||
|
||||
Vector<Variant> get_prop_datas();
|
||||
void set_prop_datas(const Vector<Variant> &prop_datas);
|
||||
|
||||
Ref<Biome> setup_biome(int seed);
|
||||
|
||||
@ -20,10 +51,10 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
//Vector2 _humidity_range;
|
||||
//Vector2 _temperature_range;
|
||||
//Vector<DungeonData> _dungeon_datas;
|
||||
//Vector<Ref<VoxelmanProp> > _props;
|
||||
Vector2 _humidity_range;
|
||||
Vector2 _temperature_range;
|
||||
Vector<Ref<DungeonData> > _dungeon_datas;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,44 @@
|
||||
#include "dungeon_data.h"
|
||||
|
||||
Ref<DungeonRoomData> DungeonData::get_dungeon_room_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _dungeon_room_datas.size(), Ref<DungeonRoomData>());
|
||||
|
||||
return _dungeon_room_datas.get(index);
|
||||
}
|
||||
void DungeonData::set_dungeon_room_data(const int index, const Ref<DungeonRoomData> dungeon_room_data) {
|
||||
ERR_FAIL_INDEX(index, _dungeon_room_datas.size());
|
||||
|
||||
_dungeon_room_datas.set(index, dungeon_room_data);
|
||||
}
|
||||
void DungeonData::add_dungeon_room_data(const Ref<DungeonRoomData> dungeon_room_data) {
|
||||
_dungeon_room_datas.push_back(dungeon_room_data);
|
||||
}
|
||||
void DungeonData::remove_dungeon_room_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _dungeon_room_datas.size());
|
||||
|
||||
_dungeon_room_datas.remove(index);
|
||||
}
|
||||
|
||||
int DungeonData::get_dungeon_room_data_count() const {
|
||||
return _dungeon_room_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> DungeonData::get_dungeon_room_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _dungeon_room_datas.size(); i++) {
|
||||
r.push_back(_dungeon_room_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void DungeonData::set_dungeon_room_datas(const Vector<Variant> &dungeon_room_datas) {
|
||||
_dungeon_room_datas.clear();
|
||||
for (int i = 0; i < dungeon_room_datas.size(); i++) {
|
||||
Ref<DungeonRoomData> dungeon_room_data = Ref<DungeonRoomData>(dungeon_room_datas[i]);
|
||||
|
||||
_dungeon_room_datas.push_back(dungeon_room_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Dungeon> DungeonData::setup_dungeon(int seed) {
|
||||
if (has_method("_setup_dungeon")) {
|
||||
return call("_setup_dungeon", seed);
|
||||
@ -19,4 +58,15 @@ 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("setup_dungeon", "seed"), &DungeonData::setup_dungeon);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_room_data", "index"), &DungeonData::get_dungeon_room_data);
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
@ -2,13 +2,25 @@
|
||||
#define DUNGEON_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "../main/dungeon.h"
|
||||
#include "dungeon_room_data.h"
|
||||
|
||||
class DungeonData : public Resource {
|
||||
GDCLASS(DungeonData, Resource);
|
||||
|
||||
public:
|
||||
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);
|
||||
void remove_dungeon_room_data(const int index);
|
||||
|
||||
int get_dungeon_room_data_count() const;
|
||||
|
||||
Vector<Variant> get_dungeon_room_datas();
|
||||
void set_dungeon_room_datas(const Vector<Variant> &dungeon_room_datas);
|
||||
|
||||
Ref<Dungeon> setup_dungeon(int seed);
|
||||
|
||||
DungeonData();
|
||||
@ -18,7 +30,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
//Vector<Ref<DungeonRoomData> > _rooms;
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_room_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,44 @@
|
||||
#include "dungeon_room_data.h"
|
||||
|
||||
Ref<PropData> DungeonRoomData::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
|
||||
return _prop_datas.get(index);
|
||||
}
|
||||
void DungeonRoomData::set_prop_data(const int index, const Ref<PropData> prop_data) {
|
||||
ERR_FAIL_INDEX(index, _prop_datas.size());
|
||||
|
||||
_prop_datas.set(index, prop_data);
|
||||
}
|
||||
void DungeonRoomData::add_prop_data(const Ref<PropData> prop_data) {
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
void DungeonRoomData::remove_prop_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _prop_datas.size());
|
||||
|
||||
_prop_datas.remove(index);
|
||||
}
|
||||
|
||||
int DungeonRoomData::get_prop_data_count() const {
|
||||
return _prop_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> DungeonRoomData::get_prop_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _prop_datas.size(); i++) {
|
||||
r.push_back(_prop_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void DungeonRoomData::set_prop_datas(const Vector<Variant> &prop_datas) {
|
||||
_prop_datas.clear();
|
||||
for (int i = 0; i < prop_datas.size(); i++) {
|
||||
Ref<PropData> prop_data = Ref<PropData>(prop_datas[i]);
|
||||
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<DungeonRoom> DungeonRoomData::setup_room(int seed) {
|
||||
if (has_method("_setup_room")) {
|
||||
return call("_setup_room", seed);
|
||||
@ -19,4 +58,15 @@ void DungeonRoomData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "DungeonRoom"), "_setup_room", PropertyInfo(Variant::INT, "seed")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_room", "seed"), &DungeonRoomData::setup_room);
|
||||
|
||||
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);
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
@ -4,11 +4,21 @@
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "../main/dungeon_room.h"
|
||||
#include "prop_data.h"
|
||||
|
||||
class DungeonRoomData : public Resource {
|
||||
GDCLASS(DungeonRoomData, Resource);
|
||||
|
||||
public:
|
||||
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);
|
||||
void remove_prop_data(const int index);
|
||||
|
||||
int get_prop_data_count() const;
|
||||
|
||||
Vector<Variant> get_prop_datas();
|
||||
void set_prop_datas(const Vector<Variant> &prop_datas);
|
||||
|
||||
Ref<DungeonRoom> setup_room(int seed);
|
||||
|
||||
@ -19,7 +29,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
//Vector<VoxelmanProp> _props;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,65 @@
|
||||
#include "planet_data.h"
|
||||
|
||||
int PlanetData::get_id() const {
|
||||
return _id;
|
||||
}
|
||||
void PlanetData::set_id(const int value) {
|
||||
_id = value;
|
||||
}
|
||||
|
||||
Ref<FastnoiseNoiseParams> PlanetData::get_humidity_noise_params() {
|
||||
return _humidity_noise_params;
|
||||
}
|
||||
void PlanetData::set_humidity_noise_params(Ref<FastnoiseNoiseParams> value) {
|
||||
_humidity_noise_params = value;
|
||||
}
|
||||
|
||||
Ref<FastnoiseNoiseParams> PlanetData::get_temperature_noise_params() {
|
||||
return _temperature_noise_params;
|
||||
}
|
||||
void PlanetData::set_temperature_noise_params(Ref<FastnoiseNoiseParams> value) {
|
||||
_temperature_noise_params = value;
|
||||
}
|
||||
|
||||
Ref<BiomeData> PlanetData::get_biome_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _biome_datas.size(), Ref<BiomeData>());
|
||||
|
||||
return _biome_datas.get(index);
|
||||
}
|
||||
void PlanetData::set_biome_data(const int index, const Ref<BiomeData> biome_data) {
|
||||
ERR_FAIL_INDEX(index, _biome_datas.size());
|
||||
|
||||
_biome_datas.set(index, biome_data);
|
||||
}
|
||||
void PlanetData::add_biome_data(const Ref<BiomeData> biome_data) {
|
||||
_biome_datas.push_back(biome_data);
|
||||
}
|
||||
void PlanetData::remove_biome_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _biome_datas.size());
|
||||
|
||||
_biome_datas.remove(index);
|
||||
}
|
||||
|
||||
int PlanetData::get_biome_data_count() const {
|
||||
return _biome_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> PlanetData::get_biome_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _biome_datas.size(); i++) {
|
||||
r.push_back(_biome_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void PlanetData::set_biome_datas(const Vector<Variant> &biome_datas) {
|
||||
_biome_datas.clear();
|
||||
for (int i = 0; i < biome_datas.size(); i++) {
|
||||
Ref<BiomeData> biome_data = Ref<BiomeData>(biome_datas[i]);
|
||||
|
||||
_biome_datas.push_back(biome_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Planet> PlanetData::setup_planet(int seed) {
|
||||
if (has_method("_setup_planet")) {
|
||||
return call("_setup_planet", seed);
|
||||
@ -9,14 +69,39 @@ Ref<Planet> PlanetData::setup_planet(int seed) {
|
||||
}
|
||||
|
||||
PlanetData::PlanetData() {
|
||||
|
||||
_id = 0;
|
||||
}
|
||||
PlanetData::~PlanetData() {
|
||||
|
||||
_biome_datas.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_humidity_noise_params"), &PlanetData::get_humidity_noise_params);
|
||||
ClassDB::bind_method(D_METHOD("set_humidity_noise_params", "value"), &PlanetData::set_humidity_noise_params);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "humidity_noise_params", PROPERTY_HINT_RESOURCE_TYPE, "FastnoiseNoiseParams"), "set_humidity_noise_params", "get_humidity_noise_params");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_temperature_noise_params"), &PlanetData::get_temperature_noise_params);
|
||||
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");
|
||||
|
||||
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
@ -1,25 +1,35 @@
|
||||
#ifndef PLANET_DATA_H
|
||||
#define PLANET_DATA_H
|
||||
#ifndef biome_data_H
|
||||
#define biome_data_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "../../fastnoise/fastnoise_noise_params.h"
|
||||
|
||||
#include "../main/planet.h"
|
||||
#include "../data/biome_data.h"
|
||||
|
||||
class PlanetData : public Resource {
|
||||
GDCLASS(PlanetData, Resource);
|
||||
|
||||
public:
|
||||
/*
|
||||
Ref<PlanetData> get_planet_data(const int index) const;
|
||||
void set_planet_data(const int index, const Ref<PlanetData> planet_data);
|
||||
void add_planet_data(const Ref<PlanetData> planet_data);
|
||||
void remove_planet_data(const int index);
|
||||
int get_id() const;
|
||||
void set_id(const int value);
|
||||
|
||||
int get_planet_data_count() const;
|
||||
Ref<FastnoiseNoiseParams> get_humidity_noise_params();
|
||||
void set_humidity_noise_params(Ref<FastnoiseNoiseParams> value);
|
||||
|
||||
Vector<Variant> get_planet_datas();
|
||||
void set_planet_datas(const Vector<Variant> &planet_datas);
|
||||
*/
|
||||
Ref<FastnoiseNoiseParams> get_temperature_noise_params();
|
||||
void set_temperature_noise_params(Ref<FastnoiseNoiseParams> value);
|
||||
|
||||
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);
|
||||
void remove_biome_data(const int index);
|
||||
|
||||
int get_biome_data_count() const;
|
||||
|
||||
Vector<Variant> get_biome_datas();
|
||||
void set_biome_datas(const Vector<Variant> &biome_datas);
|
||||
|
||||
Ref<Planet> setup_planet(int seed);
|
||||
|
||||
@ -31,10 +41,10 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
//int _id;
|
||||
//Vector<BiomeData> _biome_datas;
|
||||
//Ref<NoiseParams> _humidity_noise_params;
|
||||
//Ref<NoiseParams> _temperature_noise_params;
|
||||
int _id;
|
||||
Ref<FastnoiseNoiseParams> _humidity_noise_params;
|
||||
Ref<FastnoiseNoiseParams> _temperature_noise_params;
|
||||
Vector<Ref<BiomeData> > _biome_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
32
data/prop_data.cpp
Normal file
32
data/prop_data.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "prop_data.h"
|
||||
|
||||
bool PropData::can_spawn(int seed) {
|
||||
if (has_method("_can_spawn")) {
|
||||
return call("_can_spawn", seed);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Ref<VoxelmanProp> PropData::get_prop(int seed) {
|
||||
if (has_method("_get_prop")) {
|
||||
return call("_get_prop", seed);
|
||||
}
|
||||
|
||||
return Ref<VoxelmanProp>(NULL);
|
||||
}
|
||||
|
||||
PropData::PropData() {
|
||||
|
||||
}
|
||||
PropData::~PropData() {
|
||||
|
||||
}
|
||||
|
||||
void PropData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "can"), "_can_spawn", PropertyInfo(Variant::INT, "seed")));
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanProp"), "_get_prop", PropertyInfo(Variant::INT, "seed")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("can_spawn", "seed"), &PropData::can_spawn);
|
||||
ClassDB::bind_method(D_METHOD("get_prop", "seed"), &PropData::get_prop);
|
||||
}
|
24
data/prop_data.h
Normal file
24
data/prop_data.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef PROP_DATA_H
|
||||
#define PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "../../voxelman/props/voxelman_prop.h"
|
||||
|
||||
class PropData : public Resource {
|
||||
GDCLASS(PropData, Resource);
|
||||
|
||||
public:
|
||||
|
||||
bool can_spawn(int seed);
|
||||
Ref<VoxelmanProp> get_prop(int seed);
|
||||
|
||||
PropData();
|
||||
~PropData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,5 +1,54 @@
|
||||
#include "biome.h"
|
||||
|
||||
//// Prop Data ////
|
||||
Ref<PropData> Biome::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
|
||||
return _prop_datas.get(index);
|
||||
}
|
||||
void Biome::set_prop_data(const int index, const Ref<PropData> prop_data) {
|
||||
ERR_FAIL_INDEX(index, _prop_datas.size());
|
||||
|
||||
_prop_datas.set(index, prop_data);
|
||||
}
|
||||
void Biome::add_prop_data(const Ref<PropData> prop_data) {
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
void Biome::remove_prop_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _prop_datas.size());
|
||||
|
||||
_prop_datas.remove(index);
|
||||
}
|
||||
|
||||
int Biome::get_prop_data_count() const {
|
||||
return _prop_datas.size();
|
||||
}
|
||||
|
||||
//// Dungeons ////
|
||||
Ref<Dungeon> Biome::get_dungeon(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _dungeons.size(), Ref<Dungeon>());
|
||||
|
||||
return _dungeons.get(index);
|
||||
}
|
||||
void Biome::set_dungeon(const int index, const Ref<Dungeon> dungeon) {
|
||||
ERR_FAIL_INDEX(index, _dungeons.size());
|
||||
|
||||
_dungeons.set(index, dungeon);
|
||||
}
|
||||
void Biome::add_dungeon(const Ref<Dungeon> dungeon) {
|
||||
_dungeons.push_back(dungeon);
|
||||
}
|
||||
void Biome::remove_dungeon(const int index) {
|
||||
ERR_FAIL_INDEX(index, _dungeons.size());
|
||||
|
||||
_dungeons.remove(index);
|
||||
}
|
||||
|
||||
int Biome::get_dungeon_count() const {
|
||||
return _dungeons.size();
|
||||
}
|
||||
|
||||
|
||||
void Biome::generate_chunk(Ref<VoxelChunk> chunk) {
|
||||
if (has_method("_generate")) {
|
||||
call("_generate", chunk);
|
||||
@ -24,4 +73,19 @@ 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_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);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon", "index"), &Biome::get_dungeon);
|
||||
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);
|
||||
}
|
||||
|
23
main/biome.h
23
main/biome.h
@ -4,11 +4,30 @@
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../data/prop_data.h"
|
||||
#include "dungeon.h"
|
||||
|
||||
|
||||
class Biome : public Resource {
|
||||
GDCLASS(Biome, Resource);
|
||||
|
||||
public:
|
||||
//PropData
|
||||
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);
|
||||
void remove_prop_data(const int index);
|
||||
|
||||
int get_prop_data_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 generate_chunk(Ref<VoxelChunk> chunk);
|
||||
void generate_stack(Ref<VoxelChunk> chunk, int x, int z);
|
||||
|
||||
@ -19,8 +38,8 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
//Vector<Ref<VoxelmanProp> > _props;
|
||||
//Vector<Ref<Dungeon> > _dungeons;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
Vector<Ref<Dungeon> > _dungeons;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,28 @@
|
||||
#include "dungeon.h"
|
||||
|
||||
Ref<DungeonRoom> Dungeon::get_dungeon_room(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _dungeon_rooms.size(), Ref<DungeonRoom>());
|
||||
|
||||
return _dungeon_rooms.get(index);
|
||||
}
|
||||
void Dungeon::set_dungeon_room(const int index, const Ref<DungeonRoom> dungeon_room) {
|
||||
ERR_FAIL_INDEX(index, _dungeon_rooms.size());
|
||||
|
||||
_dungeon_rooms.set(index, dungeon_room);
|
||||
}
|
||||
void Dungeon::add_dungeon_room(const Ref<DungeonRoom> dungeon_room) {
|
||||
_dungeon_rooms.push_back(dungeon_room);
|
||||
}
|
||||
void Dungeon::remove_dungeon_room(const int index) {
|
||||
ERR_FAIL_INDEX(index, _dungeon_rooms.size());
|
||||
|
||||
_dungeon_rooms.remove(index);
|
||||
}
|
||||
|
||||
int Dungeon::get_dungeon_room_count() const {
|
||||
return _dungeon_rooms.size();
|
||||
}
|
||||
|
||||
void Dungeon::generate(Ref<VoxelStructure> structure) {
|
||||
if (has_method("_generate")) {
|
||||
call("_generate", structure);
|
||||
@ -17,4 +40,11 @@ void Dungeon::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate", "structure"), &Dungeon::generate);
|
||||
|
||||
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);
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_room", "index"), &Dungeon::remove_dungeon_room);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_room_count"), &Dungeon::get_dungeon_room_count);
|
||||
}
|
||||
|
@ -3,12 +3,19 @@
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "dungeon_room.h"
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
|
||||
class Dungeon : public Reference {
|
||||
GDCLASS(Dungeon, Reference);
|
||||
|
||||
public:
|
||||
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;
|
||||
|
||||
void generate(Ref<VoxelStructure> structure);
|
||||
|
||||
@ -20,7 +27,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
//Vector<Ref<DungeonRoopm> > _rooms;
|
||||
Vector<Ref<DungeonRoom> > _dungeon_rooms;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,28 @@
|
||||
#include "dungeon_room.h"
|
||||
|
||||
Ref<PropData> DungeonRoom::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
|
||||
return _prop_datas.get(index);
|
||||
}
|
||||
void DungeonRoom::set_prop_data(const int index, const Ref<PropData> prop_data) {
|
||||
ERR_FAIL_INDEX(index, _prop_datas.size());
|
||||
|
||||
_prop_datas.set(index, prop_data);
|
||||
}
|
||||
void DungeonRoom::add_prop_data(const Ref<PropData> prop_data) {
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
void DungeonRoom::remove_prop_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _prop_datas.size());
|
||||
|
||||
_prop_datas.remove(index);
|
||||
}
|
||||
|
||||
int DungeonRoom::get_prop_data_count() const {
|
||||
return _prop_datas.size();
|
||||
}
|
||||
|
||||
void DungeonRoom::generate_room(Ref<VoxelStructure> structure) {
|
||||
if (has_method("_generate_room")) {
|
||||
call("_generate_room", structure);
|
||||
@ -17,4 +40,11 @@ void DungeonRoom::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate_room", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_room", "structure"), &DungeonRoom::generate_room);
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
@ -2,13 +2,21 @@
|
||||
#define DUNGEON_ROOM_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
#include "../data/prop_data.h"
|
||||
|
||||
class DungeonRoom : public Reference {
|
||||
GDCLASS(DungeonRoom, Reference);
|
||||
|
||||
public:
|
||||
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);
|
||||
void remove_prop_data(const int index);
|
||||
|
||||
int get_prop_data_count() const;
|
||||
|
||||
void generate_room(Ref<VoxelStructure> structure);
|
||||
|
||||
@ -20,7 +28,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
//Vector<Ref<VoxelmanProp> > _props;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,28 @@
|
||||
#include "planet.h"
|
||||
|
||||
Ref<Biome> Planet::get_biome(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _biomes.size(), Ref<Biome>());
|
||||
|
||||
return _biomes.get(index);
|
||||
}
|
||||
void Planet::set_biome(const int index, const Ref<Biome> biome) {
|
||||
ERR_FAIL_INDEX(index, _biomes.size());
|
||||
|
||||
_biomes.set(index, biome);
|
||||
}
|
||||
void Planet::add_biome(const Ref<Biome> biome) {
|
||||
_biomes.push_back(biome);
|
||||
}
|
||||
void Planet::remove_biome(const int index) {
|
||||
ERR_FAIL_INDEX(index, _biomes.size());
|
||||
|
||||
_biomes.remove(index);
|
||||
}
|
||||
|
||||
int Planet::get_biome_count() const {
|
||||
return _biomes.size();
|
||||
}
|
||||
|
||||
void Planet::generate_chunk(Ref<VoxelChunk> chunk) {
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk);
|
||||
@ -17,4 +40,11 @@ void Planet::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk);
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -4,11 +4,19 @@
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "biome.h"
|
||||
|
||||
class Planet : public Resource {
|
||||
GDCLASS(Planet, Resource);
|
||||
|
||||
public:
|
||||
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;
|
||||
|
||||
void generate_chunk(Ref<VoxelChunk> chunk);
|
||||
|
||||
Planet();
|
||||
@ -18,7 +26,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
//Vector<Ref<Biome> > _biomes;
|
||||
Vector<Ref<Biome> > _biomes;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "data/dungeon_data.h"
|
||||
#include "data/biome_data.h"
|
||||
#include "data/planet_data.h"
|
||||
#include "data/prop_data.h"
|
||||
|
||||
#include "main/dungeon_room.h"
|
||||
#include "main/dungeon.h"
|
||||
@ -17,6 +18,7 @@ void register_world_generator_types() {
|
||||
ClassDB::register_class<DungeonData>();
|
||||
ClassDB::register_class<BiomeData>();
|
||||
ClassDB::register_class<PlanetData>();
|
||||
ClassDB::register_class<PropData>();
|
||||
|
||||
ClassDB::register_class<DungeonRoom>();
|
||||
ClassDB::register_class<Dungeon>();
|
||||
|
Loading…
Reference in New Issue
Block a user