mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-04-19 21:33:15 +02:00
Removed EntityResourceData. Now EntityResources just get duplicated.
This commit is contained in:
parent
54bd0ff16b
commit
94e9a2c02e
1
SCsub
1
SCsub
@ -72,7 +72,6 @@ sources = [
|
||||
"entities/auras/aura_data.cpp",
|
||||
"entities/entity.cpp",
|
||||
|
||||
"entities/resources/entity_resource_data.cpp",
|
||||
"entities/resources/entity_resource_cost_data.cpp",
|
||||
"entities/resources/entity_resource_cost_data_health.cpp",
|
||||
"entities/resources/entity_resource_cost_data_resource.cpp",
|
||||
|
@ -45,7 +45,6 @@ def get_doc_classes():
|
||||
"EntityResourceCostData",
|
||||
"EntityResourceCostDataHealth",
|
||||
"EntityResourceCostDataResource",
|
||||
"EntityResourceData",
|
||||
"EntityResource",
|
||||
"EntityResourceHealth",
|
||||
"EntityResourceSpeed",
|
||||
|
@ -27,7 +27,7 @@ SOFTWARE.
|
||||
#include "../data/species/entity_species_data.h"
|
||||
#include "../data/spells/spell.h"
|
||||
#include "../entities/data/entity_data.h"
|
||||
#include "../entities/resources/entity_resource_data.h"
|
||||
#include "../entities/resources/entity_resource.h"
|
||||
#include "../entities/skills/entity_skill_data.h"
|
||||
|
||||
Ref<Aura> ESSResourceDB::get_skill_for_armor_type(const int index) {
|
||||
@ -48,7 +48,7 @@ void ESSResourceDB::set_xp_data(const Ref<XPData> &data) {
|
||||
_xp_data = data;
|
||||
}
|
||||
|
||||
void ESSResourceDB::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
void ESSResourceDB::add_entity_resource(Ref<EntityResource> cls) {
|
||||
if (!cls.is_valid())
|
||||
return;
|
||||
|
||||
@ -56,7 +56,7 @@ void ESSResourceDB::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
_entity_resources_path_to_id.set(cls->get_path(), cls->get_id());
|
||||
}
|
||||
|
||||
Ref<EntityResourceData> ESSResourceDB::get_entity_resource_path(const StringName &path) {
|
||||
Ref<EntityResource> ESSResourceDB::get_entity_resource_path(const StringName &path) {
|
||||
return get_entity_resource(entity_resource_path_to_id(path));
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ void ESSResourceDB::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_xp_data", "data"), &ESSResourceDB::set_xp_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "xp_data", PROPERTY_HINT_RESOURCE_TYPE, "XPData"), "set_xp_data", "get_xp_data");
|
||||
|
||||
//EntityResourceData
|
||||
//EntityResource
|
||||
ClassDB::bind_method(D_METHOD("add_entity_resource", "cls"), &ESSResourceDB::add_entity_resource);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resource", "class_id"), &ESSResourceDB::get_entity_resource);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resource_index", "index"), &ESSResourceDB::get_entity_resource_index);
|
||||
|
@ -43,7 +43,7 @@ class Spell;
|
||||
class EntityData;
|
||||
class CraftRecipe;
|
||||
class ItemTemplate;
|
||||
class EntityResourceData;
|
||||
class EntityResource;
|
||||
class EntitySkillData;
|
||||
class EntityCreateInfo;
|
||||
class SpellCastInfo;
|
||||
@ -59,14 +59,14 @@ public:
|
||||
Ref<XPData> get_xp_data();
|
||||
void set_xp_data(const Ref<XPData> &data);
|
||||
|
||||
virtual Ref<EntityResourceData> get_entity_resource(int class_id) = 0;
|
||||
virtual Ref<EntityResourceData> get_entity_resource_index(int index) = 0;
|
||||
virtual Ref<EntityResource> get_entity_resource(int class_id) = 0;
|
||||
virtual Ref<EntityResource> get_entity_resource_index(int index) = 0;
|
||||
virtual int get_entity_resource_count() = 0;
|
||||
virtual void add_entity_resource(Ref<EntityResourceData> cls);
|
||||
virtual void add_entity_resource(Ref<EntityResource> cls);
|
||||
virtual Vector<Variant> get_entity_resources() const = 0;
|
||||
virtual void set_entity_resources(const Vector<Variant> &data) = 0;
|
||||
|
||||
Ref<EntityResourceData> get_entity_resource_path(const StringName &path);
|
||||
Ref<EntityResource> get_entity_resource_path(const StringName &path);
|
||||
StringName entity_resource_id_to_path(const int id) const;
|
||||
int entity_resource_path_to_id(const StringName &path) const;
|
||||
|
||||
|
@ -27,7 +27,7 @@ SOFTWARE.
|
||||
#include "../data/species/entity_species_data.h"
|
||||
#include "../data/spells/spell.h"
|
||||
#include "../entities/data/entity_data.h"
|
||||
#include "../entities/resources/entity_resource_data.h"
|
||||
#include "../entities/resources/entity_resource.h"
|
||||
#include "../entities/skills/entity_skill_data.h"
|
||||
|
||||
bool ESSResourceDBFolders::get_automatic_load() const {
|
||||
@ -125,7 +125,7 @@ void ESSResourceDBFolders::load_folder(const String &folder) {
|
||||
void ESSResourceDBFolders::add_resource(const Ref<Resource> &resource) {
|
||||
StringName cls = resource->get_class_name();
|
||||
|
||||
if (cls == "EntityResourceData") {
|
||||
if (cls == "EntityResource") {
|
||||
add_entity_resource(resource);
|
||||
} else if (cls == "EntitySkillData") {
|
||||
add_entity_skill(resource);
|
||||
|
@ -48,7 +48,7 @@ class Spell;
|
||||
class EntityData;
|
||||
class CraftRecipe;
|
||||
class ItemTemplate;
|
||||
class EntityResourceData;
|
||||
class EntityResource;
|
||||
class EntitySkillData;
|
||||
class EntityCreateInfo;
|
||||
class SpellCastInfo;
|
||||
|
@ -27,27 +27,27 @@ SOFTWARE.
|
||||
#include "../data/species/entity_species_data.h"
|
||||
#include "../data/spells/spell.h"
|
||||
#include "../entities/data/entity_data.h"
|
||||
#include "../entities/resources/entity_resource_data.h"
|
||||
#include "../entities/resources/entity_resource.h"
|
||||
#include "../entities/skills/entity_skill_data.h"
|
||||
|
||||
Ref<EntityResourceData> ESSResourceDBMap::get_entity_resource(int class_id) {
|
||||
//ERR_FAIL_COND_V_MSG(!_entity_resource_map.has(class_id), Ref<EntityResourceData>(), "Could not find EntityResourceData! Id:" + String::num(class_id));
|
||||
Ref<EntityResource> ESSResourceDBMap::get_entity_resource(int class_id) {
|
||||
//ERR_FAIL_COND_V_MSG(!_entity_resource_map.has(class_id), Ref<EntityResource>(), "Could not find EntityResource! Id:" + String::num(class_id));
|
||||
|
||||
if (!_entity_resource_map.has(class_id)) {
|
||||
return Ref<EntityResourceData>();
|
||||
return Ref<EntityResource>();
|
||||
}
|
||||
|
||||
return _entity_resource_map.get(class_id);
|
||||
}
|
||||
Ref<EntityResourceData> ESSResourceDBMap::get_entity_resource_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _entity_resources.size(), Ref<EntityResourceData>(NULL));
|
||||
Ref<EntityResource> ESSResourceDBMap::get_entity_resource_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _entity_resources.size(), Ref<EntityResource>(NULL));
|
||||
|
||||
return _entity_resources.get(index);
|
||||
}
|
||||
int ESSResourceDBMap::get_entity_resource_count() {
|
||||
return _entity_resources.size();
|
||||
}
|
||||
void ESSResourceDBMap::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
void ESSResourceDBMap::add_entity_resource(Ref<EntityResource> cls) {
|
||||
ERR_FAIL_COND(!cls.is_valid());
|
||||
|
||||
_entity_resources.push_back(cls);
|
||||
|
@ -48,7 +48,7 @@ class Spell;
|
||||
class EntityData;
|
||||
class CraftRecipe;
|
||||
class ItemTemplate;
|
||||
class EntityResourceData;
|
||||
class EntityResource;
|
||||
class EntitySkillData;
|
||||
class EntityCreateInfo;
|
||||
class SpellCastInfo;
|
||||
@ -58,10 +58,10 @@ class ESSResourceDBMap : public ESSResourceDB {
|
||||
GDCLASS(ESSResourceDBMap, ESSResourceDB);
|
||||
|
||||
public:
|
||||
Ref<EntityResourceData> get_entity_resource(int class_id);
|
||||
Ref<EntityResourceData> get_entity_resource_index(int index);
|
||||
Ref<EntityResource> get_entity_resource(int class_id);
|
||||
Ref<EntityResource> get_entity_resource_index(int index);
|
||||
int get_entity_resource_count();
|
||||
void add_entity_resource(Ref<EntityResourceData> cls);
|
||||
void add_entity_resource(Ref<EntityResource> cls);
|
||||
Vector<Variant> get_entity_resources() const;
|
||||
void set_entity_resources(const Vector<Variant> &data);
|
||||
|
||||
@ -121,29 +121,29 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Vector<Ref<EntityResourceData>> _entity_resources;
|
||||
HashMap<int, Ref<EntityResourceData>> _entity_resource_map;
|
||||
Vector<Ref<EntityResource> > _entity_resources;
|
||||
HashMap<int, Ref<EntityResource> > _entity_resource_map;
|
||||
|
||||
Vector<Ref<EntitySkillData>> _entity_skills;
|
||||
HashMap<int, Ref<EntitySkillData>> _entity_skill_map;
|
||||
Vector<Ref<EntitySkillData> > _entity_skills;
|
||||
HashMap<int, Ref<EntitySkillData> > _entity_skill_map;
|
||||
|
||||
Vector<Ref<EntityData>> _entity_datas;
|
||||
HashMap<int, Ref<EntityData>> _entity_data_map;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
HashMap<int, Ref<EntityData> > _entity_data_map;
|
||||
|
||||
Vector<Ref<Spell>> _spells;
|
||||
HashMap<int, Ref<Spell>> _spell_map;
|
||||
Vector<Ref<Spell> > _spells;
|
||||
HashMap<int, Ref<Spell> > _spell_map;
|
||||
|
||||
Vector<Ref<Aura>> _auras;
|
||||
HashMap<int, Ref<Aura>> _aura_map;
|
||||
Vector<Ref<Aura> > _auras;
|
||||
HashMap<int, Ref<Aura> > _aura_map;
|
||||
|
||||
Vector<Ref<CraftRecipe>> _craft_recipes;
|
||||
HashMap<int, Ref<CraftRecipe>> _craft_recipe_map;
|
||||
Vector<Ref<CraftRecipe> > _craft_recipes;
|
||||
HashMap<int, Ref<CraftRecipe> > _craft_recipe_map;
|
||||
|
||||
Vector<Ref<ItemTemplate>> _item_templates;
|
||||
HashMap<int, Ref<ItemTemplate>> _item_template_map;
|
||||
Vector<Ref<ItemTemplate> > _item_templates;
|
||||
HashMap<int, Ref<ItemTemplate> > _item_template_map;
|
||||
|
||||
Vector<Ref<EntitySpeciesData>> _entity_species_datas;
|
||||
HashMap<int, Ref<EntitySpeciesData>> _entity_species_data_map;
|
||||
Vector<Ref<EntitySpeciesData> > _entity_species_datas;
|
||||
HashMap<int, Ref<EntitySpeciesData> > _entity_species_data_map;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@ SOFTWARE.
|
||||
#include "../data/species/entity_species_data.h"
|
||||
#include "../data/spells/spell.h"
|
||||
#include "../entities/data/entity_data.h"
|
||||
#include "../entities/resources/entity_resource_data.h"
|
||||
#include "../entities/resources/entity_resource.h"
|
||||
#include "../entities/skills/entity_skill_data.h"
|
||||
|
||||
bool ESSResourceDBStatic::get_remap_ids() const {
|
||||
@ -37,21 +37,21 @@ void ESSResourceDBStatic::set_remap_ids(const bool value) {
|
||||
_remap_ids = value;
|
||||
}
|
||||
|
||||
Ref<EntityResourceData> ESSResourceDBStatic::get_entity_resource(int id) {
|
||||
Ref<EntityResource> ESSResourceDBStatic::get_entity_resource(int id) {
|
||||
if (id < 0 || id >= _entity_resources.size())
|
||||
return Ref<EntityResourceData>();
|
||||
return Ref<EntityResource>();
|
||||
|
||||
return _entity_resources.get(id);
|
||||
}
|
||||
Ref<EntityResourceData> ESSResourceDBStatic::get_entity_resource_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _entity_resources.size(), Ref<EntityResourceData>(NULL));
|
||||
Ref<EntityResource> ESSResourceDBStatic::get_entity_resource_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _entity_resources.size(), Ref<EntityResource>(NULL));
|
||||
|
||||
return _entity_resources.get(index);
|
||||
}
|
||||
int ESSResourceDBStatic::get_entity_resource_count() {
|
||||
return _entity_resources.size();
|
||||
}
|
||||
void ESSResourceDBStatic::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
void ESSResourceDBStatic::add_entity_resource(Ref<EntityResource> cls) {
|
||||
if (_remap_ids && cls.is_valid())
|
||||
cls->set_id(_entity_resources.size());
|
||||
|
||||
@ -65,7 +65,7 @@ Vector<Variant> ESSResourceDBStatic::get_entity_resources() const {
|
||||
void ESSResourceDBStatic::set_entity_resources(const Vector<Variant> &data) {
|
||||
_entity_resources.clear();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
Ref<EntityResourceData> d = Ref<EntityResourceData>(data[i]);
|
||||
Ref<EntityResource> d = Ref<EntityResource>(data[i]);
|
||||
|
||||
add_entity_resource(d);
|
||||
}
|
||||
@ -353,7 +353,7 @@ void ESSResourceDBStatic::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_remap_ids", "value"), &ESSResourceDBStatic::set_remap_ids);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "remap_ids"), "set_remap_ids", "get_remap_ids");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_resources", PROPERTY_HINT_NONE, "17/17:EntityResourceData", PROPERTY_USAGE_DEFAULT, "EntityResourceData"), "set_entity_resources", "get_entity_resources");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_resources", PROPERTY_HINT_NONE, "17/17:EntityResource", PROPERTY_USAGE_DEFAULT, "EntityResource"), "set_entity_resources", "get_entity_resources");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_skills", PROPERTY_HINT_NONE, "17/17:EntitySkillData", PROPERTY_USAGE_DEFAULT, "EntitySkillData"), "set_entity_skills", "get_entity_skills");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_datas", PROPERTY_HINT_NONE, "17/17:EntityData", PROPERTY_USAGE_DEFAULT, "EntityData"), "set_entity_datas", "get_entity_datas");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells");
|
||||
|
@ -38,7 +38,7 @@ class Spell;
|
||||
class EntityData;
|
||||
class CraftRecipe;
|
||||
class ItemTemplate;
|
||||
class EntityResourceData;
|
||||
class EntityResource;
|
||||
class EntitySkillData;
|
||||
class EntityCreateInfo;
|
||||
class SpellCastInfo;
|
||||
@ -57,10 +57,10 @@ public:
|
||||
PoolStringArray get_folders() const;
|
||||
void set_folders(const PoolStringArray &folders);
|
||||
|
||||
Ref<EntityResourceData> get_entity_resource(int class_id);
|
||||
Ref<EntityResourceData> get_entity_resource_index(int index);
|
||||
Ref<EntityResource> get_entity_resource(int class_id);
|
||||
Ref<EntityResource> get_entity_resource_index(int index);
|
||||
int get_entity_resource_count();
|
||||
void add_entity_resource(Ref<EntityResourceData> cls);
|
||||
void add_entity_resource(Ref<EntityResource> cls);
|
||||
Vector<Variant> get_entity_resources() const;
|
||||
void set_entity_resources(const Vector<Variant> &data);
|
||||
|
||||
@ -124,14 +124,14 @@ protected:
|
||||
private:
|
||||
bool _remap_ids;
|
||||
|
||||
Vector<Ref<EntityResourceData>> _entity_resources;
|
||||
Vector<Ref<EntitySkillData>> _entity_skills;
|
||||
Vector<Ref<EntityData>> _entity_datas;
|
||||
Vector<Ref<Spell>> _spells;
|
||||
Vector<Ref<Aura>> _auras;
|
||||
Vector<Ref<CraftRecipe>> _craft_recipes;
|
||||
Vector<Ref<ItemTemplate>> _item_templates;
|
||||
Vector<Ref<EntitySpeciesData>> _entity_species_datas;
|
||||
Vector<Ref<EntityResource> > _entity_resources;
|
||||
Vector<Ref<EntitySkillData> > _entity_skills;
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
Vector<Ref<Spell> > _spells;
|
||||
Vector<Ref<Aura> > _auras;
|
||||
Vector<Ref<CraftRecipe> > _craft_recipes;
|
||||
Vector<Ref<ItemTemplate> > _item_templates;
|
||||
Vector<Ref<EntitySpeciesData> > _entity_species_datas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -40,7 +40,7 @@
|
||||
<method name="add_entity_resource">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="cls" type="EntityResourceData">
|
||||
<argument index="0" name="cls" type="EntityResource">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
@ -296,7 +296,7 @@
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_entity_resource">
|
||||
<return type="EntityResourceData">
|
||||
<return type="EntityResource">
|
||||
</return>
|
||||
<argument index="0" name="class_id" type="int">
|
||||
</argument>
|
||||
@ -310,7 +310,7 @@
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_entity_resource_index">
|
||||
<return type="EntityResourceData">
|
||||
<return type="EntityResource">
|
||||
</return>
|
||||
<argument index="0" name="index" type="int">
|
||||
</argument>
|
||||
@ -318,7 +318,7 @@
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_entity_resource_path">
|
||||
<return type="EntityResourceData">
|
||||
<return type="EntityResource">
|
||||
</return>
|
||||
<argument index="0" name="path" type="String">
|
||||
</argument>
|
||||
|
@ -753,7 +753,7 @@
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_entity_resource" qualifiers="const">
|
||||
<return type="EntityResourceData">
|
||||
<return type="EntityResource">
|
||||
</return>
|
||||
<argument index="0" name="index" type="int">
|
||||
</argument>
|
||||
@ -845,7 +845,7 @@
|
||||
</return>
|
||||
<argument index="0" name="index" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="entity_resource" type="EntityResourceData">
|
||||
<argument index="1" name="entity_resource" type="EntityResource">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -146,7 +146,7 @@
|
||||
</member>
|
||||
<member name="owner" type="Entity" setter="set_owner" getter="get_owner">
|
||||
</member>
|
||||
<member name="resource_data" type="EntityResourceData" setter="set_resource_data" getter="get_resource_data">
|
||||
<member name="resource_data" type="EntityResource" setter="set_resource_data" getter="get_resource_data">
|
||||
</member>
|
||||
<member name="should_process" type="bool" setter="set_should_process" getter="get_should_process" default="false">
|
||||
</member>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<members>
|
||||
<member name="cost" type="int" setter="set_cost" getter="get_cost" default="0">
|
||||
</member>
|
||||
<member name="entity_resource_data" type="EntityResourceData" setter="set_entity_resource_data" getter="get_entity_resource_data">
|
||||
<member name="entity_resource_data" type="EntityResource" setter="set_entity_resource_data" getter="get_entity_resource_data">
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
|
@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="EntityResourceData" inherits="Resource" version="3.2">
|
||||
<brief_description>
|
||||
The data for an [Entity]'s resource. Resource in this context is things like mana.
|
||||
</brief_description>
|
||||
<description>
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_entity_resource_instance" qualifiers="virtual">
|
||||
<return type="EntityResource">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_entity_resource_instance">
|
||||
<return type="EntityResource">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="id" type="int" setter="set_id" getter="get_id" default="0">
|
||||
</member>
|
||||
<member name="text_description" type="String" setter="set_text_description" getter="get_text_description" default="""">
|
||||
</member>
|
||||
<member name="text_name" type="String" setter="set_name" getter="get_name" default="""">
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
</constants>
|
||||
</class>
|
@ -76,15 +76,15 @@ void EntityClassData::set_num_entity_resources(int value) {
|
||||
_entity_resources.resize(value);
|
||||
}
|
||||
|
||||
Ref<EntityResourceData> EntityClassData::get_entity_resource(int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _entity_resources.size(), Ref<EntityResourceData>());
|
||||
Ref<EntityResource> EntityClassData::get_entity_resource(int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _entity_resources.size(), Ref<EntityResource>());
|
||||
|
||||
return _entity_resources[index];
|
||||
}
|
||||
void EntityClassData::set_entity_resource(int index, Ref<EntityResourceData> entity_resource) {
|
||||
void EntityClassData::set_entity_resource(int index, Ref<EntityResource> entity_resource) {
|
||||
ERR_FAIL_INDEX(index, _entity_resources.size());
|
||||
|
||||
_entity_resources.set(index, Ref<EntityResourceData>(entity_resource));
|
||||
_entity_resources.set(index, Ref<EntityResource>(entity_resource));
|
||||
}
|
||||
|
||||
Vector<Variant> EntityClassData::get_entity_resources() {
|
||||
@ -93,7 +93,7 @@ Vector<Variant> EntityClassData::get_entity_resources() {
|
||||
void EntityClassData::set_entity_resources(const Vector<Variant> &entity_resources) {
|
||||
_entity_resources.clear();
|
||||
for (int i = 0; i < entity_resources.size(); i++) {
|
||||
Ref<EntityResourceData> entity_resource = Ref<EntityResourceData>(entity_resources[i]);
|
||||
Ref<EntityResource> entity_resource = Ref<EntityResource>(entity_resources[i]);
|
||||
|
||||
_entity_resources.push_back(entity_resource);
|
||||
}
|
||||
@ -286,10 +286,12 @@ void EntityClassData::_setup_resources(Node *entity) {
|
||||
Entity *ent = Object::cast_to<Entity>(entity);
|
||||
|
||||
for (int i = 0; i < _entity_resources.size(); ++i) {
|
||||
Ref<EntityResourceData> res = _entity_resources.get(i);
|
||||
Ref<EntityResource> res = _entity_resources.get(i);
|
||||
|
||||
if (res.is_valid()) {
|
||||
ent->resource_adds(res->get_entity_resource_instance());
|
||||
Ref<EntityResource> r = res->duplicate(false);
|
||||
|
||||
ent->resource_adds(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -341,7 +343,7 @@ void EntityClassData::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resources"), &EntityClassData::get_entity_resources);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_resources", "entity_resources"), &EntityClassData::set_entity_resources);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_resources", PROPERTY_HINT_NONE, "17/17:EntityResourceData", PROPERTY_USAGE_DEFAULT, "EntityResourceData"), "set_entity_resources", "get_entity_resources");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_resources", PROPERTY_HINT_NONE, "17/17:EntityResource", PROPERTY_USAGE_DEFAULT, "EntityResource"), "set_entity_resources", "get_entity_resources");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_setup_resources", "entity"), &EntityClassData::_setup_resources);
|
||||
|
||||
|
@ -38,7 +38,7 @@ SOFTWARE.
|
||||
|
||||
#include "../../item_enums.h"
|
||||
|
||||
#include "../resources/entity_resource_data.h"
|
||||
#include "../resources/entity_resource.h"
|
||||
|
||||
class Aura;
|
||||
class Spell;
|
||||
@ -72,8 +72,8 @@ public:
|
||||
int get_num_entity_resources();
|
||||
void set_num_entity_resources(int value);
|
||||
|
||||
Ref<EntityResourceData> get_entity_resource(int index) const;
|
||||
void set_entity_resource(int index, Ref<EntityResourceData> entity_resources);
|
||||
Ref<EntityResource> get_entity_resource(int index) const;
|
||||
void set_entity_resource(int index, Ref<EntityResource> entity_resources);
|
||||
|
||||
Vector<Variant> get_entity_resources();
|
||||
void set_entity_resources(const Vector<Variant> &entity_resourcess);
|
||||
@ -152,7 +152,7 @@ private:
|
||||
|
||||
EntityEnums::EntityClassPlaystyleType _playstyle_type;
|
||||
|
||||
Vector<Ref<EntityResourceData> > _entity_resources;
|
||||
Vector<Ref<EntityResource> > _entity_resources;
|
||||
Vector<Ref<CharacterSpec> > _specs;
|
||||
Vector<Ref<Spell> > _spells;
|
||||
Vector<Ref<Spell> > _start_spells;
|
||||
|
@ -675,22 +675,6 @@ void Entity::_setup() {
|
||||
VRPCOBJ(aura_addc_rpc, JSON::print(ad->to_dict()), aura_addc, ad);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _s_resources.size(); ++i) {
|
||||
Ref<EntityResource> res = _s_resources.get(i);
|
||||
|
||||
ERR_CONTINUE(!res.is_valid());
|
||||
|
||||
res->resolve_references();
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_resources.size(); ++i) {
|
||||
Ref<EntityResource> res = _c_resources.get(i);
|
||||
|
||||
ERR_CONTINUE(!res.is_valid());
|
||||
|
||||
res->resolve_references();
|
||||
}
|
||||
|
||||
if (gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY) {
|
||||
if (ESS::get_singleton()->get_use_global_class_level()) {
|
||||
Ref<ClassProfile> cp = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(gets_entity_data()->get_path());
|
||||
@ -781,22 +765,6 @@ void Entity::_setup() {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _s_resources.size(); ++i) {
|
||||
Ref<EntityResource> res = _s_resources.get(i);
|
||||
|
||||
ERR_CONTINUE(!res.is_valid());
|
||||
|
||||
res->resolve_references();
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_resources.size(); ++i) {
|
||||
Ref<EntityResource> res = _c_resources.get(i);
|
||||
|
||||
ERR_CONTINUE(!res.is_valid());
|
||||
|
||||
res->resolve_references();
|
||||
}
|
||||
|
||||
sets_ai(_s_entity_data->get_ai_instance());
|
||||
|
||||
if (!Engine::get_singleton()->is_editor_hint())
|
||||
@ -1412,11 +1380,11 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
|
||||
StringName data_path = ird.get("data_path", "");
|
||||
|
||||
Ref<EntityResourceData> resd = ESS::get_singleton()->get_resource_db()->get_entity_resource_path(data_path);
|
||||
Ref<EntityResource> resd = ESS::get_singleton()->get_resource_db()->get_entity_resource_path(data_path);
|
||||
|
||||
ERR_CONTINUE(!resd.is_valid());
|
||||
|
||||
Ref<EntityResource> res = resd->get_entity_resource_instance();
|
||||
Ref<EntityResource> res = resd->duplicate(true);
|
||||
|
||||
ERR_CONTINUE(!res.is_valid());
|
||||
|
||||
@ -2413,7 +2381,7 @@ Ref<EntityResource> Entity::resource_gets_id(int id) {
|
||||
for (int i = EntityEnums::ENTITY_RESOURCE_INDEX_RESOURCES_BEGIN; i < _s_resources.size(); ++i) {
|
||||
Ref<EntityResource> r = _s_resources.get(i);
|
||||
|
||||
if (r->get_resource_data()->get_id() == id) {
|
||||
if (r->get_id() == id) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -2484,12 +2452,12 @@ void Entity::resource_addc_rpc(int index, String data) {
|
||||
|
||||
int data_id = dict.get("data_id", 0);
|
||||
|
||||
Ref<EntityResourceData> resd = ESS::get_singleton()->get_resource_db()->get_entity_resource(data_id);
|
||||
Ref<EntityResource> resd = ESS::get_singleton()->get_resource_db()->get_entity_resource(data_id);
|
||||
|
||||
ERR_FAIL_COND(!resd.is_valid());
|
||||
|
||||
Ref<EntityResource> res = resd->get_entity_resource_instance();
|
||||
|
||||
print_error("aaa");
|
||||
Ref<EntityResource> res = resd->duplicate(true);
|
||||
print_error("bbb");
|
||||
ERR_FAIL_COND(!res.is_valid());
|
||||
|
||||
res->from_dict(dict);
|
||||
@ -2506,7 +2474,7 @@ Ref<EntityResource> Entity::resource_getc_id(int id) {
|
||||
for (int i = EntityEnums::ENTITY_RESOURCE_INDEX_RESOURCES_BEGIN; i < _c_resources.size(); ++i) {
|
||||
Ref<EntityResource> r = _c_resources.get(i);
|
||||
|
||||
if (r->get_resource_data()->get_id() == id) {
|
||||
if (r->get_id() == id) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,20 @@ SOFTWARE.
|
||||
#include "../../database/ess_resource_db.h"
|
||||
#include "../../singletons/ess.h"
|
||||
#include "../entity.h"
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
int EntityResource::get_id() const {
|
||||
return _id;
|
||||
}
|
||||
void EntityResource::set_id(const int value) {
|
||||
_id = value;
|
||||
}
|
||||
|
||||
String EntityResource::get_text_name() const {
|
||||
return _text_name;
|
||||
}
|
||||
void EntityResource::set_text_name(const String value) {
|
||||
_text_name = value;
|
||||
}
|
||||
|
||||
bool EntityResource::get_dirty() const {
|
||||
return _dirty;
|
||||
@ -41,32 +54,6 @@ void EntityResource::set_should_process(const bool value) {
|
||||
_should_process = value;
|
||||
}
|
||||
|
||||
Ref<EntityResourceData> EntityResource::get_resource_data() {
|
||||
return _data;
|
||||
}
|
||||
void EntityResource::set_resource_data(const Ref<EntityResourceData> &value) {
|
||||
_data = value;
|
||||
|
||||
if (value.is_valid()) {
|
||||
_data_path = value->get_path();
|
||||
}
|
||||
|
||||
_dirty = true;
|
||||
|
||||
emit_signal("changed", Ref<EntityResource>(this));
|
||||
}
|
||||
|
||||
StringName EntityResource::get_data_path() const {
|
||||
return _data_path;
|
||||
}
|
||||
void EntityResource::set_data_path(const StringName &value) {
|
||||
_data_path = value;
|
||||
|
||||
_dirty = true;
|
||||
|
||||
emit_signal("changed", Ref<EntityResource>(this));
|
||||
}
|
||||
|
||||
int EntityResource::get_current_value() const {
|
||||
return _current;
|
||||
}
|
||||
@ -75,7 +62,7 @@ void EntityResource::set_current_value(const int value) {
|
||||
|
||||
_dirty = true;
|
||||
|
||||
emit_signal("changed", Ref<EntityResource>(this));
|
||||
//emit_signal("changed", Ref<EntityResource>(this));
|
||||
}
|
||||
|
||||
int EntityResource::get_max_value() const {
|
||||
@ -86,7 +73,7 @@ void EntityResource::set_max_value(const int value) {
|
||||
|
||||
_dirty = true;
|
||||
|
||||
emit_signal("changed", Ref<EntityResource>(this));
|
||||
//emit_signal("changed", Ref<EntityResource>(this));
|
||||
}
|
||||
|
||||
Entity *EntityResource::get_owner() {
|
||||
@ -164,10 +151,6 @@ void EntityResource::receivec_update_string(const String str) {
|
||||
call("_receivec_update_string", str);
|
||||
}
|
||||
|
||||
void EntityResource::resolve_references() {
|
||||
set_resource_data(ESS::get_singleton()->get_resource_db()->get_entity_resource_path(_data_path));
|
||||
}
|
||||
|
||||
Dictionary EntityResource::to_dict() {
|
||||
return call("_to_dict");
|
||||
}
|
||||
@ -178,11 +161,13 @@ void EntityResource::from_dict(const Dictionary &dict) {
|
||||
Dictionary EntityResource::_to_dict() {
|
||||
Dictionary dict;
|
||||
|
||||
dict["data_path"] = ESS::get_singleton()->get_resource_db()->get_entity_resource(_id)->get_path();
|
||||
|
||||
dict["dirty"] = _dirty;
|
||||
dict["should_process"] = _should_process;
|
||||
|
||||
//dict["data_id"] = _data_id;
|
||||
dict["data_path"] = _data_path;
|
||||
//dict["data_path"] = _data_path;
|
||||
|
||||
dict["current"] = _current;
|
||||
|
||||
@ -192,12 +177,11 @@ Dictionary EntityResource::_to_dict() {
|
||||
}
|
||||
void EntityResource::_from_dict(const Dictionary &dict) {
|
||||
ERR_FAIL_COND(dict.empty());
|
||||
ERR_FAIL_COND(!ESS::get_singleton()->get_resource_db().is_valid());
|
||||
|
||||
_dirty = dict.get("dirty", false);
|
||||
_should_process = dict.get("should_process", false);
|
||||
|
||||
_data_path = dict.get("data_path", "");
|
||||
//_data_path = dict.get("data_path", "");
|
||||
//_data_id = ESS::get_singleton()->get_resource_db()->entity_data_path_to_id(_data_path);
|
||||
|
||||
//_data_id = dict.get("data_id", 0);
|
||||
@ -206,9 +190,13 @@ void EntityResource::_from_dict(const Dictionary &dict) {
|
||||
}
|
||||
|
||||
EntityResource::EntityResource() {
|
||||
_id = 0;
|
||||
|
||||
_server_side = false;
|
||||
_dirty = false;
|
||||
|
||||
_owner = NULL;
|
||||
|
||||
_should_process = has_method("_process");
|
||||
|
||||
_current = 0;
|
||||
@ -216,25 +204,26 @@ EntityResource::EntityResource() {
|
||||
}
|
||||
|
||||
EntityResource::~EntityResource() {
|
||||
_data.unref();
|
||||
_owner = NULL;
|
||||
}
|
||||
|
||||
void EntityResource::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &EntityResource::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &EntityResource::set_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_text_name"), &EntityResource::get_text_name);
|
||||
ClassDB::bind_method(D_METHOD("set_text_name", "value"), &EntityResource::set_text_name);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_text_name", "get_text_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_dirty"), &EntityResource::get_dirty);
|
||||
ClassDB::bind_method(D_METHOD("set_dirty", "value"), &EntityResource::set_dirty);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dirty"), "set_dirty", "get_dirty");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dirty", PROPERTY_HINT_NONE, "", 0), "set_dirty", "get_dirty");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_should_process"), &EntityResource::get_should_process);
|
||||
ClassDB::bind_method(D_METHOD("set_should_process", "value"), &EntityResource::set_should_process);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "should_process"), "set_should_process", "get_should_process");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_resource_data"), &EntityResource::get_resource_data);
|
||||
ClassDB::bind_method(D_METHOD("set_resource_data", "value"), &EntityResource::set_resource_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "resource_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityResourceData"), "set_resource_data", "get_resource_data");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data_path"), &EntityResource::get_data_path);
|
||||
ClassDB::bind_method(D_METHOD("set_data_path", "value"), &EntityResource::set_data_path);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "data_path"), "set_data_path", "get_data_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "should_process", PROPERTY_HINT_NONE, "", 0), "set_should_process", "get_should_process");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_current_value"), &EntityResource::get_current_value);
|
||||
ClassDB::bind_method(D_METHOD("set_current_value", "value"), &EntityResource::set_current_value);
|
||||
|
@ -26,24 +26,23 @@ SOFTWARE.
|
||||
#include "core/resource.h"
|
||||
|
||||
class Entity;
|
||||
class EntityResourceData;
|
||||
|
||||
class EntityResource : public Resource {
|
||||
GDCLASS(EntityResource, Resource);
|
||||
|
||||
public:
|
||||
int get_id() const;
|
||||
void set_id(const int value);
|
||||
|
||||
String get_text_name() const;
|
||||
void set_text_name(const String value);
|
||||
|
||||
bool get_dirty() const;
|
||||
void set_dirty(const bool value);
|
||||
|
||||
bool get_should_process() const;
|
||||
void set_should_process(const bool value);
|
||||
|
||||
Ref<EntityResourceData> get_resource_data();
|
||||
void set_resource_data(const Ref<EntityResourceData> &value);
|
||||
|
||||
StringName get_data_path() const;
|
||||
void set_data_path(const StringName &value);
|
||||
|
||||
int get_current_value() const;
|
||||
void set_current_value(const int value);
|
||||
|
||||
@ -73,8 +72,6 @@ public:
|
||||
void receivec_update_full(const int current, const int max);
|
||||
void receivec_update_string(const String str);
|
||||
|
||||
virtual void resolve_references();
|
||||
|
||||
Dictionary to_dict();
|
||||
void from_dict(const Dictionary &dict);
|
||||
|
||||
@ -88,15 +85,15 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _id;
|
||||
String _text_name;
|
||||
|
||||
bool _server_side;
|
||||
|
||||
Entity *_owner;
|
||||
bool _dirty;
|
||||
bool _should_process;
|
||||
|
||||
Ref<EntityResourceData> _data;
|
||||
StringName _data_path;
|
||||
|
||||
int _current;
|
||||
int _max;
|
||||
};
|
||||
|
@ -25,8 +25,8 @@ SOFTWARE.
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "entity_resource.h"
|
||||
#include "entity_resource_cost_data.h"
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
class EntityResourceCostData : public Resource {
|
||||
GDCLASS(EntityResourceCostData, Resource);
|
||||
|
@ -25,8 +25,8 @@ SOFTWARE.
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "entity_resource.h"
|
||||
#include "entity_resource_cost_data.h"
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
class EntityResourceCostDataHealth : public EntityResourceCostData {
|
||||
GDCLASS(EntityResourceCostDataHealth, EntityResourceCostData);
|
||||
|
@ -22,10 +22,10 @@ SOFTWARE.
|
||||
|
||||
#include "entity_resource_cost_data_resource.h"
|
||||
|
||||
Ref<EntityResourceData> EntityResourceCostDataResource::get_entity_resource_data() {
|
||||
Ref<EntityResource> EntityResourceCostDataResource::get_entity_resource_data() {
|
||||
return _entity_resource_data;
|
||||
}
|
||||
void EntityResourceCostDataResource::set_entity_resource_data(Ref<EntityResourceData> data) {
|
||||
void EntityResourceCostDataResource::set_entity_resource_data(Ref<EntityResource> data) {
|
||||
_entity_resource_data = data;
|
||||
}
|
||||
|
||||
@ -35,5 +35,5 @@ EntityResourceCostDataResource::EntityResourceCostDataResource() {
|
||||
void EntityResourceCostDataResource::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resource_data"), &EntityResourceCostDataResource::get_entity_resource_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_resource_data", "value"), &EntityResourceCostDataResource::set_entity_resource_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "entity_resource_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityResourceData"), "set_entity_resource_data", "get_entity_resource_data");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "entity_resource_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource"), "set_entity_resource_data", "get_entity_resource_data");
|
||||
}
|
||||
|
@ -25,15 +25,15 @@ SOFTWARE.
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "entity_resource.h"
|
||||
#include "entity_resource_cost_data.h"
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
class EntityResourceCostDataResource : public EntityResourceCostData {
|
||||
GDCLASS(EntityResourceCostDataResource, EntityResourceCostData);
|
||||
|
||||
public:
|
||||
Ref<EntityResourceData> get_entity_resource_data();
|
||||
void set_entity_resource_data(Ref<EntityResourceData> data);
|
||||
Ref<EntityResource> get_entity_resource_data();
|
||||
void set_entity_resource_data(Ref<EntityResource> data);
|
||||
|
||||
EntityResourceCostDataResource();
|
||||
|
||||
@ -41,7 +41,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Ref<EntityResourceData> _entity_resource_data;
|
||||
Ref<EntityResource> _entity_resource_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "entity_resource_data.h"
|
||||
|
||||
#include "entity_resource.h"
|
||||
|
||||
int EntityResourceData::get_id() const {
|
||||
return _id;
|
||||
}
|
||||
void EntityResourceData::set_id(const int value) {
|
||||
_id = value;
|
||||
}
|
||||
|
||||
String EntityResourceData::get_text_description() const {
|
||||
return _text_description;
|
||||
}
|
||||
void EntityResourceData::set_text_description(const String value) {
|
||||
_text_description = value;
|
||||
}
|
||||
|
||||
Ref<EntityResource> EntityResourceData::get_entity_resource_instance() {
|
||||
if (has_method("_get_entity_resource_instance")) {
|
||||
return call("_get_entity_resource_instance");
|
||||
}
|
||||
|
||||
return Ref<EntityResource>();
|
||||
}
|
||||
|
||||
EntityResourceData::EntityResourceData() {
|
||||
_id = 0;
|
||||
}
|
||||
|
||||
void EntityResourceData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &EntityResourceData::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &EntityResourceData::set_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
||||
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "res", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource"), "_get_entity_resource_instance"));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_entity_resource_instance"), &EntityResourceData::get_entity_resource_instance);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_text_description"), &EntityResourceData::get_text_description);
|
||||
ClassDB::bind_method(D_METHOD("set_text_description", "value"), &EntityResourceData::set_text_description);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_description", PROPERTY_HINT_MULTILINE_TEXT), "set_text_description", "get_text_description");
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef ENTITY_RESOURCE_DATA_H
|
||||
#define ENTITY_RESOURCE_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "core/ustring.h"
|
||||
|
||||
class EntityResource;
|
||||
|
||||
class EntityResourceData : public Resource {
|
||||
GDCLASS(EntityResourceData, Resource);
|
||||
|
||||
public:
|
||||
int get_id() const;
|
||||
void set_id(const int value);
|
||||
|
||||
String get_text_description() const;
|
||||
void set_text_description(const String value);
|
||||
|
||||
Ref<EntityResource> get_entity_resource_instance();
|
||||
|
||||
EntityResourceData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _id;
|
||||
String _text_description;
|
||||
};
|
||||
|
||||
#endif
|
@ -25,7 +25,7 @@ SOFTWARE.
|
||||
#include "../../database/ess_resource_db.h"
|
||||
#include "../../singletons/ess.h"
|
||||
#include "../entity.h"
|
||||
#include "entity_resource_data.h"
|
||||
#include "entity_resource.h"
|
||||
|
||||
void EntityResourceHealth::_init() {
|
||||
set_current_value(100);
|
||||
|
@ -26,7 +26,6 @@ SOFTWARE.
|
||||
#include "entity_resource.h"
|
||||
|
||||
class Entity;
|
||||
class EntityResourceData;
|
||||
|
||||
class EntityResourceHealth : public EntityResource {
|
||||
GDCLASS(EntityResourceHealth, EntityResource);
|
||||
|
@ -25,7 +25,7 @@ SOFTWARE.
|
||||
#include "../../database/ess_resource_db.h"
|
||||
#include "../../singletons/ess.h"
|
||||
#include "../entity.h"
|
||||
#include "entity_resource_data.h"
|
||||
#include "entity_resource.h"
|
||||
|
||||
void EntityResourceSpeed::_init() {
|
||||
set_current_value(base_value);
|
||||
|
@ -26,7 +26,6 @@ SOFTWARE.
|
||||
#include "entity_resource.h"
|
||||
|
||||
class Entity;
|
||||
class EntityResourceData;
|
||||
|
||||
class EntityResourceSpeed : public EntityResource {
|
||||
GDCLASS(EntityResourceSpeed, EntityResource);
|
||||
|
@ -80,7 +80,6 @@ SOFTWARE.
|
||||
#include "entities/resources/entity_resource_cost_data.h"
|
||||
#include "entities/resources/entity_resource_cost_data_health.h"
|
||||
#include "entities/resources/entity_resource_cost_data_resource.h"
|
||||
#include "entities/resources/entity_resource_data.h"
|
||||
#include "entities/resources/entity_resource_health.h"
|
||||
#include "entities/resources/entity_resource_speed.h"
|
||||
|
||||
@ -193,7 +192,6 @@ void register_entity_spell_system_types() {
|
||||
ClassDB::register_class<SpellHealInfo>();
|
||||
ClassDB::register_class<AuraData>();
|
||||
|
||||
ClassDB::register_class<EntityResourceData>();
|
||||
ClassDB::register_class<EntityResourceCostData>();
|
||||
ClassDB::register_class<EntityResourceCostDataHealth>();
|
||||
ClassDB::register_class<EntityResourceCostDataResource>();
|
||||
|
Loading…
Reference in New Issue
Block a user