mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-04-19 21:33:15 +02:00
Created the bindings for EntityEquipSet, and fixed compile.
This commit is contained in:
parent
5901e49aa9
commit
3906bea408
7
SCsub
7
SCsub
@ -38,8 +38,8 @@ module_env.add_source_files(env.modules_sources,"entities/player_talent.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"inventory/bag_slot.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"inventory/bag.cpp")
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"spells/aura_infos.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"spells/spell_cast_info.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"infos/aura_infos.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"infos/spell_cast_info.cpp")
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"data/character_skeleton_visual_entry.cpp")
|
||||
|
||||
@ -65,3 +65,6 @@ module_env.add_source_files(env.modules_sources,"utility/category_cooldown.cpp")
|
||||
env.add_source_files(env.modules_sources,"meshes/mesh_data_resource.cpp")
|
||||
env.add_source_files(env.modules_sources,"meshes/editor_import_collada_mdr.cpp")
|
||||
env.add_source_files(env.modules_sources,"meshes/editor_plugin_collada_mdr.cpp")
|
||||
|
||||
|
||||
env.add_source_files(env.modules_sources,"skeleton/entity_equipset.cpp")
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "../entities/entity.h"
|
||||
#include "../entities/stats/stat.h"
|
||||
#include "../spells/aura_infos.h"
|
||||
#include "../infos/aura_infos.h"
|
||||
|
||||
#include "aura_stat_attribute.h"
|
||||
#include "aura_trigger_data.h"
|
||||
@ -18,7 +18,7 @@
|
||||
#include "../entities/auras/aura_data.h"
|
||||
#include "../pipelines/spell_damage_info.h"
|
||||
#include "../pipelines/spell_heal_info.h"
|
||||
#include "../spells/spell_cast_info.h"
|
||||
#include "../infos/spell_cast_info.h"
|
||||
|
||||
class AuraApplyInfo;
|
||||
class AuraScript;
|
||||
|
@ -9,12 +9,12 @@
|
||||
#include "../entity_enums.h"
|
||||
#include "../spell_enums.h"
|
||||
|
||||
#include "../spells/spell_cast_info.h"
|
||||
#include "../infos/spell_cast_info.h"
|
||||
|
||||
#include "../entities/entity.h"
|
||||
|
||||
#include "../pipelines/spell_damage_info.h"
|
||||
#include "../spells/aura_infos.h"
|
||||
#include "../infos/aura_infos.h"
|
||||
|
||||
class Entity;
|
||||
class Aura;
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "../entity_enums.h"
|
||||
|
||||
#include "../spells/spell_cast_info.h"
|
||||
#include "../infos/spell_cast_info.h"
|
||||
|
||||
#include "../skeleton/character_skeleton.h"
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
#include "data/craft_data_attribute_helper.h"
|
||||
#include "data/craft_data_attribute.h"
|
||||
|
||||
#include "spells/spell_cast_info.h"
|
||||
#include "spells/aura_infos.h"
|
||||
#include "infos/spell_cast_info.h"
|
||||
#include "infos/aura_infos.h"
|
||||
|
||||
#include "data/character_skeleton_visual_entry.h"
|
||||
|
||||
@ -58,6 +58,8 @@
|
||||
|
||||
#include "meshes/mesh_data_resource.h"
|
||||
|
||||
#include "skeleton/entity_equipset.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_plugin.h"
|
||||
|
||||
@ -134,6 +136,7 @@ void register_entity_spell_system_types() {
|
||||
ClassDB::register_class<Cooldown>();
|
||||
ClassDB::register_class<CategoryCooldown>();
|
||||
|
||||
ClassDB::register_class<EntityEquipSet>();
|
||||
|
||||
//meshes
|
||||
ClassDB::register_class<MeshDataResource>();
|
||||
|
@ -0,0 +1,65 @@
|
||||
#include "entity_equipset.h"
|
||||
|
||||
int EntityEquipSet::get_entry_count() const {
|
||||
return _entry_count;
|
||||
}
|
||||
|
||||
void EntityEquipSet::set_entry_count(const int value) {
|
||||
if (value > MAX_ENTRIES) {
|
||||
_entry_count = MAX_ENTRIES;
|
||||
return;
|
||||
}
|
||||
|
||||
if (value < 0) {
|
||||
_entry_count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
_entry_count = value;
|
||||
}
|
||||
|
||||
|
||||
Ref<CharacterSkeletonVisualEntry> EntityEquipSet::get_entry(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, MAX_ENTRIES, Ref<CharacterSkeletonVisualEntry>());
|
||||
|
||||
return _entries[index];
|
||||
}
|
||||
|
||||
void EntityEquipSet::set_entry(const int index, const Ref<CharacterSkeletonVisualEntry> entry) {
|
||||
ERR_FAIL_INDEX(index, MAX_ENTRIES);
|
||||
|
||||
_entries[index] = entry;
|
||||
}
|
||||
|
||||
EntityEquipSet::EntityEquipSet() {
|
||||
_entry_count = 0;
|
||||
}
|
||||
|
||||
void EntityEquipSet::_validate_property(PropertyInfo &property) const {
|
||||
|
||||
String prop = property.name;
|
||||
if (prop.begins_with("Entry_")) {
|
||||
int frame = prop.get_slicec('/', 0).get_slicec('_', 1).to_int();
|
||||
if (frame > _entry_count) {
|
||||
property.usage = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityEquipSet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entry_count"), &EntityEquipSet::get_entry_count);
|
||||
ClassDB::bind_method(D_METHOD("set_entry_count", "value"), &EntityEquipSet::set_entry_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entry", "index"), &EntityEquipSet::get_entry);
|
||||
ClassDB::bind_method(D_METHOD("set_entry", "index", "entry"), &EntityEquipSet::set_entry);
|
||||
|
||||
ADD_GROUP("Entries", "Entry");
|
||||
for (int i = 0; i < MAX_ENTRIES; ++i) {
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "Entry_" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "CharacterSkeletonVisualEntry", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_entry", "get_entry", i);
|
||||
}
|
||||
|
||||
BIND_CONSTANT(MAX_ENTRIES);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,18 +4,30 @@
|
||||
#include "core/resource.h"
|
||||
#include "core/ustring.h"
|
||||
|
||||
#include "../data/character_skeleton_visual_entry.h"
|
||||
|
||||
class EntityEquipSet : public Resource {
|
||||
GDCLASS(EntityEquipSet, Resource);
|
||||
|
||||
public:
|
||||
int get_entry_count() const;
|
||||
void set_entry_count(const int value);
|
||||
|
||||
Ref<CharacterSkeletonVisualEntry> get_entry(const int index) const;
|
||||
void set_entry(const int index, const Ref<CharacterSkeletonVisualEntry> entry);
|
||||
|
||||
EntityEquipSet();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &property) const;
|
||||
|
||||
enum {
|
||||
MAX_ENTRIES = 20
|
||||
};
|
||||
|
||||
private:
|
||||
int _entry_count;
|
||||
Ref<CharacterSkeletonVisualEntry> _entries[MAX_ENTRIES];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user