mirror of
https://github.com/Relintai/world_generator.git
synced 2024-11-12 10:15:07 +01:00
Renamed PropData to WorldGeneratorPropData.
This commit is contained in:
parent
72fdb52731
commit
128f40a6f6
2
SCsub
2
SCsub
@ -13,7 +13,7 @@ env.add_source_files(env.modules_sources,"data/dungeon_corridor_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,"data/world_generator_prop_data.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"world_generator.cpp")
|
||||
|
||||
|
@ -64,17 +64,17 @@ void BiomeData::set_dungeon_datas(const Vector<Variant> &dungeon_datas) {
|
||||
|
||||
//// PROP DATA ////
|
||||
|
||||
Ref<PropData> BiomeData::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
Ref<WorldGeneratorPropData> BiomeData::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<WorldGeneratorPropData>());
|
||||
|
||||
return _prop_datas.get(index);
|
||||
}
|
||||
void BiomeData::set_prop_data(const int index, const Ref<PropData> prop_data) {
|
||||
void BiomeData::set_prop_data(const int index, const Ref<WorldGeneratorPropData> 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) {
|
||||
void BiomeData::add_prop_data(const Ref<WorldGeneratorPropData> prop_data) {
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
void BiomeData::remove_prop_data(const int index) {
|
||||
@ -97,7 +97,7 @@ Vector<Variant> BiomeData::get_prop_datas() {
|
||||
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]);
|
||||
Ref<WorldGeneratorPropData> prop_data = Ref<WorldGeneratorPropData>(prop_datas[i]);
|
||||
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
@ -229,7 +229,7 @@ void BiomeData::_bind_methods() {
|
||||
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
|
||||
//WorldGeneratorPropData
|
||||
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);
|
||||
@ -239,7 +239,7 @@ 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");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_datas", PROPERTY_HINT_NONE, "17/17:WorldGeneratorPropData", PROPERTY_USAGE_DEFAULT, "WorldGeneratorPropData"), "set_prop_datas", "get_prop_datas");
|
||||
|
||||
//Entities
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &BiomeData::get_entity_data);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "../main/biome.h"
|
||||
#include "dungeon_data.h"
|
||||
#include "prop_data.h"
|
||||
#include "world_generator_prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../entity_spell_system/entities/data/entity_data.h"
|
||||
|
||||
@ -35,10 +35,10 @@ public:
|
||||
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);
|
||||
//WorldGeneratorPropData
|
||||
Ref<WorldGeneratorPropData> get_prop_data(const int index) const;
|
||||
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;
|
||||
@ -83,7 +83,7 @@ private:
|
||||
Vector2 _temperature_range;
|
||||
|
||||
Vector<Ref<DungeonData> > _dungeon_datas;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
};
|
||||
|
@ -52,17 +52,17 @@ void DungeonRoomData::set_max_sizez(int value) {
|
||||
}
|
||||
|
||||
//Props
|
||||
Ref<PropData> DungeonRoomData::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
Ref<WorldGeneratorPropData> DungeonRoomData::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<WorldGeneratorPropData>());
|
||||
|
||||
return _prop_datas.get(index);
|
||||
}
|
||||
void DungeonRoomData::set_prop_data(const int index, const Ref<PropData> prop_data) {
|
||||
void DungeonRoomData::set_prop_data(const int index, const Ref<WorldGeneratorPropData> 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) {
|
||||
void DungeonRoomData::add_prop_data(const Ref<WorldGeneratorPropData> prop_data) {
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
void DungeonRoomData::remove_prop_data(const int index) {
|
||||
@ -84,7 +84,7 @@ Vector<Variant> DungeonRoomData::get_prop_datas() {
|
||||
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]);
|
||||
Ref<WorldGeneratorPropData> prop_data = Ref<WorldGeneratorPropData>(prop_datas[i]);
|
||||
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
@ -234,7 +234,7 @@ 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");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_datas", PROPERTY_HINT_NONE, "17/17:WorldGeneratorPropData", PROPERTY_USAGE_DEFAULT, "WorldGeneratorPropData"), "set_prop_datas", "get_prop_datas");
|
||||
|
||||
//Entities
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &DungeonRoomData::get_entity_data);
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "../main/dungeon_room.h"
|
||||
#include "prop_data.h"
|
||||
#include "world_generator_prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
|
||||
#include "../../entity_spell_system/entities/data/entity_data.h"
|
||||
@ -37,9 +37,9 @@ public:
|
||||
void set_max_sizez(int value);
|
||||
|
||||
//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);
|
||||
Ref<WorldGeneratorPropData> get_prop_data(const int index) const;
|
||||
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;
|
||||
@ -88,7 +88,7 @@ private:
|
||||
int _max_sizey;
|
||||
int _max_sizez;
|
||||
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
};
|
||||
|
@ -1,32 +0,0 @@
|
||||
#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);
|
||||
}
|
32
data/world_generator_prop_data.cpp
Normal file
32
data/world_generator_prop_data.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "world_generator_prop_data.h"
|
||||
|
||||
bool WorldGeneratorPropData::can_spawn(int seed) {
|
||||
if (has_method("_can_spawn")) {
|
||||
return call("_can_spawn", seed);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Ref<VoxelmanProp> WorldGeneratorPropData::get_prop(int seed) {
|
||||
if (has_method("_get_prop")) {
|
||||
return call("_get_prop", seed);
|
||||
}
|
||||
|
||||
return Ref<VoxelmanProp>(NULL);
|
||||
}
|
||||
|
||||
WorldGeneratorPropData::WorldGeneratorPropData() {
|
||||
|
||||
}
|
||||
WorldGeneratorPropData::~WorldGeneratorPropData() {
|
||||
|
||||
}
|
||||
|
||||
void WorldGeneratorPropData::_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"), &WorldGeneratorPropData::can_spawn);
|
||||
ClassDB::bind_method(D_METHOD("get_prop", "seed"), &WorldGeneratorPropData::get_prop);
|
||||
}
|
@ -5,16 +5,16 @@
|
||||
|
||||
#include "../../voxelman/props/voxelman_prop.h"
|
||||
|
||||
class PropData : public Resource {
|
||||
GDCLASS(PropData, Resource);
|
||||
class WorldGeneratorPropData : public Resource {
|
||||
GDCLASS(WorldGeneratorPropData, Resource);
|
||||
|
||||
public:
|
||||
|
||||
bool can_spawn(int seed);
|
||||
Ref<VoxelmanProp> get_prop(int seed);
|
||||
|
||||
PropData();
|
||||
~PropData();
|
||||
WorldGeneratorPropData();
|
||||
~WorldGeneratorPropData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
@ -15,17 +15,17 @@ void Biome::set_environment(Ref<EnvironmentData> value) {
|
||||
}
|
||||
|
||||
//// Prop Data ////
|
||||
Ref<PropData> Biome::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
Ref<WorldGeneratorPropData> Biome::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<WorldGeneratorPropData>());
|
||||
|
||||
return _prop_datas.get(index);
|
||||
}
|
||||
void Biome::set_prop_data(const int index, const Ref<PropData> prop_data) {
|
||||
void Biome::set_prop_data(const int index, const Ref<WorldGeneratorPropData> 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) {
|
||||
void Biome::add_prop_data(const Ref<WorldGeneratorPropData> prop_data) {
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
void Biome::remove_prop_data(const int index) {
|
||||
|
12
main/biome.h
12
main/biome.h
@ -4,7 +4,7 @@
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../data/prop_data.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"
|
||||
@ -20,10 +20,10 @@ public:
|
||||
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);
|
||||
void add_prop_data(const Ref<PropData> prop_data);
|
||||
//WorldGeneratorPropData
|
||||
Ref<WorldGeneratorPropData> get_prop_data(const int index) const;
|
||||
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;
|
||||
@ -59,7 +59,7 @@ private:
|
||||
Vector2 _level_range;
|
||||
|
||||
Ref<EnvironmentData> _environment;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<Dungeon> > _dungeons;
|
||||
};
|
||||
|
@ -73,17 +73,17 @@ void DungeonRoom::set_structure(Ref<VoxelStructure> structure) {
|
||||
}
|
||||
|
||||
//Props
|
||||
Ref<PropData> DungeonRoom::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<PropData>());
|
||||
Ref<WorldGeneratorPropData> DungeonRoom::get_prop_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<WorldGeneratorPropData>());
|
||||
|
||||
return _prop_datas.get(index);
|
||||
}
|
||||
void DungeonRoom::set_prop_data(const int index, const Ref<PropData> prop_data) {
|
||||
void DungeonRoom::set_prop_data(const int index, const Ref<WorldGeneratorPropData> 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) {
|
||||
void DungeonRoom::add_prop_data(const Ref<WorldGeneratorPropData> prop_data) {
|
||||
_prop_datas.push_back(prop_data);
|
||||
}
|
||||
void DungeonRoom::remove_prop_data(const int index) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
#include "../data/prop_data.h"
|
||||
#include "../data/world_generator_prop_data.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../entity_spell_system/entities/data/entity_data.h"
|
||||
|
||||
@ -49,9 +49,9 @@ public:
|
||||
void set_structure(Ref<VoxelStructure> structure);
|
||||
|
||||
//Props
|
||||
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);
|
||||
Ref<WorldGeneratorPropData> get_prop_data(const int index) const;
|
||||
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;
|
||||
@ -90,7 +90,7 @@ private:
|
||||
|
||||
Ref<EnvironmentData> _environment;
|
||||
Ref<VoxelStructure> _structure;
|
||||
Vector<Ref<PropData> > _prop_datas;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "data/dungeon_data.h"
|
||||
#include "data/biome_data.h"
|
||||
#include "data/planet_data.h"
|
||||
#include "data/prop_data.h"
|
||||
#include "data/world_generator_prop_data.h"
|
||||
|
||||
#include "main/dungeon_room.h"
|
||||
#include "main/dungeon_corridor.h"
|
||||
@ -21,7 +21,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<WorldGeneratorPropData>();
|
||||
|
||||
ClassDB::register_class<DungeonRoom>();
|
||||
ClassDB::register_class<DungeonCorridor>();
|
||||
|
Loading…
Reference in New Issue
Block a user