2020-01-31 19:57:03 +01:00
|
|
|
/*
|
|
|
|
Copyright (c) 2019-2020 Péter Magyar
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2019-09-24 02:42:42 +02:00
|
|
|
#include "dungeon_room.h"
|
2019-09-22 22:12:20 +02:00
|
|
|
|
2019-11-16 23:43:46 +01:00
|
|
|
int DungeonRoom::get_current_seed() {
|
|
|
|
return _current_seed;
|
2019-10-18 09:43:45 +02:00
|
|
|
}
|
2019-11-16 23:43:46 +01:00
|
|
|
void DungeonRoom::set_current_seed(int value) {
|
|
|
|
_current_seed = value;
|
2019-10-18 09:43:45 +02:00
|
|
|
}
|
|
|
|
|
2019-11-01 15:42:03 +01:00
|
|
|
Vector2 DungeonRoom::get_level_range() {
|
|
|
|
return _level_range;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_level_range(Vector2 value) {
|
|
|
|
_level_range = value;
|
|
|
|
}
|
|
|
|
|
2020-07-21 19:32:21 +02:00
|
|
|
//Min Size
|
|
|
|
int DungeonRoom::get_min_sizex() {
|
|
|
|
return _min_sizex;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_min_sizex(int value) {
|
|
|
|
_min_sizex = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DungeonRoom::get_min_sizey() {
|
|
|
|
return _min_sizey;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_min_sizey(int value) {
|
|
|
|
_min_sizey = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DungeonRoom::get_min_sizez() {
|
|
|
|
return _min_sizez;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_min_sizez(int value) {
|
|
|
|
_min_sizez = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Max Size
|
|
|
|
int DungeonRoom::get_max_sizex() {
|
|
|
|
return _max_sizex;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_max_sizex(int value) {
|
|
|
|
_max_sizex = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DungeonRoom::get_max_sizey() {
|
|
|
|
return _max_sizey;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_max_sizey(int value) {
|
|
|
|
_max_sizey = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DungeonRoom::get_max_sizez() {
|
|
|
|
return _max_sizez;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_max_sizez(int value) {
|
|
|
|
_max_sizez = value;
|
|
|
|
}
|
|
|
|
|
2019-10-18 09:43:45 +02:00
|
|
|
//Position
|
|
|
|
int DungeonRoom::get_posx() {
|
|
|
|
return _posx;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_posx(int value) {
|
|
|
|
_posx = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DungeonRoom::get_posy() {
|
|
|
|
return _posy;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_posy(int value) {
|
|
|
|
_posy = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DungeonRoom::get_posz() {
|
|
|
|
return _posz;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_posz(int value) {
|
|
|
|
_posz = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Size
|
|
|
|
int DungeonRoom::get_sizex() {
|
|
|
|
return _sizex;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_sizex(int value) {
|
|
|
|
_sizex = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DungeonRoom::get_sizey() {
|
|
|
|
return _sizey;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_sizey(int value) {
|
|
|
|
_sizey = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DungeonRoom::get_sizez() {
|
|
|
|
return _sizez;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_sizez(int value) {
|
|
|
|
_sizez = value;
|
|
|
|
}
|
|
|
|
|
2019-12-19 18:49:32 +01:00
|
|
|
#ifdef VOXELMAN_PRESENT
|
2019-10-08 00:18:51 +02:00
|
|
|
Ref<EnvironmentData> DungeonRoom::get_environment() {
|
|
|
|
return _environment;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_environment(Ref<EnvironmentData> value) {
|
|
|
|
_environment = value;
|
|
|
|
}
|
2019-12-19 18:49:32 +01:00
|
|
|
#endif
|
2019-10-08 00:18:51 +02:00
|
|
|
|
2019-12-19 18:49:32 +01:00
|
|
|
#ifdef VOXELMAN_PRESENT
|
2019-10-18 10:45:02 +02:00
|
|
|
Ref<VoxelStructure> DungeonRoom::get_structure() {
|
|
|
|
return _structure;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_structure(Ref<VoxelStructure> structure) {
|
|
|
|
_structure = structure;
|
|
|
|
}
|
2019-12-19 18:49:32 +01:00
|
|
|
#endif
|
2019-10-18 10:45:02 +02:00
|
|
|
|
|
|
|
//Props
|
2019-11-07 19:47:59 +01:00
|
|
|
Ref<WorldGeneratorPropData> DungeonRoom::get_prop_data(const int index) const {
|
|
|
|
ERR_FAIL_INDEX_V(index, _prop_datas.size(), Ref<WorldGeneratorPropData>());
|
2019-09-24 15:08:43 +02:00
|
|
|
|
|
|
|
return _prop_datas.get(index);
|
|
|
|
}
|
2019-11-07 19:47:59 +01:00
|
|
|
void DungeonRoom::set_prop_data(const int index, const Ref<WorldGeneratorPropData> prop_data) {
|
2019-09-24 15:08:43 +02:00
|
|
|
ERR_FAIL_INDEX(index, _prop_datas.size());
|
|
|
|
|
|
|
|
_prop_datas.set(index, prop_data);
|
|
|
|
}
|
2019-11-07 19:47:59 +01:00
|
|
|
void DungeonRoom::add_prop_data(const Ref<WorldGeneratorPropData> prop_data) {
|
2019-09-24 15:08:43 +02:00
|
|
|
_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();
|
|
|
|
}
|
|
|
|
|
2020-07-21 19:32:21 +02:00
|
|
|
Vector<Variant> DungeonRoom::get_prop_datas() {
|
|
|
|
Vector<Variant> r;
|
|
|
|
for (int i = 0; i < _prop_datas.size(); i++) {
|
|
|
|
#if VERSION_MAJOR < 4
|
|
|
|
r.push_back(_prop_datas[i].get_ref_ptr());
|
|
|
|
#else
|
|
|
|
r.push_back(_prop_datas[i]);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_prop_datas(const Vector<Variant> &prop_datas) {
|
|
|
|
_prop_datas.clear();
|
|
|
|
for (int i = 0; i < prop_datas.size(); i++) {
|
|
|
|
Ref<WorldGeneratorPropData> prop_data = Ref<WorldGeneratorPropData>(prop_datas[i]);
|
|
|
|
|
|
|
|
_prop_datas.push_back(prop_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef VOXELMAN_PRESENT
|
|
|
|
//Environments
|
|
|
|
Ref<EnvironmentData> DungeonRoom::get_environment_data(const int index) const {
|
|
|
|
ERR_FAIL_INDEX_V(index, _environment_datas.size(), Ref<EnvironmentData>());
|
|
|
|
|
|
|
|
return _environment_datas.get(index);
|
|
|
|
}
|
|
|
|
void DungeonRoom::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 DungeonRoom::add_environment_data(const Ref<EnvironmentData> environment_data) {
|
|
|
|
_environment_datas.push_back(environment_data);
|
|
|
|
}
|
|
|
|
void DungeonRoom::remove_environment_data(const int index) {
|
|
|
|
ERR_FAIL_INDEX(index, _environment_datas.size());
|
|
|
|
|
|
|
|
_environment_datas.remove(index);
|
|
|
|
}
|
|
|
|
int DungeonRoom::get_environment_data_count() const {
|
|
|
|
return _environment_datas.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector<Variant> DungeonRoom::get_environment_datas() {
|
|
|
|
Vector<Variant> r;
|
|
|
|
for (int i = 0; i < _environment_datas.size(); i++) {
|
|
|
|
#if VERSION_MAJOR < 4
|
|
|
|
r.push_back(_environment_datas[i].get_ref_ptr());
|
|
|
|
#else
|
|
|
|
r.push_back(_environment_datas[i]);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
void DungeonRoom::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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//// Surfaces ////
|
|
|
|
Ref<VoxelSurface> DungeonRoom::get_voxel_surface(const int index) const {
|
|
|
|
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>());
|
|
|
|
|
|
|
|
return _voxel_surfaces.get(index);
|
|
|
|
}
|
|
|
|
void DungeonRoom::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 DungeonRoom::add_voxel_surface(const Ref<VoxelSurface> voxel_surface) {
|
|
|
|
_voxel_surfaces.push_back(voxel_surface);
|
|
|
|
}
|
|
|
|
void DungeonRoom::remove_voxel_surface(const int index) {
|
|
|
|
ERR_FAIL_INDEX(index, _voxel_surfaces.size());
|
|
|
|
|
|
|
|
_voxel_surfaces.remove(index);
|
|
|
|
}
|
|
|
|
int DungeonRoom::get_voxel_surface_count() const {
|
|
|
|
return _voxel_surfaces.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector<Variant> DungeonRoom::get_voxel_surfaces() {
|
|
|
|
Vector<Variant> r;
|
|
|
|
for (int i = 0; i < _voxel_surfaces.size(); i++) {
|
|
|
|
#if VERSION_MAJOR < 4
|
|
|
|
r.push_back(_voxel_surfaces[i].get_ref_ptr());
|
|
|
|
#else
|
|
|
|
r.push_back(_voxel_surfaces[i]);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
void DungeonRoom::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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2019-12-19 18:49:32 +01:00
|
|
|
#ifdef ESS_PRESENT
|
2019-10-18 10:45:02 +02:00
|
|
|
//Entities
|
|
|
|
Ref<EntityData> DungeonRoom::get_entity_data(const int index) const {
|
|
|
|
ERR_FAIL_INDEX_V(index, _entity_datas.size(), Ref<EntityData>());
|
|
|
|
|
|
|
|
return _entity_datas.get(index);
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_entity_data(const int index, const Ref<EntityData> entity_data) {
|
|
|
|
ERR_FAIL_INDEX(index, _entity_datas.size());
|
|
|
|
|
|
|
|
_entity_datas.set(index, entity_data);
|
|
|
|
}
|
|
|
|
void DungeonRoom::add_entity_data(const Ref<EntityData> entity_data) {
|
|
|
|
_entity_datas.push_back(entity_data);
|
|
|
|
}
|
|
|
|
void DungeonRoom::remove_entity_data(const int index) {
|
|
|
|
ERR_FAIL_INDEX(index, _entity_datas.size());
|
|
|
|
|
|
|
|
_entity_datas.remove(index);
|
|
|
|
}
|
|
|
|
int DungeonRoom::get_entity_data_count() const {
|
|
|
|
return _entity_datas.size();
|
|
|
|
}
|
2020-07-21 19:32:21 +02:00
|
|
|
|
|
|
|
Vector<Variant> DungeonRoom::get_entity_datas() {
|
|
|
|
Vector<Variant> r;
|
|
|
|
for (int i = 0; i < _entity_datas.size(); i++) {
|
|
|
|
#if VERSION_MAJOR < 4
|
|
|
|
r.push_back(_entity_datas[i].get_ref_ptr());
|
|
|
|
#else
|
|
|
|
r.push_back(_entity_datas[i]);
|
2019-12-19 18:49:32 +01:00
|
|
|
#endif
|
2020-07-21 19:32:21 +02:00
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
void DungeonRoom::set_entity_datas(const Vector<Variant> &entity_datas) {
|
|
|
|
_entity_datas.clear();
|
|
|
|
for (int i = 0; i < entity_datas.size(); i++) {
|
|
|
|
Ref<EntityData> entity_data = Ref<EntityData>(entity_datas[i]);
|
2019-10-18 10:45:02 +02:00
|
|
|
|
2020-07-21 19:32:21 +02:00
|
|
|
_entity_datas.push_back(entity_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2019-11-16 23:43:46 +01:00
|
|
|
|
2020-07-21 19:32:21 +02:00
|
|
|
void DungeonRoom::setup() {
|
2019-10-18 10:45:02 +02:00
|
|
|
if (has_method("_setup")) {
|
|
|
|
call("_setup");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-19 18:49:32 +01:00
|
|
|
#ifdef VOXELMAN_PRESENT
|
2019-11-16 23:43:46 +01:00
|
|
|
void DungeonRoom::setup_library(Ref<VoxelmanLibrary> library) {
|
|
|
|
if (has_method("_setup_library")) {
|
|
|
|
call("_setup_library", library);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DungeonRoom::_setup_library(Ref<VoxelmanLibrary> library) {
|
2020-07-21 19:32:21 +02:00
|
|
|
for (int i = 0; i < get_voxel_surface_count(); ++i) {
|
|
|
|
Ref<VoxelSurface> s = get_voxel_surface(i);
|
2019-11-16 23:43:46 +01:00
|
|
|
|
|
|
|
if (s.is_valid()) {
|
|
|
|
library->add_voxel_surface(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-27 18:25:51 +02:00
|
|
|
#ifdef PROPS_PRESENT
|
2020-07-21 19:32:21 +02:00
|
|
|
for (int i = 0; i < get_prop_data_count(); ++i) {
|
|
|
|
Ref<WorldGeneratorPropData> s = get_prop_data(i);
|
2020-02-16 02:50:35 +01:00
|
|
|
|
|
|
|
if (s.is_valid()) {
|
2020-04-04 17:22:40 +02:00
|
|
|
Ref<PackedScene> pd = s->get_prop();
|
2020-02-16 02:50:35 +01:00
|
|
|
|
|
|
|
if (pd.is_valid())
|
|
|
|
library->add_prop(pd);
|
2019-11-16 23:43:46 +01:00
|
|
|
}
|
|
|
|
}
|
2020-06-27 18:25:51 +02:00
|
|
|
#endif
|
2019-11-16 23:43:46 +01:00
|
|
|
}
|
|
|
|
|
2020-04-02 21:28:58 +02:00
|
|
|
void DungeonRoom::generate_chunk(Ref<VoxelChunk> chunk, bool spawn_mobs) {
|
|
|
|
ERR_FAIL_COND(!chunk.is_valid());
|
2019-11-06 03:38:02 +01:00
|
|
|
|
2019-10-05 19:53:52 +02:00
|
|
|
if (has_method("_generate_chunk")) {
|
2019-10-31 01:50:26 +01:00
|
|
|
call("_generate_chunk", chunk, spawn_mobs);
|
2019-10-05 19:53:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-31 01:50:26 +01:00
|
|
|
void DungeonRoom::generate_room(Ref<VoxelStructure> structure, bool spawn_mobs) {
|
2019-09-24 02:42:42 +02:00
|
|
|
if (has_method("_generate_room")) {
|
2019-10-31 01:50:26 +01:00
|
|
|
call("_generate_room", structure, spawn_mobs);
|
2019-09-24 02:42:42 +02:00
|
|
|
}
|
2019-09-22 22:12:20 +02:00
|
|
|
}
|
2019-12-19 18:49:32 +01:00
|
|
|
#else
|
|
|
|
|
|
|
|
void DungeonRoom::setup_library(Ref<Resource> library) {
|
|
|
|
if (!_data.is_valid())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (has_method("_setup_library")) {
|
|
|
|
call("_setup_library", library);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-02 21:28:58 +02:00
|
|
|
void DungeonRoom::generate_chunk(Ref<Resource> chunk, bool spawn_mobs) {
|
|
|
|
ERR_FAIL_COND(!chunk.is_valid());
|
2019-12-19 18:49:32 +01:00
|
|
|
|
|
|
|
if (has_method("_generate_chunk")) {
|
|
|
|
call("_generate_chunk", chunk, spawn_mobs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2019-09-22 22:12:20 +02:00
|
|
|
|
2019-09-24 02:42:42 +02:00
|
|
|
DungeonRoom::DungeonRoom() {
|
2019-11-16 23:43:46 +01:00
|
|
|
_current_seed = 0;
|
2019-10-18 09:43:45 +02:00
|
|
|
|
2020-07-21 19:32:21 +02:00
|
|
|
_min_sizex = 0;
|
|
|
|
_min_sizey = 0;
|
|
|
|
_min_sizez = 0;
|
|
|
|
|
|
|
|
_max_sizex = 0;
|
|
|
|
_max_sizey = 0;
|
|
|
|
_max_sizez = 0;
|
|
|
|
|
2019-10-18 09:43:45 +02:00
|
|
|
_posx = 0;
|
|
|
|
_posy = 0;
|
|
|
|
_posz = 0;
|
2019-09-22 22:12:20 +02:00
|
|
|
|
2019-10-18 09:43:45 +02:00
|
|
|
_sizex = 0;
|
|
|
|
_sizey = 0;
|
|
|
|
_sizez = 0;
|
2019-09-22 22:12:20 +02:00
|
|
|
}
|
2019-09-24 02:42:42 +02:00
|
|
|
DungeonRoom::~DungeonRoom() {
|
2019-10-08 00:18:51 +02:00
|
|
|
_prop_datas.clear();
|
2019-12-19 18:49:32 +01:00
|
|
|
|
2020-01-09 04:28:08 +01:00
|
|
|
#ifdef VOXELMAN_PRESENT
|
2019-12-19 18:49:32 +01:00
|
|
|
_environment.unref();
|
|
|
|
_structure.unref();
|
2020-01-09 04:28:08 +01:00
|
|
|
#endif
|
2019-12-19 18:49:32 +01:00
|
|
|
|
2020-01-09 04:28:08 +01:00
|
|
|
#ifdef ESS_PRESENT
|
2019-10-18 10:45:02 +02:00
|
|
|
_entity_datas.clear();
|
2020-01-09 04:28:08 +01:00
|
|
|
#endif
|
2020-07-21 19:32:21 +02:00
|
|
|
|
|
|
|
#ifdef VOXELMAN_PRESENT
|
|
|
|
_environment_datas.clear();
|
|
|
|
_voxel_surfaces.clear();
|
|
|
|
_liquid_voxel_surfaces.clear();
|
|
|
|
#endif
|
2019-09-22 22:12:20 +02:00
|
|
|
}
|
|
|
|
|
2019-09-24 02:42:42 +02:00
|
|
|
void DungeonRoom::_bind_methods() {
|
2019-10-18 10:45:02 +02:00
|
|
|
BIND_VMETHOD(MethodInfo("_setup"));
|
2020-01-09 04:28:08 +01:00
|
|
|
|
|
|
|
#ifdef VOXELMAN_PRESENT
|
2019-11-16 23:43:46 +01:00
|
|
|
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
2019-10-31 01:50:26 +01:00
|
|
|
BIND_VMETHOD(MethodInfo("_generate_room", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
2019-11-06 03:38:02 +01:00
|
|
|
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
2020-01-09 04:28:08 +01:00
|
|
|
#else
|
2019-12-19 18:49:32 +01:00
|
|
|
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
|
|
|
|
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
2020-01-09 04:28:08 +01:00
|
|
|
#endif
|
2019-09-24 02:42:42 +02:00
|
|
|
|
2019-10-18 10:45:02 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("setup"), &DungeonRoom::setup);
|
2019-11-16 23:43:46 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("setup_library", "library"), &DungeonRoom::setup_library);
|
2019-12-19 18:49:32 +01:00
|
|
|
|
2020-01-09 04:28:08 +01:00
|
|
|
#ifdef VOXELMAN_PRESENT
|
2019-11-16 23:43:46 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &DungeonRoom::_setup_library);
|
2020-01-09 04:28:08 +01:00
|
|
|
#endif
|
2019-11-16 23:43:46 +01:00
|
|
|
|
2020-01-09 04:28:08 +01:00
|
|
|
#ifdef VOXELMAN_PRESENT
|
2020-04-02 21:28:58 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk);
|
2019-10-31 01:50:26 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("generate_room", "structure", "spawn_mobs"), &DungeonRoom::generate_room);
|
2020-01-09 04:28:08 +01:00
|
|
|
#else
|
2019-12-19 18:49:32 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk);
|
2020-01-09 04:28:08 +01:00
|
|
|
#endif
|
2019-09-24 15:08:43 +02:00
|
|
|
|
2019-11-16 23:43:46 +01:00
|
|
|
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");
|
2019-10-18 09:43:45 +02:00
|
|
|
|
2019-11-01 15:42:03 +01:00
|
|
|
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);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "level_range"), "set_level_range", "get_level_range");
|
|
|
|
|
2020-07-21 19:32:21 +02:00
|
|
|
//Min Size
|
|
|
|
ClassDB::bind_method(D_METHOD("get_min_sizex"), &DungeonRoom::get_min_sizex);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_min_sizex", "value"), &DungeonRoom::set_min_sizex);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "min_sizex"), "set_min_sizex", "get_min_sizex");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_min_sizey"), &DungeonRoom::get_min_sizey);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_min_sizey", "value"), &DungeonRoom::set_min_sizey);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "min_sizey"), "set_min_sizey", "get_min_sizey");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_min_sizez"), &DungeonRoom::get_min_sizez);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_min_sizez", "value"), &DungeonRoom::set_min_sizez);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "min_sizez"), "set_min_sizez", "get_min_sizez");
|
|
|
|
|
|
|
|
//Max Size
|
|
|
|
ClassDB::bind_method(D_METHOD("get_max_sizex"), &DungeonRoom::get_max_sizex);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_max_sizex", "value"), &DungeonRoom::set_max_sizex);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_sizex"), "set_max_sizex", "get_max_sizex");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_max_sizey"), &DungeonRoom::get_max_sizey);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_max_sizey", "value"), &DungeonRoom::set_max_sizey);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_sizey"), "set_max_sizey", "get_max_sizey");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_max_sizez"), &DungeonRoom::get_max_sizez);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_max_sizez", "value"), &DungeonRoom::set_max_sizez);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_sizez"), "set_max_sizez", "get_max_sizez");
|
|
|
|
|
2019-10-18 09:43:45 +02:00
|
|
|
//Position
|
|
|
|
ClassDB::bind_method(D_METHOD("get_posx"), &DungeonRoom::get_posx);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_posx", "value"), &DungeonRoom::set_posx);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "posx"), "set_posx", "get_posx");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_posy"), &DungeonRoom::get_posy);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_posy", "value"), &DungeonRoom::set_posy);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "posy"), "set_posy", "get_posy");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_posz"), &DungeonRoom::get_posz);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_posz", "value"), &DungeonRoom::set_posz);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "posz"), "set_posz", "get_posz");
|
|
|
|
|
|
|
|
//Size
|
|
|
|
ClassDB::bind_method(D_METHOD("get_sizex"), &DungeonRoom::get_sizex);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_sizex", "value"), &DungeonRoom::set_sizex);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "sizex"), "set_sizex", "get_sizex");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_sizey"), &DungeonRoom::get_sizey);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_sizey", "value"), &DungeonRoom::set_sizey);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "sizey"), "set_sizey", "get_sizey");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_sizez"), &DungeonRoom::get_sizez);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_sizez", "value"), &DungeonRoom::set_sizez);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "sizez"), "set_sizez", "get_sizez");
|
|
|
|
|
2020-01-09 04:28:08 +01:00
|
|
|
#ifdef VOXELMAN_PRESENT
|
2019-10-08 00:18:51 +02:00
|
|
|
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");
|
2020-01-09 04:28:08 +01:00
|
|
|
#endif
|
2019-10-08 00:18:51 +02:00
|
|
|
|
2020-01-09 04:28:08 +01:00
|
|
|
#ifdef VOXELMAN_PRESENT
|
2019-10-18 10:45:02 +02:00
|
|
|
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");
|
2020-01-09 04:28:08 +01:00
|
|
|
#endif
|
2019-10-18 10:45:02 +02:00
|
|
|
|
|
|
|
//Props
|
2019-09-24 15:08:43 +02:00
|
|
|
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);
|
2019-10-18 10:45:02 +02:00
|
|
|
|
2020-07-21 19:32:21 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_prop_datas"), &DungeonRoom::get_prop_datas);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_prop_datas", "prop_datas"), &DungeonRoom::set_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");
|
|
|
|
|
2020-01-09 04:28:08 +01:00
|
|
|
#ifdef ESS_PRESENT
|
2019-10-18 10:45:02 +02:00
|
|
|
//Entities
|
|
|
|
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &DungeonRoom::get_entity_data);
|
|
|
|
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);
|
2020-07-21 19:32:21 +02:00
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_entity_datas"), &DungeonRoom::get_entity_datas);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_entity_datas", "entity_datas"), &DungeonRoom::set_entity_datas);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_datas", PROPERTY_HINT_NONE, "17/17:EntityData", PROPERTY_USAGE_DEFAULT, "EntityData"), "set_entity_datas", "get_entity_datas");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef VOXELMAN_PRESENT
|
|
|
|
//Environments
|
|
|
|
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &DungeonRoom::get_environment_data);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &DungeonRoom::set_environment_data);
|
|
|
|
ClassDB::bind_method(D_METHOD("add_environment_data", "environment_data"), &DungeonRoom::add_environment_data);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_environment_data", "index"), &DungeonRoom::remove_environment_data);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_environment_data_count"), &DungeonRoom::get_environment_data_count);
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_environment_datas"), &DungeonRoom::get_environment_datas);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_environment_datas", "environment_datas"), &DungeonRoom::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"), &DungeonRoom::get_voxel_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_voxel_surface", "index", "data"), &DungeonRoom::set_voxel_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("add_voxel_surface", "voxel_surface"), &DungeonRoom::add_voxel_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_voxel_surface", "index"), &DungeonRoom::remove_voxel_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_voxel_surface_count"), &DungeonRoom::get_voxel_surface_count);
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_voxel_surfaces"), &DungeonRoom::get_voxel_surfaces);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_voxel_surfaces", "voxel_surfaces"), &DungeonRoom::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");
|
2020-01-09 04:28:08 +01:00
|
|
|
#endif
|
2019-09-22 22:12:20 +02:00
|
|
|
}
|