diff --git a/SCsub b/SCsub index fbe86c9..e7f6c4e 100644 --- a/SCsub +++ b/SCsub @@ -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_light.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") diff --git a/props/voxelman_prop_entity.cpp b/props/voxelman_prop_entity.cpp new file mode 100644 index 0000000..a3865e2 --- /dev/null +++ b/props/voxelman_prop_entity.cpp @@ -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"); +} diff --git a/props/voxelman_prop_entity.h b/props/voxelman_prop_entity.h new file mode 100644 index 0000000..b635a22 --- /dev/null +++ b/props/voxelman_prop_entity.h @@ -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 diff --git a/register_types.cpp b/register_types.cpp index ff89128..2f70d76 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -25,6 +25,7 @@ #include "props/voxelman_prop_mesh.h" #include "props/voxelman_prop_light.h" #include "props/voxelman_prop_prop.h" +#include "props/voxelman_prop_entity.h" #include "level_generator/voxelman_level_generator.h" @@ -55,6 +56,7 @@ void register_voxelman_types() { ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); }