diff --git a/SCsub b/SCsub index afe7917..54bd9d1 100644 --- a/SCsub +++ b/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") diff --git a/data/aura.h b/data/aura.h index 5e1e423..5ab9b4e 100644 --- a/data/aura.h +++ b/data/aura.h @@ -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; diff --git a/data/spell.h b/data/spell.h index 64de94b..4aa6a1a 100644 --- a/data/spell.h +++ b/data/spell.h @@ -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; diff --git a/entities/entity.h b/entities/entity.h index 812da6f..6894f7b 100644 --- a/entities/entity.h +++ b/entities/entity.h @@ -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" diff --git a/register_types.cpp b/register_types.cpp index c8c0c95..16fd10b 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -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(); ClassDB::register_class(); + ClassDB::register_class(); //meshes ClassDB::register_class(); diff --git a/skeleton/entity_equipset.cpp b/skeleton/entity_equipset.cpp index e69de29..a3bd705 100644 --- a/skeleton/entity_equipset.cpp +++ b/skeleton/entity_equipset.cpp @@ -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 EntityEquipSet::get_entry(const int index) const { + ERR_FAIL_INDEX_V(index, MAX_ENTRIES, Ref()); + + return _entries[index]; +} + +void EntityEquipSet::set_entry(const int index, const Ref 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); +} + + + diff --git a/skeleton/entity_equipset.h b/skeleton/entity_equipset.h index a0567a1..0a9549b 100644 --- a/skeleton/entity_equipset.h +++ b/skeleton/entity_equipset.h @@ -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 get_entry(const int index) const; + void set_entry(const int index, const Ref entry); + + EntityEquipSet(); + protected: static void _bind_methods(); + void _validate_property(PropertyInfo &property) const; enum { MAX_ENTRIES = 20 }; private: + int _entry_count; Ref _entries[MAX_ENTRIES]; };