Added VoxelmanPropEntity.

This commit is contained in:
Relintai 2019-11-05 23:18:48 +01:00
parent 440b4eadfb
commit 9bc8ccd0e7
4 changed files with 63 additions and 0 deletions

1
SCsub
View File

@ -32,5 +32,6 @@ env.add_source_files(env.modules_sources,"props/voxelman_prop_scene.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_mesh.cpp") env.add_source_files(env.modules_sources,"props/voxelman_prop_mesh.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_light.cpp") env.add_source_files(env.modules_sources,"props/voxelman_prop_light.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_prop.cpp") env.add_source_files(env.modules_sources,"props/voxelman_prop_prop.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_entity.cpp")
env.add_source_files(env.modules_sources,"level_generator/voxelman_level_generator.cpp") env.add_source_files(env.modules_sources,"level_generator/voxelman_level_generator.cpp")

View File

@ -0,0 +1,33 @@
#include "voxelman_prop_entity.h"
int VoxelmanPropEntity::get_entity_data_id() const {
return _entity_data_id;
}
void VoxelmanPropEntity::set_entity_data_id(const int value) {
_entity_data_id = value;
}
int VoxelmanPropEntity::get_level() const {
return _level;
}
void VoxelmanPropEntity::set_level(const int value) {
_level = value;
}
VoxelmanPropEntity::VoxelmanPropEntity() {
_entity_data_id = 0;
_level = 1;
}
VoxelmanPropEntity::~VoxelmanPropEntity() {
}
void VoxelmanPropEntity::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_entity_data_id"), &VoxelmanPropEntity::get_entity_data_id);
ClassDB::bind_method(D_METHOD("set_entity_data_id", "value"), &VoxelmanPropEntity::set_entity_data_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_data_id"), "set_entity_data_id", "get_entity_data_id");
ClassDB::bind_method(D_METHOD("get_level"), &VoxelmanPropEntity::get_level);
ClassDB::bind_method(D_METHOD("set_level", "value"), &VoxelmanPropEntity::set_level);
ADD_PROPERTY(PropertyInfo(Variant::INT, "level"), "set_level", "get_level");
}

View File

@ -0,0 +1,27 @@
#ifndef VOXELMAN_PROP_ENTITY_H
#define VOXELMAN_PROP_ENTITY_H
#include "voxelman_prop_entry.h"
class VoxelmanPropEntity : public VoxelmanPropEntry {
GDCLASS(VoxelmanPropEntity, VoxelmanPropEntry);
public:
int get_entity_data_id() const;
void set_entity_data_id(const int value);
int get_level() const;
void set_level(const int value);
VoxelmanPropEntity();
~VoxelmanPropEntity();
protected:
static void _bind_methods();
private:
int _level;
int _entity_data_id;
};
#endif

View File

@ -25,6 +25,7 @@
#include "props/voxelman_prop_mesh.h" #include "props/voxelman_prop_mesh.h"
#include "props/voxelman_prop_light.h" #include "props/voxelman_prop_light.h"
#include "props/voxelman_prop_prop.h" #include "props/voxelman_prop_prop.h"
#include "props/voxelman_prop_entity.h"
#include "level_generator/voxelman_level_generator.h" #include "level_generator/voxelman_level_generator.h"
@ -55,6 +56,7 @@ void register_voxelman_types() {
ClassDB::register_class<VoxelmanPropMesh>(); ClassDB::register_class<VoxelmanPropMesh>();
ClassDB::register_class<VoxelmanPropLight>(); ClassDB::register_class<VoxelmanPropLight>();
ClassDB::register_class<VoxelmanPropProp>(); ClassDB::register_class<VoxelmanPropProp>();
ClassDB::register_class<VoxelmanPropEntity>();
ClassDB::register_class<VoxelmanLevelGenerator>(); ClassDB::register_class<VoxelmanLevelGenerator>();
} }