mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-04-15 21:26:08 +02:00
Centralized most of the 4.0 port code into a new header.
This commit is contained in:
parent
31c00cf3b2
commit
7bbca9ae89
@ -25,13 +25,7 @@ SOFTWARE.
|
||||
#include "../../entities/resources/entity_resource_cost_data.h"
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define PoolStringArray PackedStringArray
|
||||
|
||||
#define POOL_STRING_ARRAY PACKED_STRING_ARRAY
|
||||
#endif
|
||||
#include "../../defines.h"
|
||||
|
||||
int Aura::get_id() const {
|
||||
return _id;
|
||||
@ -1094,11 +1088,7 @@ void Aura::_supdate(Ref<AuraData> aura, float delta) {
|
||||
}
|
||||
|
||||
void Aura::_setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(info->get_caster()));
|
||||
#else
|
||||
ERR_FAIL_COND(info->get_caster() == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(info->get_caster()));
|
||||
|
||||
data->set_aura(Ref<Aura>(this));
|
||||
data->set_aura_id(get_id());
|
||||
@ -1134,22 +1124,14 @@ void Aura::_calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraApplyInfo>
|
||||
}
|
||||
|
||||
void Aura::_handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> info) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(info->get_dealer()));
|
||||
#else
|
||||
ERR_FAIL_COND(info->get_dealer() == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(info->get_dealer()));
|
||||
|
||||
Math::randomize();
|
||||
|
||||
info->set_damage(_damage_min + (Math::rand() % (_damage_max = _damage_min)));
|
||||
info->set_damage_source_type(SpellDamageInfo::DAMAGE_SOURCE_AURA);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(info->get_dealer()));
|
||||
#else
|
||||
ERR_FAIL_COND(info->get_dealer() == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(info->get_dealer()));
|
||||
|
||||
info->get_dealer()->sdeal_damage_to(info);
|
||||
}
|
||||
@ -1167,22 +1149,14 @@ void Aura::_calculate_initial_heal(Ref<AuraData> aura_data, Ref<AuraApplyInfo> i
|
||||
}
|
||||
|
||||
void Aura::_handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> info) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(info->get_dealer()));
|
||||
#else
|
||||
ERR_FAIL_COND(info->get_dealer() == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(info->get_dealer()));
|
||||
|
||||
Math::randomize();
|
||||
|
||||
info->set_heal(_heal_min + (Math::rand() % (_heal_max = _heal_min)));
|
||||
info->set_heal_source_type(SpellHealInfo::HEAL_SOURCE_AURA);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(info->get_dealer()));
|
||||
#else
|
||||
ERR_FAIL_COND(info->get_dealer() == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(info->get_dealer()));
|
||||
|
||||
info->get_dealer()->sdeal_heal_to(info);
|
||||
}
|
||||
|
@ -25,11 +25,7 @@ SOFTWARE.
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define REAL FLOAT
|
||||
#endif
|
||||
#include "../../defines.h"
|
||||
|
||||
class ItemStatModifier : public Reference {
|
||||
GDCLASS(ItemStatModifier, Reference);
|
||||
|
@ -29,7 +29,7 @@ SOFTWARE.
|
||||
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
int ItemTemplate::get_id() const {
|
||||
return _id;
|
||||
@ -178,23 +178,10 @@ void ItemTemplate::set_teaches_spell(const int index, const Ref<Spell> &spell) {
|
||||
}
|
||||
|
||||
Vector<Variant> ItemTemplate::get_teaches_spells() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _teaches_spells.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_teaches_spells[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_teaches_spells[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_teaches_spells);
|
||||
}
|
||||
void ItemTemplate::set_teaches_spells(const Vector<Variant> &spells) {
|
||||
_teaches_spells.clear();
|
||||
for (int i = 0; i < spells.size(); i++) {
|
||||
Ref<Spell> spell = Ref<Spell>(spells[i]);
|
||||
|
||||
_teaches_spells.push_back(spell);
|
||||
}
|
||||
VARIANT_ARRAY_SET(spells, _teaches_spells, Spell);
|
||||
}
|
||||
|
||||
//// GRANTS SPELLS ////
|
||||
@ -218,23 +205,10 @@ void ItemTemplate::set_grants_spell(const int index, const Ref<Spell> &spell) {
|
||||
}
|
||||
|
||||
Vector<Variant> ItemTemplate::get_grants_spells() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _grants_spells.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_grants_spells[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_grants_spells[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_grants_spells);
|
||||
}
|
||||
void ItemTemplate::set_grants_spells(const Vector<Variant> &spells) {
|
||||
_grants_spells.clear();
|
||||
for (int i = 0; i < spells.size(); i++) {
|
||||
Ref<Spell> spell = Ref<Spell>(spells[i]);
|
||||
|
||||
_grants_spells.push_back(spell);
|
||||
}
|
||||
VARIANT_ARRAY_SET(spells, _grants_spells, Spell);
|
||||
}
|
||||
|
||||
//// AURAS ////
|
||||
@ -258,23 +232,10 @@ void ItemTemplate::set_aura(const int index, const Ref<Aura> &aura) {
|
||||
}
|
||||
|
||||
Vector<Variant> ItemTemplate::get_auras() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _auras.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_auras[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_auras[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_auras);
|
||||
}
|
||||
void ItemTemplate::set_auras(const Vector<Variant> &auras) {
|
||||
_auras.clear();
|
||||
for (int i = 0; i < auras.size(); i++) {
|
||||
Ref<Aura> spell = Ref<Aura>(auras[i]);
|
||||
|
||||
_auras.push_back(spell);
|
||||
}
|
||||
VARIANT_ARRAY_SET(auras, _auras, Aura);
|
||||
}
|
||||
|
||||
//Required Skills
|
||||
@ -294,23 +255,10 @@ void ItemTemplate::set_required_skill(const int index, const Ref<Aura> &aura) {
|
||||
}
|
||||
|
||||
Vector<Variant> ItemTemplate::get_required_skills() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _required_skills.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_required_skills[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_required_skills[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_required_skills);
|
||||
}
|
||||
void ItemTemplate::set_required_skills(const Vector<Variant> &skills) {
|
||||
_required_skills.clear();
|
||||
for (int i = 0; i < skills.size(); i++) {
|
||||
Ref<Aura> skill = Ref<Aura>(skills[i]);
|
||||
|
||||
_required_skills.push_back(skill);
|
||||
}
|
||||
VARIANT_ARRAY_SET(skills, _required_skills, Aura);
|
||||
}
|
||||
|
||||
//use spell
|
||||
|
@ -25,11 +25,7 @@ SOFTWARE.
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define REAL FLOAT
|
||||
#endif
|
||||
#include "../../defines.h"
|
||||
|
||||
class ItemTemplateStatModifier : public Reference {
|
||||
GDCLASS(ItemTemplateStatModifier, Reference);
|
||||
|
@ -24,6 +24,8 @@ SOFTWARE.
|
||||
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
#include "../../defines.h"
|
||||
|
||||
int ModelVisual::get_layer() {
|
||||
return _layer;
|
||||
}
|
||||
@ -57,23 +59,10 @@ int ModelVisual::get_visual_entry_count() const {
|
||||
}
|
||||
|
||||
Vector<Variant> ModelVisual::get_visual_entries() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _visual_entries.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_visual_entries[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_visual_entries[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_visual_entries);
|
||||
}
|
||||
void ModelVisual::set_visual_entries(const Vector<Variant> &visual_entries) {
|
||||
_visual_entries.clear();
|
||||
for (int i = 0; i < visual_entries.size(); i++) {
|
||||
Ref<ModelVisualEntry> visual_entry = Ref<ModelVisualEntry>(visual_entries[i]);
|
||||
|
||||
_visual_entries.push_back(visual_entry);
|
||||
}
|
||||
VARIANT_ARRAY_SET(visual_entries, _visual_entries, ModelVisualEntry);
|
||||
}
|
||||
|
||||
ModelVisual::ModelVisual() {
|
||||
|
@ -74,23 +74,10 @@ int EntitySpeciesData::get_model_data_count() const {
|
||||
}
|
||||
|
||||
Vector<Variant> EntitySpeciesData::get_model_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _model_datas.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_model_datas[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_model_datas[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_model_datas);
|
||||
}
|
||||
void EntitySpeciesData::set_model_datas(const Vector<Variant> &model_datas) {
|
||||
_model_datas.clear();
|
||||
for (int i = 0; i < model_datas.size(); i++) {
|
||||
Ref<SpeciesModelData> model_data = Ref<SpeciesModelData>(model_datas[i]);
|
||||
|
||||
_model_datas.push_back(model_data);
|
||||
}
|
||||
VARIANT_ARRAY_SET(model_datas, _model_datas, SpeciesModelData);
|
||||
}
|
||||
|
||||
//Spells
|
||||
@ -119,23 +106,10 @@ int EntitySpeciesData::get_spell_count() const {
|
||||
}
|
||||
|
||||
Vector<Variant> EntitySpeciesData::get_spells() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _spells.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_spells[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_spells[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_spells);
|
||||
}
|
||||
void EntitySpeciesData::set_spells(const Vector<Variant> &spells) {
|
||||
_spells.clear();
|
||||
for (int i = 0; i < spells.size(); i++) {
|
||||
Ref<Spell> spell = Ref<Spell>(spells[i]);
|
||||
|
||||
_spells.push_back(spell);
|
||||
}
|
||||
VARIANT_ARRAY_SET(spells, _spells, Spell);
|
||||
}
|
||||
|
||||
//Auras
|
||||
@ -164,15 +138,7 @@ int EntitySpeciesData::get_aura_count() const {
|
||||
}
|
||||
|
||||
Vector<Variant> EntitySpeciesData::get_auras() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _auras.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_auras[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_auras[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_auras);
|
||||
}
|
||||
void EntitySpeciesData::set_auras(const Vector<Variant> &auras) {
|
||||
_auras.clear();
|
||||
|
@ -26,6 +26,8 @@ SOFTWARE.
|
||||
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
#include "../../defines.h"
|
||||
|
||||
int SpeciesModelData::get_id() {
|
||||
return _id;
|
||||
}
|
||||
@ -75,15 +77,7 @@ int SpeciesModelData::get_visual_count(const int bone_index) const {
|
||||
Vector<Variant> SpeciesModelData::get_visuals(const int bone_index) {
|
||||
ERR_FAIL_INDEX_V(bone_index, EntityEnums::SKELETON_POINTS_MAX, Vector<Variant>());
|
||||
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _visuals[bone_index].size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_visuals[bone_index][i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_visuals[bone_index][i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_visuals[bone_index]);
|
||||
}
|
||||
void SpeciesModelData::set_visuals(const int bone_index, const Vector<Variant> &visuals) {
|
||||
ERR_FAIL_INDEX(bone_index, EntityEnums::SKELETON_POINTS_MAX);
|
||||
@ -204,23 +198,10 @@ int SpeciesModelData::get_hair_style_count() const {
|
||||
}
|
||||
|
||||
Vector<Variant> SpeciesModelData::get_hair_styles() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _hair_styles.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_hair_styles[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_hair_styles[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_hair_styles);
|
||||
}
|
||||
void SpeciesModelData::set_hair_styles(const Vector<Variant> &hair_styles) {
|
||||
_hair_styles.clear();
|
||||
for (int i = 0; i < hair_styles.size(); i++) {
|
||||
Ref<ModelVisualEntry> hair_style = Ref<ModelVisualEntry>(hair_styles[i]);
|
||||
|
||||
_hair_styles.push_back(hair_style);
|
||||
}
|
||||
VARIANT_ARRAY_SET(hair_styles, _hair_styles, ModelVisualEntry);
|
||||
}
|
||||
|
||||
//HairColors
|
||||
@ -290,23 +271,10 @@ int SpeciesModelData::get_head_count() const {
|
||||
}
|
||||
|
||||
Vector<Variant> SpeciesModelData::get_heads() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _heads.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_heads[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_heads[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_heads);
|
||||
}
|
||||
void SpeciesModelData::set_heads(const Vector<Variant> &heads) {
|
||||
_heads.clear();
|
||||
for (int i = 0; i < heads.size(); i++) {
|
||||
Ref<ModelVisualEntry> head = Ref<ModelVisualEntry>(heads[i]);
|
||||
|
||||
_heads.push_back(head);
|
||||
}
|
||||
VARIANT_ARRAY_SET(heads, _heads, ModelVisualEntry);
|
||||
}
|
||||
|
||||
SpeciesModelData::SpeciesModelData() {
|
||||
|
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
#include "../../pipelines/spell_damage_info.h"
|
||||
#include "../../pipelines/spell_heal_info.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
int Spell::get_id() const {
|
||||
return _id;
|
||||
@ -204,23 +204,10 @@ void Spell::set_caster_aura_apply(const int index, const Ref<Aura> &caster_aura_
|
||||
}
|
||||
|
||||
Vector<Variant> Spell::get_caster_aura_applys() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _caster_aura_applys.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_caster_aura_applys[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_caster_aura_applys[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_caster_aura_applys);
|
||||
}
|
||||
void Spell::set_caster_aura_applys(const Vector<Variant> &caster_aura_applys) {
|
||||
_caster_aura_applys.clear();
|
||||
for (int i = 0; i < caster_aura_applys.size(); i++) {
|
||||
Ref<Aura> aura = Ref<Aura>(caster_aura_applys[i]);
|
||||
|
||||
_caster_aura_applys.push_back(aura);
|
||||
}
|
||||
VARIANT_ARRAY_SET(caster_aura_applys, _caster_aura_applys, Aura);
|
||||
}
|
||||
|
||||
//// Target Aura Apply ////
|
||||
@ -244,23 +231,10 @@ void Spell::set_target_aura_apply(const int index, const Ref<Aura> &target_aura_
|
||||
}
|
||||
|
||||
Vector<Variant> Spell::get_target_aura_applys() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _target_aura_applys.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_target_aura_applys[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_target_aura_applys[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_target_aura_applys);
|
||||
}
|
||||
void Spell::set_target_aura_applys(const Vector<Variant> &target_aura_applys) {
|
||||
_target_aura_applys.clear();
|
||||
for (int i = 0; i < target_aura_applys.size(); i++) {
|
||||
Ref<Aura> aura = Ref<Aura>(target_aura_applys[i]);
|
||||
|
||||
_target_aura_applys.push_back(aura);
|
||||
}
|
||||
VARIANT_ARRAY_SET(target_aura_applys, _target_aura_applys, Aura);
|
||||
}
|
||||
|
||||
//// Apply Auras On Learn ////
|
||||
@ -284,23 +258,10 @@ void Spell::set_on_learn_aura(const int index, const Ref<Aura> &on_learn_aura_ap
|
||||
}
|
||||
|
||||
Vector<Variant> Spell::get_on_learn_auras() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _on_learn_auras.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_on_learn_auras[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_on_learn_auras[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_on_learn_auras);
|
||||
}
|
||||
void Spell::set_on_learn_auras(const Vector<Variant> &on_learn_aura_applys) {
|
||||
_on_learn_auras.clear();
|
||||
for (int i = 0; i < on_learn_aura_applys.size(); i++) {
|
||||
Ref<Aura> aura = Ref<Aura>(on_learn_aura_applys[i]);
|
||||
|
||||
_on_learn_auras.push_back(aura);
|
||||
}
|
||||
VARIANT_ARRAY_SET(on_learn_aura_applys, _on_learn_auras, Aura);
|
||||
}
|
||||
|
||||
//// Range ////
|
||||
@ -574,11 +535,7 @@ void Spell::set_training_required_skill_level(const int value) {
|
||||
//// Spell System ////
|
||||
|
||||
void Spell::cast_starts_simple(Entity *caster, float spell_scale) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster));
|
||||
#else
|
||||
ERR_FAIL_COND(!caster || caster == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!caster || !INSTANCE_VALIDATE(caster));
|
||||
|
||||
Ref<SpellCastInfo> info = Ref<SpellCastInfo>(memnew(SpellCastInfo()));
|
||||
|
||||
@ -593,11 +550,7 @@ void Spell::cast_starts_simple(Entity *caster, float spell_scale) {
|
||||
}
|
||||
|
||||
void Spell::cast_interrupts_simple(Entity *caster) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster));
|
||||
#else
|
||||
ERR_FAIL_COND(!caster || caster == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!caster || !INSTANCE_VALIDATE(caster));
|
||||
|
||||
Ref<SpellCastInfo> info(memnew(SpellCastInfo()));
|
||||
|
||||
@ -608,11 +561,7 @@ void Spell::cast_interrupts_simple(Entity *caster) {
|
||||
}
|
||||
|
||||
void Spell::cast_starts_triggered_simple(Entity *caster) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster));
|
||||
#else
|
||||
ERR_FAIL_COND(!caster || caster == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!caster || !INSTANCE_VALIDATE(caster));
|
||||
|
||||
Ref<SpellCastInfo> info(memnew(SpellCastInfo()));
|
||||
|
||||
@ -954,11 +903,7 @@ void Spell::_cast_finishs(Ref<SpellCastInfo> info) {
|
||||
info->get_caster()->notification_scast(SpellEnums::NOTIFICATION_CAST_FINISHED, info);
|
||||
info->get_caster()->cast_spell_successs(info);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(info->get_target())) {
|
||||
#else
|
||||
if (info->get_target() != NULL) {
|
||||
#endif
|
||||
if (INSTANCE_VALIDATE(info->get_target())) {
|
||||
info->get_target()->notification_scast(SpellEnums::NOTIFICATION_CAST_FINISHED_TARGET, info);
|
||||
}
|
||||
|
||||
@ -1011,11 +956,7 @@ void Spell::_handle_projectile(Ref<SpellCastInfo> info) {
|
||||
|
||||
Node *p = info->get_caster()->get_parent();
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(p));
|
||||
#else
|
||||
ERR_FAIL_COND(p == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(p));
|
||||
|
||||
p->add_child(projectile);
|
||||
|
||||
@ -1025,7 +966,6 @@ void Spell::_handle_projectile(Ref<SpellCastInfo> info) {
|
||||
}
|
||||
|
||||
void Spell::_handle_effect(Ref<SpellCastInfo> info) {
|
||||
|
||||
/*
|
||||
# var ok : bool = false
|
||||
|
||||
@ -1042,11 +982,7 @@ void Spell::_handle_effect(Ref<SpellCastInfo> info) {
|
||||
# return
|
||||
*/
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
bool has_target = ObjectDB::instance_validate(info->get_target());
|
||||
#else
|
||||
bool has_target = info->get_target() == NULL;
|
||||
#endif
|
||||
bool has_target = INSTANCE_VALIDATE(info->get_target());
|
||||
|
||||
if (_target_type == SPELL_TARGET_TYPE_TARGET) {
|
||||
if (!has_target)
|
||||
|
@ -41,13 +41,7 @@ SOFTWARE.
|
||||
|
||||
#include "../data/entities/xp_data.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define PoolStringArray PackedStringArray
|
||||
|
||||
#define POOL_STRING_ARRAY PACKED_STRING_ARRAY
|
||||
#endif
|
||||
#include "../defines.h"
|
||||
|
||||
class Aura;
|
||||
class Spell;
|
||||
|
@ -56,15 +56,7 @@ void ESSResourceDBMap::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
ESSResourceDB::add_entity_resource(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_entity_resources() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_resources.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_resources[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_resources[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_resources);
|
||||
}
|
||||
void ESSResourceDBMap::set_entity_resources(const Vector<Variant> &data) {
|
||||
_entity_resources.clear();
|
||||
@ -100,15 +92,7 @@ void ESSResourceDBMap::add_entity_skill(Ref<EntitySkillData> cls) {
|
||||
ESSResourceDB::add_entity_skill(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_entity_skills() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_skills.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_skills[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_skills[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_skills);
|
||||
}
|
||||
void ESSResourceDBMap::set_entity_skills(const Vector<Variant> &data) {
|
||||
_entity_skills.clear();
|
||||
@ -144,15 +128,7 @@ void ESSResourceDBMap::add_entity_data(Ref<EntityData> cls) {
|
||||
ESSResourceDB::add_entity_data(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_entity_datas() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_datas.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_datas[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_datas[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_datas);
|
||||
}
|
||||
void ESSResourceDBMap::set_entity_datas(const Vector<Variant> &data) {
|
||||
_craft_recipes.clear();
|
||||
@ -189,15 +165,7 @@ void ESSResourceDBMap::add_spell(Ref<Spell> spell) {
|
||||
ESSResourceDB::add_spell(spell);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_spells() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _spells.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_spells[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_spells[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_spells);
|
||||
}
|
||||
void ESSResourceDBMap::set_spells(const Vector<Variant> &data) {
|
||||
_spells.clear();
|
||||
@ -237,15 +205,7 @@ int ESSResourceDBMap::get_aura_count() {
|
||||
}
|
||||
|
||||
Vector<Variant> ESSResourceDBMap::get_auras() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _auras.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_auras[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_auras[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_auras);
|
||||
}
|
||||
void ESSResourceDBMap::set_auras(const Vector<Variant> &data) {
|
||||
_auras.clear();
|
||||
@ -286,15 +246,7 @@ int ESSResourceDBMap::get_craft_recipe_count() {
|
||||
}
|
||||
|
||||
Vector<Variant> ESSResourceDBMap::get_craft_recipes() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _craft_recipes.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_craft_recipes[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_craft_recipes[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_craft_recipes);
|
||||
}
|
||||
void ESSResourceDBMap::set_craft_recipes(const Vector<Variant> &data) {
|
||||
_craft_recipes.clear();
|
||||
@ -333,15 +285,7 @@ int ESSResourceDBMap::get_item_template_count() {
|
||||
return _item_templates.size();
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_item_templates() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _item_templates.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_item_templates[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_item_templates[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_item_templates);
|
||||
}
|
||||
void ESSResourceDBMap::set_item_templates(const Vector<Variant> &data) {
|
||||
_item_templates.clear();
|
||||
@ -378,15 +322,7 @@ int ESSResourceDBMap::get_entity_species_data_count() {
|
||||
return _entity_species_datas.size();
|
||||
}
|
||||
Vector<Variant> ESSResourceDBMap::get_entity_species_datas() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_species_datas.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_species_datas[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_species_datas[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_species_datas);
|
||||
}
|
||||
void ESSResourceDBMap::set_entity_species_datas(const Vector<Variant> &data) {
|
||||
_entity_species_datas.clear();
|
||||
|
@ -41,13 +41,7 @@ SOFTWARE.
|
||||
|
||||
#include "../data/entities/xp_data.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define PoolStringArray PackedStringArray
|
||||
|
||||
#define POOL_STRING_ARRAY PACKED_STRING_ARRAY
|
||||
#endif
|
||||
#include "../defines.h"
|
||||
|
||||
class Aura;
|
||||
class Spell;
|
||||
@ -127,29 +121,29 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
Vector<Ref<EntityResourceData> > _entity_resources;
|
||||
HashMap<int, Ref<EntityResourceData> > _entity_resource_map;
|
||||
Vector<Ref<EntityResourceData>> _entity_resources;
|
||||
HashMap<int, Ref<EntityResourceData>> _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
|
||||
|
@ -60,15 +60,7 @@ void ESSResourceDBStatic::add_entity_resource(Ref<EntityResourceData> cls) {
|
||||
ESSResourceDB::add_entity_resource(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_entity_resources() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_resources.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_resources[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_resources[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_resources);
|
||||
}
|
||||
void ESSResourceDBStatic::set_entity_resources(const Vector<Variant> &data) {
|
||||
_entity_resources.clear();
|
||||
@ -102,15 +94,7 @@ void ESSResourceDBStatic::add_entity_skill(Ref<EntitySkillData> cls) {
|
||||
ESSResourceDB::add_entity_skill(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_entity_skills() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_skills.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_skills[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_skills[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_skills);
|
||||
}
|
||||
void ESSResourceDBStatic::set_entity_skills(const Vector<Variant> &data) {
|
||||
_entity_skills.clear();
|
||||
@ -144,15 +128,7 @@ void ESSResourceDBStatic::add_entity_data(Ref<EntityData> cls) {
|
||||
ESSResourceDB::add_entity_data(cls);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_entity_datas() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_datas.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_datas[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_datas[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_datas);
|
||||
}
|
||||
void ESSResourceDBStatic::set_entity_datas(const Vector<Variant> &data) {
|
||||
_entity_datas.clear();
|
||||
@ -187,15 +163,7 @@ void ESSResourceDBStatic::add_spell(Ref<Spell> spell) {
|
||||
ESSResourceDB::add_spell(spell);
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_spells() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _spells.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_spells[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_spells[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_spells);
|
||||
}
|
||||
void ESSResourceDBStatic::set_spells(const Vector<Variant> &data) {
|
||||
_spells.clear();
|
||||
@ -233,15 +201,7 @@ int ESSResourceDBStatic::get_aura_count() {
|
||||
}
|
||||
|
||||
Vector<Variant> ESSResourceDBStatic::get_auras() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _auras.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_auras[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_auras[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_auras);
|
||||
}
|
||||
void ESSResourceDBStatic::set_auras(const Vector<Variant> &data) {
|
||||
_auras.clear();
|
||||
@ -280,15 +240,7 @@ int ESSResourceDBStatic::get_craft_recipe_count() {
|
||||
}
|
||||
|
||||
Vector<Variant> ESSResourceDBStatic::get_craft_recipes() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _craft_recipes.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_craft_recipes[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_craft_recipes[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_craft_recipes);
|
||||
}
|
||||
void ESSResourceDBStatic::set_craft_recipes(const Vector<Variant> &data) {
|
||||
_craft_recipes.clear();
|
||||
@ -325,15 +277,7 @@ int ESSResourceDBStatic::get_item_template_count() {
|
||||
return _item_templates.size();
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_item_templates() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _item_templates.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_item_templates[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_item_templates[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_item_templates);
|
||||
}
|
||||
void ESSResourceDBStatic::set_item_templates(const Vector<Variant> &data) {
|
||||
_item_templates.clear();
|
||||
@ -367,15 +311,7 @@ int ESSResourceDBStatic::get_entity_species_data_count() {
|
||||
return _entity_species_datas.size();
|
||||
}
|
||||
Vector<Variant> ESSResourceDBStatic::get_entity_species_datas() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_species_datas.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_species_datas[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_species_datas[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_species_datas);
|
||||
}
|
||||
void ESSResourceDBStatic::set_entity_species_datas(const Vector<Variant> &data) {
|
||||
_entity_species_datas.clear();
|
||||
|
@ -31,13 +31,7 @@ SOFTWARE.
|
||||
|
||||
#include "../data/entities/xp_data.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define PoolStringArray PackedStringArray
|
||||
|
||||
#define POOL_STRING_ARRAY PACKED_STRING_ARRAY
|
||||
#endif
|
||||
#include "../defines.h"
|
||||
|
||||
class Aura;
|
||||
class Spell;
|
||||
@ -130,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<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;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
91
defines.h
Normal file
91
defines.h
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
#ifndef ESS_DEFINES_H
|
||||
#define ESS_DEFINES_H
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define GODOT4 true
|
||||
#endif
|
||||
|
||||
//includes
|
||||
#if GODOT4
|
||||
#define spatial_h_path "scene/3d/node_3d.h"
|
||||
#define visual_server_h_path include "servers/rendering_server.h"
|
||||
|
||||
//#include "core/input/input_event.h"
|
||||
//#include "editor/plugins/node_3d_editor_plugin.h"
|
||||
//#include "scene/3d/camera_3d.h"
|
||||
#else
|
||||
#define spatial_h_path "scene/3d/spatial.h"
|
||||
#define visual_server_h_path include "servers/visual_server.h"
|
||||
|
||||
//#include "core/os/input.h"
|
||||
//#include "editor/plugins/spatial_editor_plugin.h"
|
||||
//#include "scene/3d/camera.h"
|
||||
|
||||
#endif
|
||||
|
||||
//Type Defines
|
||||
#if GODOT4
|
||||
#define PhysicsDirectSpaceState PhysicsDirectSpaceState3D
|
||||
#define SpatialEditor Node3DEditor
|
||||
#define SpatialEditorPlugin Node3DEditorPlugin
|
||||
#define SpatialEditorViewport Node3DEditorViewport
|
||||
#define PoolStringArray PackedStringArray
|
||||
#define REAL FLOAT
|
||||
#define POOL_STRING_ARRAY PACKED_STRING_ARRAY
|
||||
#define Spatial Node3D
|
||||
|
||||
typedef class RenderingServer VisualServer;
|
||||
typedef class RenderingServer VS;
|
||||
|
||||
#define PoolVector3Array PackedVector3Array
|
||||
#define PoolVector2Array PackedVector2Array
|
||||
#define PoolColorArray PackedColorArray
|
||||
#define PoolIntArray PackedInt64Array
|
||||
#define PoolRealArray PackedFloat32Array
|
||||
|
||||
//toodo figure out a way to have this
|
||||
//#define Variant::CallError Callable::CallError
|
||||
#endif
|
||||
|
||||
#if GODOT4
|
||||
|
||||
#define VARIANT_ARRAY_GET(arr) \
|
||||
Vector<Variant> r; \
|
||||
for (int i = 0; i < arr.size(); i++) { \
|
||||
r.push_back(arr[i]); \
|
||||
} \
|
||||
return r;
|
||||
|
||||
#else
|
||||
|
||||
#define VARIANT_ARRAY_GET(arr) \
|
||||
Vector<Variant> r; \
|
||||
for (int i = 0; i < arr.size(); i++) { \
|
||||
r.push_back(arr[i].get_ref_ptr()); \
|
||||
} \
|
||||
return r;
|
||||
|
||||
#endif
|
||||
|
||||
#define VARIANT_ARRAY_SET(arr, arr_into, type) \
|
||||
arr_into.clear(); \
|
||||
for (int i = 0; i < arr.size(); i++) { \
|
||||
Ref<type> e = Ref<type>(arr[i]); \
|
||||
arr_into.push_back(e); \
|
||||
}
|
||||
|
||||
#if GODOT4
|
||||
//TODO do this properly
|
||||
#define INSTANCE_VALIDATE(var) var
|
||||
#define CONNECT(sig, obj, target_method_class, method) connect(sig, callable_mp(obj, &target_method_class::method))
|
||||
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, callable_mp(obj, &target_method_class::method))
|
||||
#else
|
||||
#define INSTANCE_VALIDATE(var) ObjectDB::instance_validate(var)
|
||||
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
|
||||
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
|
||||
#endif
|
||||
|
||||
#endif
|
@ -24,7 +24,7 @@ SOFTWARE.
|
||||
|
||||
#include "../entity.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
bool EntityAI::get_enabled() {
|
||||
return _enabled;
|
||||
@ -100,42 +100,26 @@ String EntityAI::get_editor_description() const {
|
||||
}
|
||||
|
||||
void EntityAI::update(float delta) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(_owner));
|
||||
#else
|
||||
ERR_FAIL_COND(_owner == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(_owner));
|
||||
|
||||
if (has_method("_update"))
|
||||
call("_update", delta);
|
||||
}
|
||||
void EntityAI::pet_update(float delta) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(_owner));
|
||||
#else
|
||||
ERR_FAIL_COND(_owner == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(_owner));
|
||||
|
||||
if (has_method("_pet_update"))
|
||||
call("_pet_update", delta);
|
||||
}
|
||||
|
||||
void EntityAI::move(float delta) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(_owner));
|
||||
#else
|
||||
ERR_FAIL_COND(_owner == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(_owner));
|
||||
|
||||
if (has_method("_move"))
|
||||
call("_move", delta);
|
||||
}
|
||||
void EntityAI::pet_move(float delta) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(_owner));
|
||||
#else
|
||||
ERR_FAIL_COND(_owner == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(_owner));
|
||||
|
||||
if (has_method("_pet_move"))
|
||||
call("_pet_move", delta);
|
||||
|
@ -27,7 +27,7 @@ SOFTWARE.
|
||||
#include "../../singletons/ess.h"
|
||||
#include "../entity.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
float AuraData::get_damage_count() {
|
||||
return _damage_already_taken;
|
||||
@ -265,11 +265,8 @@ void AuraData::set_slow(float value) {
|
||||
}
|
||||
|
||||
void AuraData::resolve_references(Node *owner) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(owner));
|
||||
#else
|
||||
ERR_FAIL_COND(owner == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(owner));
|
||||
|
||||
ERR_FAIL_COND(!owner->is_inside_tree());
|
||||
|
||||
_owner = Object::cast_to<Entity>(owner);
|
||||
|
@ -24,7 +24,7 @@ SOFTWARE.
|
||||
|
||||
#include "../../data/auras/aura.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
int CharacterSpec::get_id() {
|
||||
return _id;
|
||||
@ -52,23 +52,10 @@ void CharacterSpec::set_talent_row(const int index, const Ref<TalentRowData> row
|
||||
}
|
||||
|
||||
Vector<Variant> CharacterSpec::get_talent_rows() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _rows.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_rows[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_rows[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_rows);
|
||||
}
|
||||
void CharacterSpec::set_talent_rows(const Vector<Variant> &talent_rows) {
|
||||
_rows.clear();
|
||||
for (int i = 0; i < talent_rows.size(); i++) {
|
||||
Ref<TalentRowData> talent_row = Ref<TalentRowData>(talent_rows[i]);
|
||||
|
||||
_rows.push_back(talent_row);
|
||||
}
|
||||
VARIANT_ARRAY_SET(talent_rows, _rows, TalentRowData);
|
||||
}
|
||||
|
||||
Ref<Aura> CharacterSpec::get_talent(const int row_index, const int culomn, const int rank) const {
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE.
|
||||
#include "../entity.h"
|
||||
#include "character_spec.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
int EntityClassData::get_id() {
|
||||
return _id;
|
||||
@ -103,15 +103,7 @@ void EntityClassData::set_entity_resource(int index, Ref<EntityResourceData> ent
|
||||
}
|
||||
|
||||
Vector<Variant> EntityClassData::get_entity_resources() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _entity_resources.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_entity_resources[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_entity_resources[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_entity_resources);
|
||||
}
|
||||
void EntityClassData::set_entity_resources(const Vector<Variant> &entity_resources) {
|
||||
_entity_resources.clear();
|
||||
@ -151,15 +143,7 @@ void EntityClassData::set_spec(int index, Ref<CharacterSpec> spec) {
|
||||
}
|
||||
|
||||
Vector<Variant> EntityClassData::get_specs() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _specs.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_specs[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_specs[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_specs);
|
||||
}
|
||||
void EntityClassData::set_specs(const Vector<Variant> &specs) {
|
||||
_specs.clear();
|
||||
@ -199,15 +183,7 @@ void EntityClassData::set_spell(int index, Ref<Spell> spell) {
|
||||
}
|
||||
|
||||
Vector<Variant> EntityClassData::get_spells() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _spells.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_spells[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_spells[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_spells);
|
||||
}
|
||||
void EntityClassData::set_spells(const Vector<Variant> &spells) {
|
||||
_spells.clear();
|
||||
@ -247,15 +223,7 @@ void EntityClassData::set_start_spell(int index, Ref<Spell> spell) {
|
||||
}
|
||||
|
||||
Vector<Variant> EntityClassData::get_start_spells() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _start_spells.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_start_spells[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_start_spells[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_start_spells);
|
||||
}
|
||||
void EntityClassData::set_start_spells(const Vector<Variant> &spells) {
|
||||
_start_spells.clear();
|
||||
@ -295,15 +263,7 @@ void EntityClassData::set_aura(int index, Ref<Aura> aura) {
|
||||
}
|
||||
|
||||
Vector<Variant> EntityClassData::get_auras() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _auras.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_auras[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_auras[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_auras);
|
||||
}
|
||||
void EntityClassData::set_auras(const Vector<Variant> &auras) {
|
||||
_auras.clear();
|
||||
@ -343,15 +303,7 @@ void EntityClassData::set_ai(int index, Ref<EntityAI> ai) {
|
||||
}
|
||||
|
||||
Vector<Variant> EntityClassData::get_ais() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _ais.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_ais[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_ais[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_ais);
|
||||
}
|
||||
void EntityClassData::set_ais(const Vector<Variant> &ais) {
|
||||
_ais.clear();
|
||||
@ -511,12 +463,7 @@ void EntityClassData::notification_sxp_gained(Entity *entity, int value) {
|
||||
call("_notification_sxp_gained", entity, value);
|
||||
}
|
||||
void EntityClassData::notification_sxp_gained_bind(Node *entity, int value) {
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -530,11 +477,7 @@ void EntityClassData::notification_sclass_level_up(Entity *entity, int value) {
|
||||
call("_notification_sclass_level_up", entity);
|
||||
}
|
||||
void EntityClassData::notification_sclass_level_up_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -548,11 +491,7 @@ void EntityClassData::notification_scharacter_level_up(Entity *entity, int value
|
||||
call("_notification_scharacter_level_up", entity);
|
||||
}
|
||||
void EntityClassData::notification_scharacter_level_up_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -671,11 +610,7 @@ void EntityClassData::notification_cxp_gained(Entity *entity, int value) {
|
||||
call("_notification_cxp_gained", entity, value);
|
||||
}
|
||||
void EntityClassData::notification_cxp_gained_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -689,11 +624,7 @@ void EntityClassData::notification_cclass_level_up(Entity *entity, int value) {
|
||||
call("_notification_cclass_level_up", entity);
|
||||
}
|
||||
void EntityClassData::notification_cclass_level_up_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -707,11 +638,7 @@ void EntityClassData::notification_ccharacter_level_up(Entity *entity, int value
|
||||
call("_notification_ccharacter_level_up", entity);
|
||||
}
|
||||
void EntityClassData::notification_ccharacter_level_up_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -740,11 +667,7 @@ bool EntityClassData::equip_should_deny(Entity *entity, int equip_slot, Ref<Item
|
||||
return false;
|
||||
}
|
||||
bool EntityClassData::equip_should_deny_bind(Node *entity, int equip_slot, Ref<ItemInstance> item) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(entity), false);
|
||||
#else
|
||||
ERR_FAIL_COND_V(entity == NULL, false);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -758,11 +681,7 @@ void EntityClassData::equip_son_success(Entity *entity, int equip_slot, Ref<Item
|
||||
call("_equip_son_success", entity, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
void EntityClassData::equip_son_success_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -776,11 +695,7 @@ void EntityClassData::equip_son_fail(Entity *entity, int equip_slot, Ref<ItemIns
|
||||
call("_equip_son_fail", entity, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
void EntityClassData::equip_son_fail_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -794,11 +709,7 @@ void EntityClassData::equip_con_success(Entity *entity, int equip_slot, Ref<Item
|
||||
call("_equip_con_success", entity, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
void EntityClassData::equip_con_success_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -812,11 +723,7 @@ void EntityClassData::equip_con_fail(Entity *entity, int equip_slot, Ref<ItemIns
|
||||
call("_equip_con_fail", entity, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
void EntityClassData::equip_con_fail_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE.
|
||||
#include "character_spec.h"
|
||||
#include "vendor_item_data.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
int EntityData::get_id() const {
|
||||
return _id;
|
||||
@ -232,15 +232,7 @@ void EntityData::set_craft_recipe(int index, const Ref<CraftRecipe> &craft_data)
|
||||
}
|
||||
|
||||
Vector<Variant> EntityData::get_craft_recipes() const {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _craft_recipes.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_craft_recipes[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_craft_recipes[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_craft_recipes);
|
||||
}
|
||||
void EntityData::set_craft_recipes(const Vector<Variant> &craft_datas) {
|
||||
_craft_recipes.clear();
|
||||
@ -291,11 +283,7 @@ String EntityData::generate_name() {
|
||||
//// SETUP ////
|
||||
|
||||
void EntityData::setup_resources(Entity *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->setup_resources(entity);
|
||||
@ -305,11 +293,7 @@ void EntityData::setup_resources(Entity *entity) {
|
||||
}
|
||||
|
||||
bool EntityData::cans_interact(Entity *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(entity), false);
|
||||
#else
|
||||
ERR_FAIL_COND_V(entity == NULL, false);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false);
|
||||
|
||||
if (has_method("_cans_interact"))
|
||||
return call("_cans_interact", entity);
|
||||
@ -318,11 +302,7 @@ bool EntityData::cans_interact(Entity *entity) {
|
||||
}
|
||||
|
||||
bool EntityData::cans_interact_bind(Node *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(entity), false);
|
||||
#else
|
||||
ERR_FAIL_COND_V(entity == NULL, false);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -332,22 +312,14 @@ bool EntityData::cans_interact_bind(Node *entity) {
|
||||
}
|
||||
|
||||
void EntityData::sinteract(Entity *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
if (has_method("_sinteract"))
|
||||
call("_sinteract", entity);
|
||||
}
|
||||
|
||||
void EntityData::sinteract_bind(Node *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -487,11 +459,7 @@ void EntityData::notification_sxp_gained(Entity *entity, int value) {
|
||||
call("_notification_sxp_gained", entity, value);
|
||||
}
|
||||
void EntityData::notification_sxp_gained_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -508,11 +476,7 @@ void EntityData::notification_sclass_level_up(Entity *entity, int value) {
|
||||
call("_notification_sclass_level_up", entity);
|
||||
}
|
||||
void EntityData::notification_sclass_level_up_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -529,11 +493,7 @@ void EntityData::notification_scharacter_level_up(Entity *entity, int value) {
|
||||
call("_notification_scharacter_level_up", entity);
|
||||
}
|
||||
void EntityData::notification_scharacter_level_up_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -695,11 +655,7 @@ void EntityData::notification_cxp_gained(Entity *entity, int value) {
|
||||
call("_notification_cxp_gained", entity, value);
|
||||
}
|
||||
void EntityData::notification_cxp_gained_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -716,11 +672,7 @@ void EntityData::notification_cclass_level_up(Entity *entity, int value) {
|
||||
call("_notification_cclass_level_up", entity);
|
||||
}
|
||||
void EntityData::notification_cclass_level_up_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -737,11 +689,7 @@ void EntityData::notification_ccharacter_level_up(Entity *entity, int value) {
|
||||
call("_notification_ccharacter_level_up", entity);
|
||||
}
|
||||
void EntityData::notification_ccharacter_level_up_bind(Node *entity, int value) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -782,11 +730,7 @@ bool EntityData::equip_should_deny(Entity *entity, int equip_slot, Ref<ItemInsta
|
||||
return false;
|
||||
}
|
||||
bool EntityData::equip_should_deny_bind(Node *entity, int equip_slot, Ref<ItemInstance> item) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(entity), false);
|
||||
#else
|
||||
ERR_FAIL_COND_V(entity == NULL, false);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -803,11 +747,7 @@ void EntityData::equip_son_success(Entity *entity, int equip_slot, Ref<ItemInsta
|
||||
call("_equip_son_success", entity, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
void EntityData::equip_son_success_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -824,11 +764,7 @@ void EntityData::equip_son_fail(Entity *entity, int equip_slot, Ref<ItemInstance
|
||||
call("_equip_son_fail", entity, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
void EntityData::equip_son_fail_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -845,11 +781,7 @@ void EntityData::equip_con_success(Entity *entity, int equip_slot, Ref<ItemInsta
|
||||
call("_equip_con_success", entity, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
void EntityData::equip_con_success_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
@ -866,11 +798,7 @@ void EntityData::equip_con_fail(Entity *entity, int equip_slot, Ref<ItemInstance
|
||||
call("_equip_con_fail", entity, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
void EntityData::equip_con_fail_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
|
@ -22,7 +22,7 @@ SOFTWARE.
|
||||
|
||||
#include "item_container_data.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
int ItemContainerData::get_num_container_datas() {
|
||||
return _container_datas.size();
|
||||
@ -43,15 +43,7 @@ void ItemContainerData::set_container_data(int index, Ref<ItemContainerDataEntry
|
||||
}
|
||||
|
||||
Vector<Variant> ItemContainerData::get_container_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _container_datas.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_container_datas[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_container_datas[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_container_datas);
|
||||
}
|
||||
void ItemContainerData::set_container_datas(const Vector<Variant> &container_datas) {
|
||||
_container_datas.clear();
|
||||
|
@ -22,7 +22,7 @@ SOFTWARE.
|
||||
|
||||
#include "vendor_item_data.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
int VendorItemData::get_num_vendor_datas() {
|
||||
return _vendor_datas.size();
|
||||
@ -40,15 +40,7 @@ void VendorItemData::set_vendor_data(int index, Ref<VendorItemDataEntry> vendor_
|
||||
}
|
||||
|
||||
Vector<Variant> VendorItemData::get_vendor_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _vendor_datas.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_vendor_datas[i].get_ref_ptr());
|
||||
#else
|
||||
r.push_back(_vendor_datas[i]);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
VARIANT_ARRAY_GET(_vendor_datas);
|
||||
}
|
||||
void VendorItemData::set_vendor_datas(const Vector<Variant> &vendor_datas) {
|
||||
_vendor_datas.clear();
|
||||
|
@ -45,6 +45,8 @@ SOFTWARE.
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
NodePath Entity::get_body_path() {
|
||||
return _body_path;
|
||||
}
|
||||
@ -53,13 +55,8 @@ void Entity::set_body_path(NodePath value) {
|
||||
|
||||
set_body(get_node_or_null(_body_path));
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(_body))
|
||||
if (INSTANCE_VALIDATE(_body))
|
||||
_body->set_owner(this);
|
||||
#else
|
||||
if (_body == NULL)
|
||||
_body->set_owner(this);
|
||||
#endif
|
||||
}
|
||||
Node *Entity::get_body() {
|
||||
return _body;
|
||||
@ -113,11 +110,7 @@ void Entity::setc_guid(int value) {
|
||||
//Transforms
|
||||
Transform Entity::get_transform_3d(bool only_stored) const {
|
||||
if (!only_stored && _body_3d) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(_body_3d), _transform);
|
||||
#else
|
||||
ERR_FAIL_COND_V(!_body_3d, _transform);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(_body_3d), _transform);
|
||||
|
||||
return _body_3d->get_transform();
|
||||
}
|
||||
@ -126,11 +119,7 @@ Transform Entity::get_transform_3d(bool only_stored) const {
|
||||
}
|
||||
void Entity::set_transform_3d(const Transform &transform, bool only_stored) {
|
||||
if (!only_stored && _body_3d) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(_body_3d));
|
||||
#else
|
||||
ERR_FAIL_COND(!_body_3d);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(_body_3d));
|
||||
|
||||
return _body_3d->set_transform(transform);
|
||||
}
|
||||
@ -140,11 +129,7 @@ void Entity::set_transform_3d(const Transform &transform, bool only_stored) {
|
||||
|
||||
Transform2D Entity::get_transform_2d(bool only_stored) const {
|
||||
if (!only_stored && _body_2d) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(_body_2d), _transform_2d);
|
||||
#else
|
||||
ERR_FAIL_COND_V(!_body_2d, _transform_2d);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(_body_2d), _transform_2d);
|
||||
|
||||
return _body_2d->get_transform();
|
||||
}
|
||||
@ -153,11 +138,7 @@ Transform2D Entity::get_transform_2d(bool only_stored) const {
|
||||
}
|
||||
void Entity::set_transform_2d(const Transform2D &transform, bool only_stored) {
|
||||
if (!only_stored && _body_2d) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(_body_2d));
|
||||
#else
|
||||
ERR_FAIL_COND(!_body_2d);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(_body_2d));
|
||||
|
||||
return _body_2d->set_transform(_transform_2d);
|
||||
}
|
||||
@ -203,20 +184,12 @@ void Entity::setc_entity_type(int value) {
|
||||
EntityEnums::EntityRelationType Entity::gets_relation_to_bind(Node *to) {
|
||||
Entity *e = Object::cast_to<Entity>(to);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(e), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
#else
|
||||
ERR_FAIL_COND_V(e == NULL, EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(e), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
|
||||
return gets_relation_to(e);
|
||||
}
|
||||
EntityEnums::EntityRelationType Entity::gets_relation_to(Entity *to) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(to), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
#else
|
||||
ERR_FAIL_COND_V(to == NULL, EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(to), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
|
||||
return static_cast<EntityEnums::EntityRelationType>(static_cast<int>(call("_gets_relation_to", to)));
|
||||
}
|
||||
@ -231,20 +204,12 @@ EntityEnums::EntityRelationType Entity::_gets_relation_to(Node *to) {
|
||||
EntityEnums::EntityRelationType Entity::getc_relation_to_bind(Node *to) {
|
||||
Entity *e = Object::cast_to<Entity>(to);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(e), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
#else
|
||||
ERR_FAIL_COND_V(e == NULL, EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(e), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
|
||||
return getc_relation_to(e);
|
||||
}
|
||||
EntityEnums::EntityRelationType Entity::getc_relation_to(Entity *to) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(to), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
#else
|
||||
ERR_FAIL_COND_V(to == NULL, EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(to), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL);
|
||||
|
||||
return static_cast<EntityEnums::EntityRelationType>(static_cast<int>(call("_getc_relation_to", to)));
|
||||
}
|
||||
@ -331,12 +296,7 @@ int Entity::getc_model_index() {
|
||||
void Entity::setc_model_index(int value) {
|
||||
_c_model_index = value;
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(_character_skeleton)) {
|
||||
#else
|
||||
if (_character_skeleton != NULL) {
|
||||
#endif
|
||||
|
||||
if (INSTANCE_VALIDATE(_character_skeleton)) {
|
||||
if (_character_skeleton->has_method("set_model_index"))
|
||||
_character_skeleton->call("set_model_index", _c_model_index);
|
||||
}
|
||||
@ -898,11 +858,7 @@ void Entity::sets_ai(Ref<EntityAI> value) {
|
||||
//// Pets ////
|
||||
|
||||
void Entity::pet_adds(Entity *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
//the owner always want to see his pet, and you pet will always want to see the owner
|
||||
sees_adds(entity);
|
||||
@ -944,20 +900,12 @@ void Entity::pet_removes_index(int index) {
|
||||
for (int i = 0; i < _s_pets.size(); ++i) {
|
||||
Entity *pet = _s_pets.get(index);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_CONTINUE(!ObjectDB::instance_validate(pet));
|
||||
#else
|
||||
ERR_CONTINUE(pet == NULL);
|
||||
#endif
|
||||
ERR_CONTINUE(!INSTANCE_VALIDATE(pet));
|
||||
|
||||
_s_pets.get(i)->pet_sets_formation_index(i);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
entity->pet_sets_owner(NULL);
|
||||
|
||||
@ -990,21 +938,13 @@ void Entity::pet_addc_path(NodePath path) {
|
||||
|
||||
Entity *entity = Object::cast_to<Entity>(n);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
pet_addc(entity);
|
||||
}
|
||||
|
||||
void Entity::pet_addc(Entity *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
_c_pets.push_back(entity);
|
||||
|
||||
@ -2284,12 +2224,7 @@ void Entity::_equip_applyc_item(Ref<ItemInstance> item) {
|
||||
|
||||
ERR_FAIL_COND(!it.is_valid());
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (it->get_model_visual().is_valid() && ObjectDB::instance_validate(_character_skeleton)) {
|
||||
#else
|
||||
if (it->get_model_visual().is_valid() && _character_skeleton == NULL) {
|
||||
#endif
|
||||
|
||||
if (it->get_model_visual().is_valid() && INSTANCE_VALIDATE(_character_skeleton)) {
|
||||
if (_character_skeleton->has_method("add_model_visual"))
|
||||
_character_skeleton->call("add_model_visual", it->get_model_visual());
|
||||
}
|
||||
@ -2301,12 +2236,7 @@ void Entity::_equip_deapplyc_item(Ref<ItemInstance> item) {
|
||||
|
||||
ERR_FAIL_COND(!it.is_valid());
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (it->get_model_visual().is_valid() && ObjectDB::instance_validate(_character_skeleton)) {
|
||||
#else
|
||||
if (it->get_model_visual().is_valid() && _character_skeleton == NULL) {
|
||||
#endif
|
||||
|
||||
if (it->get_model_visual().is_valid() && INSTANCE_VALIDATE(_character_skeleton)) {
|
||||
if (_character_skeleton->has_method("remove_model_visual"))
|
||||
_character_skeleton->call("remove_model_visual", it->get_model_visual());
|
||||
}
|
||||
@ -2707,12 +2637,7 @@ bool Entity::canc_interact() {
|
||||
return call("_canc_interact");
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (!ObjectDB::instance_validate(_c_target)) {
|
||||
#else
|
||||
if (_c_target == NULL) {
|
||||
#endif
|
||||
|
||||
if (!INSTANCE_VALIDATE(_c_target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3541,12 +3466,7 @@ Ref<AuraData> Entity::aura_gets_with_group_by(Entity *caster, Ref<AuraGroup> aur
|
||||
return Ref<AuraData>();
|
||||
}
|
||||
Ref<AuraData> Entity::aura_gets_with_group_by_bind(Node *caster, Ref<AuraGroup> aura_group) {
|
||||
#if VERSION_MAJOR < 4
|
||||
if (!ObjectDB::instance_validate(caster)) {
|
||||
#else
|
||||
if (caster == NULL) {
|
||||
#endif
|
||||
|
||||
if (!INSTANCE_VALIDATE(caster)) {
|
||||
return Ref<AuraData>();
|
||||
}
|
||||
|
||||
@ -3951,17 +3871,17 @@ void Entity::cast_spell_successc(Ref<SpellCastInfo> info) {
|
||||
}
|
||||
|
||||
//// Cooldowns ////
|
||||
Vector<Ref<Cooldown> > *Entity::cooldowns_gets() {
|
||||
Vector<Ref<Cooldown>> *Entity::cooldowns_gets() {
|
||||
return &_s_cooldowns;
|
||||
}
|
||||
Vector<Ref<Cooldown> > *Entity::cooldowns_getc() {
|
||||
Vector<Ref<Cooldown>> *Entity::cooldowns_getc() {
|
||||
return &_c_cooldowns;
|
||||
}
|
||||
|
||||
HashMap<int, Ref<Cooldown> > *Entity::cooldown_get_maps() {
|
||||
HashMap<int, Ref<Cooldown>> *Entity::cooldown_get_maps() {
|
||||
return &_s_cooldown_map;
|
||||
}
|
||||
HashMap<int, Ref<Cooldown> > *Entity::cooldown_get_mapc() {
|
||||
HashMap<int, Ref<Cooldown>> *Entity::cooldown_get_mapc() {
|
||||
return &_c_cooldown_map;
|
||||
}
|
||||
|
||||
@ -4105,10 +4025,10 @@ int Entity::cooldown_getc_count() {
|
||||
}
|
||||
|
||||
//Category Cooldowns
|
||||
Vector<Ref<CategoryCooldown> > Entity::category_cooldowns_gets() {
|
||||
Vector<Ref<CategoryCooldown>> Entity::category_cooldowns_gets() {
|
||||
return _s_category_cooldowns;
|
||||
}
|
||||
Vector<Ref<CategoryCooldown> > Entity::category_cooldowns_getc() {
|
||||
Vector<Ref<CategoryCooldown>> Entity::category_cooldowns_getc() {
|
||||
return _c_category_cooldowns;
|
||||
}
|
||||
|
||||
@ -4485,13 +4405,8 @@ void Entity::skill_adds(Ref<EntitySkill> skill) {
|
||||
if (skill_hass(skill))
|
||||
return;
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
skill->connect("current_changed", this, "skill_scurrent_changed");
|
||||
skill->connect("max_changed", this, "skill_smax_changed");
|
||||
#else
|
||||
skill->connect("current_changed", callable_mp(this, &Entity::skill_scurrent_changed));
|
||||
skill->connect("max_changed", callable_mp(this, &Entity::skill_smax_changed));
|
||||
#endif
|
||||
skill->CONNECT("current_changed", this, Entity, skill_scurrent_changed);
|
||||
skill->CONNECT("max_changed", this, Entity, skill_smax_changed);
|
||||
|
||||
_s_skills.push_back(skill);
|
||||
|
||||
@ -4716,12 +4631,7 @@ Entity *Entity::gets_target() {
|
||||
void Entity::sets_target(Node *p_target) {
|
||||
Entity *original_target = _s_target;
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (!ObjectDB::instance_validate(original_target)) {
|
||||
#else
|
||||
if (original_target == NULL) {
|
||||
#endif
|
||||
|
||||
if (!INSTANCE_VALIDATE(original_target)) {
|
||||
original_target = NULL;
|
||||
_s_target = NULL;
|
||||
}
|
||||
@ -4771,12 +4681,7 @@ Entity *Entity::getc_target() {
|
||||
void Entity::setc_target(Node *p_target) {
|
||||
Entity *original_target = _c_target;
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (!ObjectDB::instance_validate(original_target)) {
|
||||
#else
|
||||
if (original_target == NULL) {
|
||||
#endif
|
||||
|
||||
if (!INSTANCE_VALIDATE(original_target)) {
|
||||
original_target = NULL;
|
||||
_c_target = NULL;
|
||||
}
|
||||
@ -5046,41 +4951,23 @@ Ref<Bag> Entity::gets_bag() const {
|
||||
}
|
||||
void Entity::sets_bag(const Ref<Bag> bag) {
|
||||
if (_s_bag.is_valid()) {
|
||||
#if VERSION_MAJOR < 4
|
||||
_s_bag->disconnect("item_added", this, "notification_item_sadded");
|
||||
_s_bag->disconnect("item_removed", this, "notification_item_sremoved");
|
||||
_s_bag->disconnect("item_swapped", this, "notification_items_sswapped");
|
||||
_s_bag->disconnect("item_count_changed", this, "notification_item_sscount_changed");
|
||||
_s_bag->disconnect("overburdened", this, "notification_soverburdened");
|
||||
_s_bag->disconnect("overburden_removed", this, "notification_soverburden_removed");
|
||||
#else
|
||||
_s_bag->disconnect("item_added", callable_mp(this, &Entity::notification_item_sadded));
|
||||
_s_bag->disconnect("item_removed", callable_mp(this, &Entity::notification_item_sremoved));
|
||||
_s_bag->disconnect("item_swapped", callable_mp(this, &Entity::notification_items_sswapped));
|
||||
_s_bag->disconnect("item_count_changed", callable_mp(this, &Entity::notification_item_sscount_changed));
|
||||
_s_bag->disconnect("overburdened", callable_mp(this, &Entity::notification_soverburdened));
|
||||
_s_bag->disconnect("overburden_removed", callable_mp(this, &Entity::notification_soverburden_removed));
|
||||
#endif
|
||||
_s_bag->DISCONNECT("item_added", this, Entity, notification_item_sadded);
|
||||
_s_bag->DISCONNECT("item_removed", this, Entity, notification_item_sremoved);
|
||||
_s_bag->DISCONNECT("item_swapped", this, Entity, notification_items_sswapped);
|
||||
_s_bag->DISCONNECT("item_count_changed", this, Entity, notification_item_sscount_changed);
|
||||
_s_bag->DISCONNECT("overburdened", this, Entity, notification_soverburdened);
|
||||
_s_bag->DISCONNECT("overburden_removed", this, Entity, notification_soverburden_removed);
|
||||
}
|
||||
|
||||
_s_bag = bag;
|
||||
|
||||
if (_s_bag.is_valid()) {
|
||||
#if VERSION_MAJOR < 4
|
||||
_s_bag->connect("item_added", this, "notification_item_sadded");
|
||||
_s_bag->connect("item_removed", this, "notification_item_sremoved");
|
||||
_s_bag->connect("item_swapped", this, "notification_items_sswapped");
|
||||
_s_bag->connect("item_count_changed", this, "notification_item_sscount_changed");
|
||||
_s_bag->connect("overburdened", this, "notification_soverburdened");
|
||||
_s_bag->connect("overburden_removed", this, "notification_soverburden_removed");
|
||||
#else
|
||||
_s_bag->connect("item_added", callable_mp(this, &Entity::notification_item_sadded));
|
||||
_s_bag->connect("item_removed", callable_mp(this, &Entity::notification_item_sremoved));
|
||||
_s_bag->connect("item_swapped", callable_mp(this, &Entity::notification_items_sswapped));
|
||||
_s_bag->connect("item_count_changed", callable_mp(this, &Entity::notification_item_sscount_changed));
|
||||
_s_bag->connect("overburdened", callable_mp(this, &Entity::notification_soverburdened));
|
||||
_s_bag->connect("overburden_removed", callable_mp(this, &Entity::notification_soverburden_removed));
|
||||
#endif
|
||||
_s_bag->CONNECT("item_added", this, Entity, notification_item_sadded);
|
||||
_s_bag->CONNECT("item_removed", this, Entity, notification_item_sremoved);
|
||||
_s_bag->CONNECT("item_swapped", this, Entity, notification_items_sswapped);
|
||||
_s_bag->CONNECT("item_count_changed", this, Entity, notification_item_sscount_changed);
|
||||
_s_bag->CONNECT("overburdened", this, Entity, notification_soverburdened);
|
||||
_s_bag->CONNECT("overburden_removed", this, Entity, notification_soverburden_removed);
|
||||
}
|
||||
|
||||
emit_signal("sbag_changed", this, _s_bag);
|
||||
@ -5106,33 +4993,19 @@ Ref<Bag> Entity::gets_target_bag() const {
|
||||
}
|
||||
void Entity::sets_target_bag(const Ref<Bag> bag) {
|
||||
if (_s_target_bag.is_valid()) {
|
||||
#if VERSION_MAJOR < 4
|
||||
_s_target_bag->disconnect("item_added", this, "notification_target_item_sadded");
|
||||
_s_target_bag->disconnect("item_removed", this, "notification_target_item_sremoved");
|
||||
_s_target_bag->disconnect("item_swapped", this, "notification_target_items_sswapped");
|
||||
_s_target_bag->disconnect("item_count_changed", this, "notification_target_item_sscount_changed");
|
||||
#else
|
||||
_s_target_bag->disconnect("item_added", callable_mp(this, &Entity::notification_target_item_sadded));
|
||||
_s_target_bag->disconnect("item_removed", callable_mp(this, &Entity::notification_target_item_sremoved));
|
||||
_s_target_bag->disconnect("item_swapped", callable_mp(this, &Entity::notification_target_items_sswapped));
|
||||
_s_target_bag->disconnect("item_count_changed", callable_mp(this, &Entity::notification_target_item_sscount_changed));
|
||||
#endif
|
||||
_s_target_bag->DISCONNECT("item_added", this, Entity, notification_target_item_sadded);
|
||||
_s_target_bag->DISCONNECT("item_removed", this, Entity, notification_target_item_sremoved);
|
||||
_s_target_bag->DISCONNECT("item_swapped", this, Entity, notification_target_items_sswapped);
|
||||
_s_target_bag->DISCONNECT("item_count_changed", this, Entity, notification_target_item_sscount_changed);
|
||||
}
|
||||
|
||||
_s_target_bag = bag;
|
||||
|
||||
if (_s_target_bag.is_valid()) {
|
||||
#if VERSION_MAJOR < 4
|
||||
_s_target_bag->connect("item_added", this, "notification_target_item_sadded");
|
||||
_s_target_bag->connect("item_removed", this, "notification_target_item_sremoved");
|
||||
_s_target_bag->connect("item_swapped", this, "notification_target_items_sswapped");
|
||||
_s_target_bag->connect("item_count_changed", this, "notification_target_item_sscount_changed");
|
||||
#else
|
||||
_s_target_bag->connect("item_added", callable_mp(this, &Entity::notification_target_item_sadded));
|
||||
_s_target_bag->connect("item_removed", callable_mp(this, &Entity::notification_target_item_sremoved));
|
||||
_s_target_bag->connect("item_swapped", callable_mp(this, &Entity::notification_target_items_sswapped));
|
||||
_s_target_bag->connect("item_count_changed", callable_mp(this, &Entity::notification_target_item_sscount_changed));
|
||||
#endif
|
||||
_s_target_bag->CONNECT("item_added", this, Entity, notification_target_item_sadded);
|
||||
_s_target_bag->CONNECT("item_removed", this, Entity, notification_target_item_sremoved);
|
||||
_s_target_bag->CONNECT("item_swapped", this, Entity, notification_target_items_sswapped);
|
||||
_s_target_bag->CONNECT("item_count_changed", this, Entity, notification_target_item_sscount_changed);
|
||||
}
|
||||
|
||||
emit_signal("starget_bag_changed", this, _s_target_bag);
|
||||
@ -5523,12 +5396,7 @@ Entity *Entity::sees_gets(int index) {
|
||||
void Entity::sees_removes_index(int index) {
|
||||
Entity *e = _s_sees.get(index);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (unlikely(!ObjectDB::instance_validate(e))) {
|
||||
#else
|
||||
if (e == NULL) {
|
||||
#endif
|
||||
|
||||
if (unlikely(!INSTANCE_VALIDATE(e))) {
|
||||
_s_sees.remove(index);
|
||||
return;
|
||||
}
|
||||
@ -5538,12 +5406,7 @@ void Entity::sees_removes_index(int index) {
|
||||
_s_sees.remove(index);
|
||||
}
|
||||
void Entity::sees_removes(Entity *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
if (unlikely(!ObjectDB::instance_validate(entity))) {
|
||||
#else
|
||||
if (entity == NULL) {
|
||||
#endif
|
||||
|
||||
if (unlikely(!INSTANCE_VALIDATE(entity))) {
|
||||
_s_sees.erase(entity);
|
||||
return;
|
||||
}
|
||||
@ -5560,11 +5423,7 @@ void Entity::sees_removes_bind(Node *entity) {
|
||||
sees_removes(e);
|
||||
}
|
||||
void Entity::sees_adds(Entity *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
entity->seen_by_adds(this);
|
||||
|
||||
@ -5605,11 +5464,7 @@ void Entity::seen_by_removes_bind(Node *entity) {
|
||||
seen_by_removes(e);
|
||||
}
|
||||
void Entity::seen_by_adds(Entity *entity) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
|
||||
#else
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
for (int i = 0; i < _s_seen_by.size(); ++i) {
|
||||
if (_s_seen_by.get(i) == entity)
|
||||
@ -5643,12 +5498,7 @@ void Entity::vrpc(const StringName &p_method, VARIANT_ARG_DECLARE) {
|
||||
for (int i = 0; i < _s_seen_by.size(); ++i) {
|
||||
Entity *e = _s_seen_by.get(i);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (unlikely(!ObjectDB::instance_validate(e))) {
|
||||
#else
|
||||
if (e == NULL) {
|
||||
#endif
|
||||
|
||||
if (unlikely(!INSTANCE_VALIDATE(e))) {
|
||||
_s_seen_by.remove(i);
|
||||
--i;
|
||||
continue;
|
||||
@ -6206,18 +6056,10 @@ void Entity::_con_target_changed(Node *p_entity, Node *p_old_target) {
|
||||
//Entity *entity = Object::cast_to<Entity>(p_entity);
|
||||
Entity *old_target = Object::cast_to<Entity>(p_old_target);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(old_target))
|
||||
if (INSTANCE_VALIDATE(old_target))
|
||||
old_target->notification_cuntargeted();
|
||||
|
||||
if (ObjectDB::instance_validate(getc_target())) {
|
||||
#else
|
||||
if (old_target != NULL)
|
||||
old_target->notification_cuntargeted();
|
||||
|
||||
if (getc_target() != NULL) {
|
||||
#endif
|
||||
|
||||
if (INSTANCE_VALIDATE(getc_target())) {
|
||||
getc_target()->notification_ctargeted();
|
||||
|
||||
if (canc_interact())
|
||||
@ -6307,13 +6149,8 @@ void Entity::_notification(int p_what) {
|
||||
case NOTIFICATION_INSTANCED: {
|
||||
set_body(get_node_or_null(_body_path));
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(_body))
|
||||
if (INSTANCE_VALIDATE(_body))
|
||||
_body->set_owner(this);
|
||||
#else
|
||||
if (_body != NULL)
|
||||
_body->set_owner(this);
|
||||
#endif
|
||||
|
||||
_character_skeleton = get_node_or_null(_character_skeleton_path);
|
||||
|
||||
@ -6329,13 +6166,8 @@ void Entity::_notification(int p_what) {
|
||||
if (!_body) {
|
||||
set_body(get_node_or_null(_body_path));
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(_body))
|
||||
if (INSTANCE_VALIDATE(_body))
|
||||
_body->set_owner(this);
|
||||
#else
|
||||
if (_body != NULL)
|
||||
_body->set_owner(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!_character_skeleton) {
|
||||
@ -6358,13 +6190,8 @@ void Entity::_notification(int p_what) {
|
||||
for (int i = 0; i < _s_seen_by.size(); ++i) {
|
||||
Entity *e = _s_seen_by.get(i);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(e))
|
||||
if (INSTANCE_VALIDATE(e))
|
||||
e->sees_removes(this);
|
||||
#else
|
||||
if (e != NULL)
|
||||
e->sees_removes(this);
|
||||
#endif
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
@ -60,12 +60,9 @@ SOFTWARE.
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#include "scene/3d/spatial.h"
|
||||
#else
|
||||
#include "scene/3d/node_3d.h"
|
||||
#define Spatial Node3D
|
||||
#endif
|
||||
#include "../defines.h"
|
||||
|
||||
#include spatial_h_path
|
||||
|
||||
class EntityData;
|
||||
class AuraData;
|
||||
@ -702,11 +699,11 @@ public:
|
||||
|
||||
//// Cooldowns ////
|
||||
|
||||
Vector<Ref<Cooldown> > *cooldowns_gets();
|
||||
Vector<Ref<Cooldown> > *cooldowns_getc();
|
||||
Vector<Ref<Cooldown>> *cooldowns_gets();
|
||||
Vector<Ref<Cooldown>> *cooldowns_getc();
|
||||
|
||||
HashMap<int, Ref<Cooldown> > *cooldown_get_maps();
|
||||
HashMap<int, Ref<Cooldown> > *cooldown_get_mapc();
|
||||
HashMap<int, Ref<Cooldown>> *cooldown_get_maps();
|
||||
HashMap<int, Ref<Cooldown>> *cooldown_get_mapc();
|
||||
|
||||
bool cooldown_hass(int spell_id);
|
||||
void cooldown_adds(int spell_id, float value);
|
||||
@ -724,8 +721,8 @@ public:
|
||||
|
||||
//Category Cooldowns
|
||||
|
||||
Vector<Ref<CategoryCooldown> > category_cooldowns_gets();
|
||||
Vector<Ref<CategoryCooldown> > category_cooldowns_getc();
|
||||
Vector<Ref<CategoryCooldown>> category_cooldowns_gets();
|
||||
Vector<Ref<CategoryCooldown>> category_cooldowns_getc();
|
||||
|
||||
bool category_cooldown_hass(int category_id);
|
||||
void category_cooldown_adds(int category_id, float value);
|
||||
@ -1129,13 +1126,13 @@ private:
|
||||
|
||||
//// Equipment ////
|
||||
|
||||
Vector<Ref<ItemInstance> > _s_equipment;
|
||||
Vector<Ref<ItemInstance> > _c_equipment;
|
||||
Vector<Ref<ItemInstance>> _s_equipment;
|
||||
Vector<Ref<ItemInstance>> _c_equipment;
|
||||
|
||||
//// Resources ////
|
||||
|
||||
Vector<Ref<EntityResource> > _s_resources;
|
||||
Vector<Ref<EntityResource> > _c_resources;
|
||||
Vector<Ref<EntityResource>> _s_resources;
|
||||
Vector<Ref<EntityResource>> _c_resources;
|
||||
|
||||
//// GCD ////
|
||||
|
||||
@ -1156,8 +1153,8 @@ private:
|
||||
|
||||
//// AuraComponent ////
|
||||
|
||||
Vector<Ref<AuraData> > _s_auras;
|
||||
Vector<Ref<AuraData> > _c_auras;
|
||||
Vector<Ref<AuraData>> _s_auras;
|
||||
Vector<Ref<AuraData>> _c_auras;
|
||||
|
||||
int _s_entity_type;
|
||||
int _c_entity_type;
|
||||
@ -1168,14 +1165,14 @@ private:
|
||||
int _c_entity_flags;
|
||||
|
||||
//// Cooldowns ////
|
||||
Vector<Ref<Cooldown> > _s_cooldowns;
|
||||
Vector<Ref<Cooldown> > _c_cooldowns;
|
||||
Vector<Ref<Cooldown>> _s_cooldowns;
|
||||
Vector<Ref<Cooldown>> _c_cooldowns;
|
||||
|
||||
HashMap<int, Ref<Cooldown> > _s_cooldown_map;
|
||||
HashMap<int, Ref<Cooldown> > _c_cooldown_map;
|
||||
HashMap<int, Ref<Cooldown>> _s_cooldown_map;
|
||||
HashMap<int, Ref<Cooldown>> _c_cooldown_map;
|
||||
|
||||
Vector<Ref<CategoryCooldown> > _s_category_cooldowns;
|
||||
Vector<Ref<CategoryCooldown> > _c_category_cooldowns;
|
||||
Vector<Ref<CategoryCooldown>> _s_category_cooldowns;
|
||||
Vector<Ref<CategoryCooldown>> _c_category_cooldowns;
|
||||
|
||||
int _s_active_category_cooldowns;
|
||||
int _c_active_category_cooldowns;
|
||||
@ -1195,8 +1192,8 @@ private:
|
||||
|
||||
//// Data ////
|
||||
|
||||
Vector<Ref<EntityDataContainer> > _s_data;
|
||||
Vector<Ref<EntityDataContainer> > _c_data;
|
||||
Vector<Ref<EntityDataContainer>> _s_data;
|
||||
Vector<Ref<EntityDataContainer>> _c_data;
|
||||
|
||||
//// Actionbars ////
|
||||
|
||||
@ -1205,21 +1202,21 @@ private:
|
||||
|
||||
//// Crafting System ////
|
||||
|
||||
Vector<Ref<CraftRecipe> > _s_craft_recipes;
|
||||
Vector<Ref<CraftRecipe> > _c_craft_recipes;
|
||||
Vector<Ref<CraftRecipe>> _s_craft_recipes;
|
||||
Vector<Ref<CraftRecipe>> _c_craft_recipes;
|
||||
|
||||
//// Known Spells ////
|
||||
|
||||
int _s_free_spell_points;
|
||||
int _c_free_spell_points;
|
||||
|
||||
Vector<Ref<Spell> > _s_spells;
|
||||
Vector<Ref<Spell> > _c_spells;
|
||||
Vector<Ref<Spell>> _s_spells;
|
||||
Vector<Ref<Spell>> _c_spells;
|
||||
|
||||
//// Skills ////
|
||||
|
||||
Vector<Ref<EntitySkill> > _s_skills;
|
||||
Vector<Ref<EntitySkill> > _c_skills;
|
||||
Vector<Ref<EntitySkill>> _s_skills;
|
||||
Vector<Ref<EntitySkill>> _c_skills;
|
||||
|
||||
//// Stat Allocations ////
|
||||
|
||||
@ -1263,7 +1260,7 @@ private:
|
||||
|
||||
// Callbacks
|
||||
|
||||
Vector<Ref<SpellCastInfo> > _physics_process_scis;
|
||||
Vector<Ref<SpellCastInfo>> _physics_process_scis;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -28,12 +28,6 @@ SOFTWARE.
|
||||
|
||||
#include "level_stat_data.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define REAL FLOAT
|
||||
#endif
|
||||
|
||||
class StatData : public Resource {
|
||||
GDCLASS(StatData, Resource);
|
||||
|
||||
|
@ -24,7 +24,7 @@ SOFTWARE.
|
||||
|
||||
#include "../entities/entity.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../defines.h"
|
||||
|
||||
void AIFormation::set_owner(Entity *entity) {
|
||||
_owner = entity;
|
||||
@ -62,11 +62,7 @@ String AIFormation::get_editor_description() const {
|
||||
}
|
||||
|
||||
Vector3 AIFormation::get_position(int slot_index) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(_owner), Vector3());
|
||||
#else
|
||||
ERR_FAIL_COND_V(_owner == NULL, Vector3());
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(_owner), Vector3());
|
||||
|
||||
if (has_method("_get_position"))
|
||||
return call("_get_position", slot_index);
|
||||
|
@ -29,16 +29,14 @@ SOFTWARE.
|
||||
#include "../entities/entity.h"
|
||||
#include "../singletons/ess.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../defines.h"
|
||||
|
||||
//// SpellCastInfo ////
|
||||
|
||||
Entity *SpellCastInfo::get_caster() {
|
||||
#if VERSION_MAJOR < 4
|
||||
if (_caster && !ObjectDB::instance_validate(_caster)) {
|
||||
if (_caster && !INSTANCE_VALIDATE(_caster)) {
|
||||
_caster = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return _caster;
|
||||
}
|
||||
@ -60,11 +58,9 @@ void SpellCastInfo::set_caster_bind(Node *caster) {
|
||||
}
|
||||
|
||||
Entity *SpellCastInfo::get_target() {
|
||||
#if VERSION_MAJOR < 4
|
||||
if (_target && !ObjectDB::instance_validate(_target)) {
|
||||
if (_target && !INSTANCE_VALIDATE(_target)) {
|
||||
_target = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return _target;
|
||||
}
|
||||
@ -167,11 +163,7 @@ void SpellCastInfo::physics_process(float delta) {
|
||||
}
|
||||
|
||||
void SpellCastInfo::resolve_references(Node *owner) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(owner));
|
||||
#else
|
||||
ERR_FAIL_COND(owner == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(owner));
|
||||
|
||||
ERR_FAIL_COND(!owner->is_inside_tree());
|
||||
|
||||
@ -191,19 +183,11 @@ void SpellCastInfo::resolve_references(Node *owner) {
|
||||
Dictionary SpellCastInfo::to_dict() {
|
||||
Dictionary dict;
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(_caster))
|
||||
if (INSTANCE_VALIDATE(_caster))
|
||||
dict["caster"] = _caster->get_path();
|
||||
|
||||
if (ObjectDB::instance_validate(_target))
|
||||
if (INSTANCE_VALIDATE(_target))
|
||||
dict["target"] = _target->get_path();
|
||||
#else
|
||||
if (_caster == NULL)
|
||||
dict["caster"] = _caster->get_path();
|
||||
|
||||
if (_target == NULL)
|
||||
dict["target"] = _target->get_path();
|
||||
#endif
|
||||
|
||||
dict["has_cast_time"] = _has_cast_time;
|
||||
dict["cast_time"] = _cast_time;
|
||||
|
@ -28,7 +28,7 @@ SOFTWARE.
|
||||
#include "../entities/entity.h"
|
||||
#include "../singletons/ess.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../defines.h"
|
||||
|
||||
bool SpellDamageInfo::get_immune() {
|
||||
return _crit;
|
||||
@ -165,11 +165,7 @@ void SpellDamageInfo::reset() {
|
||||
}
|
||||
|
||||
void SpellDamageInfo::resolve_references(Node *owner) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(owner));
|
||||
#else
|
||||
ERR_FAIL_COND(owner == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(owner));
|
||||
ERR_FAIL_COND(!owner->is_inside_tree());
|
||||
|
||||
_dealer = Object::cast_to<Entity>(owner->get_node_or_null(_dealer_path));
|
||||
@ -185,19 +181,11 @@ void SpellDamageInfo::resolve_references(Node *owner) {
|
||||
Dictionary SpellDamageInfo::to_dict() {
|
||||
Dictionary dict;
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(_dealer))
|
||||
if (INSTANCE_VALIDATE(_dealer))
|
||||
dict["dealer_path"] = _dealer->get_path();
|
||||
|
||||
if (ObjectDB::instance_validate(_receiver))
|
||||
if (INSTANCE_VALIDATE(_receiver))
|
||||
dict["receiver_path"] = _receiver->get_path();
|
||||
#else
|
||||
if (_dealer != NULL)
|
||||
dict["dealer_path"] = _dealer->get_path();
|
||||
|
||||
if (_receiver != NULL)
|
||||
dict["receiver_path"] = _receiver->get_path();
|
||||
#endif
|
||||
|
||||
dict["immune"] = _immune;
|
||||
dict["damage"] = _damage;
|
||||
|
@ -28,7 +28,7 @@ SOFTWARE.
|
||||
#include "../entities/entity.h"
|
||||
#include "../singletons/ess.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../defines.h"
|
||||
|
||||
bool SpellHealInfo::get_immune() {
|
||||
return _immune;
|
||||
@ -161,11 +161,7 @@ void SpellHealInfo::reset() {
|
||||
}
|
||||
|
||||
void SpellHealInfo::resolve_references(Node *owner) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(owner));
|
||||
#else
|
||||
ERR_FAIL_COND(owner == NULL);
|
||||
#endif
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(owner));
|
||||
ERR_FAIL_COND(!owner->is_inside_tree());
|
||||
|
||||
_dealer = Object::cast_to<Entity>(owner->get_node_or_null(_dealer_path));
|
||||
@ -181,19 +177,11 @@ void SpellHealInfo::resolve_references(Node *owner) {
|
||||
Dictionary SpellHealInfo::to_dict() {
|
||||
Dictionary dict;
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
if (ObjectDB::instance_validate(_dealer))
|
||||
if (INSTANCE_VALIDATE(_dealer))
|
||||
dict["dealer_path"] = _dealer->get_path();
|
||||
|
||||
if (ObjectDB::instance_validate(_receiver))
|
||||
if (INSTANCE_VALIDATE(_receiver))
|
||||
dict["receiver_path"] = _receiver->get_path();
|
||||
#else
|
||||
if (_dealer == NULL)
|
||||
dict["dealer_path"] = _dealer->get_path();
|
||||
|
||||
if (_receiver == NULL)
|
||||
dict["receiver_path"] = _receiver->get_path();
|
||||
#endif
|
||||
|
||||
dict["immune"] = _immune;
|
||||
dict["heal"] = _heal;
|
||||
|
@ -24,11 +24,7 @@ SOFTWARE.
|
||||
|
||||
#include "action_bar_profile.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define REAL FLOAT
|
||||
#endif
|
||||
#include "../../defines.h"
|
||||
|
||||
Ref<ActionBarProfile> ActionBarEntry::get_owner() {
|
||||
return Ref<ActionBarProfile>(_owner);
|
||||
|
@ -22,7 +22,7 @@ SOFTWARE.
|
||||
|
||||
#include "player_profile.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../defines.h"
|
||||
|
||||
const String PlayerProfile::DEFAULT_PROFILE_FILE_NAME = "default.profile";
|
||||
|
||||
@ -61,11 +61,7 @@ Ref<ClassProfile> PlayerProfile::get_class_profile_index(const int index) {
|
||||
}
|
||||
|
||||
void PlayerProfile::add_class_profile(Ref<ClassProfile> profile) {
|
||||
#if VERSION_MAJOR < 4
|
||||
profile->connect("changed", this, "_on_class_profile_changed");
|
||||
#else
|
||||
profile->connect("changed", callable_mp(this, &PlayerProfile::_on_class_profile_changed));
|
||||
#endif
|
||||
profile->CONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
|
||||
|
||||
_class_profiles.push_back(profile);
|
||||
|
||||
@ -74,11 +70,7 @@ void PlayerProfile::add_class_profile(Ref<ClassProfile> profile) {
|
||||
|
||||
void PlayerProfile::clear_class_profiles() {
|
||||
for (int i = 0; i < _class_profiles.size(); ++i) {
|
||||
#if VERSION_MAJOR < 4
|
||||
_class_profiles.get(i)->disconnect("changed", this, "_on_class_profile_changed");
|
||||
#else
|
||||
_class_profiles.get(i)->disconnect("changed", callable_mp(this, &PlayerProfile::_on_class_profile_changed));
|
||||
#endif
|
||||
_class_profiles.get(i)->DISCONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
|
||||
}
|
||||
|
||||
_class_profiles.clear();
|
||||
@ -87,19 +79,14 @@ void PlayerProfile::clear_class_profiles() {
|
||||
}
|
||||
|
||||
void PlayerProfile::remove_class_profile(const int index) {
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
_class_profiles.get(index)->disconnect("changed", this, "_on_class_profile_changed");
|
||||
#else
|
||||
_class_profiles.get(index)->disconnect("changed", callable_mp(this, &PlayerProfile::_on_class_profile_changed));
|
||||
#endif
|
||||
_class_profiles.get(index)->DISCONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
|
||||
|
||||
_class_profiles.remove(index);
|
||||
|
||||
emit_change();
|
||||
}
|
||||
|
||||
Vector<Ref<ClassProfile> > &PlayerProfile::get_class_profiles() {
|
||||
Vector<Ref<ClassProfile>> &PlayerProfile::get_class_profiles() {
|
||||
return _class_profiles;
|
||||
}
|
||||
|
||||
@ -114,11 +101,7 @@ Ref<ClassProfile> PlayerProfile::get_class_profile(const StringName &class_path)
|
||||
|
||||
class_profile->load_defaults();
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
class_profile->connect("changed", this, "_on_class_profile_changed");
|
||||
#else
|
||||
class_profile->connect("changed", callable_mp(this, &PlayerProfile::_on_class_profile_changed));
|
||||
#endif
|
||||
class_profile->CONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
|
||||
|
||||
_class_profiles.push_back(Ref<ClassProfile>(class_profile));
|
||||
|
||||
@ -176,11 +159,7 @@ void PlayerProfile::from_dict(const Dictionary &dict) {
|
||||
|
||||
c->from_dict(arr.get(i));
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
c->connect("changed", this, "_on_class_profile_changed");
|
||||
#else
|
||||
c->connect("changed", callable_mp(this, &PlayerProfile::_on_class_profile_changed));
|
||||
#endif
|
||||
c->CONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
|
||||
|
||||
_class_profiles.push_back(c);
|
||||
}
|
||||
@ -208,11 +187,7 @@ void PlayerProfile::load_defaults() {
|
||||
for (int i = 0; i < _class_profiles.size(); ++i) {
|
||||
_class_profiles.get(i)->load_defaults();
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
_class_profiles.get(i)->connect("changed", this, "_on_class_profile_changed");
|
||||
#else
|
||||
_class_profiles.get(i)->connect("changed", callable_mp(this, &PlayerProfile::_on_class_profile_changed));
|
||||
#endif
|
||||
_class_profiles.get(i)->CONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
|
||||
}
|
||||
|
||||
emit_change();
|
||||
|
@ -23,15 +23,9 @@ SOFTWARE.
|
||||
#ifndef SPELL_PROJECTILE_3D
|
||||
#define SPELL_PROJECTILE_3D
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#include "scene/3d/spatial.h"
|
||||
#else
|
||||
#include "scene/3d/node_3d.h"
|
||||
|
||||
typedef class Node3D Spatial;
|
||||
#endif
|
||||
#include spatial_h_path
|
||||
|
||||
class SpellCastInfo;
|
||||
|
||||
|
@ -33,13 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include "core/bind/core_bind.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define PoolStringArray PackedStringArray
|
||||
|
||||
#define POOL_STRING_ARRAY PACKED_STRING_ARRAY
|
||||
#endif
|
||||
#include "../defines.h"
|
||||
|
||||
class ESSResourceDB;
|
||||
class ESSEntitySpawner;
|
||||
|
@ -27,7 +27,7 @@ SOFTWARE.
|
||||
|
||||
#include "core/engine.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../defines.h"
|
||||
|
||||
ProfileManager *ProfileManager::_instance;
|
||||
|
||||
@ -63,7 +63,6 @@ int ProfileManager::gets_player_profile_count() const {
|
||||
return _s_player_profiles.size();
|
||||
}
|
||||
Ref<PlayerProfile> ProfileManager::gets_player_profile_index(const int index) {
|
||||
|
||||
return _s_player_profiles.get(index);
|
||||
}
|
||||
void ProfileManager::adds_player_profile(const Ref<PlayerProfile> &profile) {
|
||||
@ -168,15 +167,9 @@ void ProfileManager::from_dict(const Dictionary &dict) {
|
||||
|
||||
clears_player_profiles();
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
_c_player_profile->disconnect("changed", this, "_on_player_profile_changed");
|
||||
_c_player_profile->DISCONNECT("changed", this, ProfileManager, _on_player_profile_changed);
|
||||
_c_player_profile->from_dict(dict.get("cplayer_profile", Dictionary()));
|
||||
_c_player_profile->connect("changed", this, "_on_player_profile_changed");
|
||||
#else
|
||||
_c_player_profile->disconnect("changed", callable_mp(this, &ProfileManager::_on_player_profile_changed));
|
||||
_c_player_profile->from_dict(dict.get("cplayer_profile", Dictionary()));
|
||||
_c_player_profile->connect("changed", callable_mp(this, &ProfileManager::_on_player_profile_changed));
|
||||
#endif
|
||||
_c_player_profile->CONNECT("changed", this, ProfileManager, _on_player_profile_changed);
|
||||
|
||||
Array arr = dict.get("splayer_profiles", Array());
|
||||
|
||||
@ -186,11 +179,7 @@ void ProfileManager::from_dict(const Dictionary &dict) {
|
||||
|
||||
c->from_dict(arr.get(i));
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
c->connect("changed", this, "_on_player_profile_changed");
|
||||
#else
|
||||
c->connect("changed", callable_mp(this, &ProfileManager::_on_player_profile_changed));
|
||||
#endif
|
||||
c->CONNECT("changed", this, ProfileManager, _on_player_profile_changed);
|
||||
|
||||
_s_player_profiles.push_back(c);
|
||||
}
|
||||
@ -205,11 +194,7 @@ ProfileManager::ProfileManager() {
|
||||
|
||||
_c_player_profile.instance();
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
_c_player_profile->connect("changed", this, "_on_player_profile_changed");
|
||||
#else
|
||||
_c_player_profile->connect("changed", callable_mp(this, &ProfileManager::_on_player_profile_changed));
|
||||
#endif
|
||||
_c_player_profile->CONNECT("changed", this, ProfileManager, _on_player_profile_changed);
|
||||
|
||||
if (!Engine::get_singleton()->is_editor_hint() && _automatic_load)
|
||||
call_deferred("load");
|
||||
@ -218,11 +203,7 @@ ProfileManager::ProfileManager() {
|
||||
ProfileManager::~ProfileManager() {
|
||||
_instance = NULL;
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
_c_player_profile->disconnect("changed", this, "_on_player_profile_changed");
|
||||
#else
|
||||
_c_player_profile->disconnect("changed", callable_mp(this, &ProfileManager::_on_player_profile_changed));
|
||||
#endif
|
||||
_c_player_profile->DISCONNECT("changed", this, ProfileManager, _on_player_profile_changed);
|
||||
|
||||
_s_player_profiles.clear();
|
||||
}
|
||||
|
@ -24,20 +24,7 @@ SOFTWARE.
|
||||
|
||||
#include "../data/items/model_visual.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
typedef class RenderingServer VisualServer;
|
||||
typedef class RenderingServer VS;
|
||||
|
||||
#define PoolVector3Array PackedVector3Array
|
||||
#define PoolVector2Array PackedVector2Array
|
||||
#define PoolColorArray PackedColorArray
|
||||
#define PoolIntArray PackedInt32Array
|
||||
#define PoolRealArray PackedFloat32Array
|
||||
#endif
|
||||
#include "../defines.h"
|
||||
|
||||
int CharacterSkeleton3D::get_model_index() {
|
||||
return _model_index;
|
||||
@ -190,7 +177,7 @@ void CharacterSkeleton3D::add_model_visual_entry(Ref<ModelVisual> vis, Ref<Model
|
||||
|
||||
int target_bone_idx = target_bone;
|
||||
|
||||
Vector<Ref<SkeletonModelEntry> > &entries = _entries[target_bone_idx];
|
||||
Vector<Ref<SkeletonModelEntry>> &entries = _entries[target_bone_idx];
|
||||
|
||||
for (int i = 0; i < entries.size(); ++i) {
|
||||
Ref<SkeletonModelEntry> e = entries.get(i);
|
||||
@ -218,7 +205,7 @@ void CharacterSkeleton3D::remove_model_visual_entry(Ref<ModelVisual> vis, Ref<Mo
|
||||
|
||||
int target_bone_idx = target_bone;
|
||||
|
||||
Vector<Ref<SkeletonModelEntry> > &entries = _entries[target_bone_idx];
|
||||
Vector<Ref<SkeletonModelEntry>> &entries = _entries[target_bone_idx];
|
||||
|
||||
for (int i = 0; i < entries.size(); ++i) {
|
||||
Ref<SkeletonModelEntry> e = entries.get(i);
|
||||
@ -252,7 +239,7 @@ int CharacterSkeleton3D::get_model_entry_count(const int bone_index) {
|
||||
|
||||
void CharacterSkeleton3D::sort_layers() {
|
||||
for (int i = 0; i < EntityEnums::SKELETON_POINTS_MAX; ++i) {
|
||||
Vector<Ref<SkeletonModelEntry> > &entries = _entries[i];
|
||||
Vector<Ref<SkeletonModelEntry>> &entries = _entries[i];
|
||||
|
||||
entries.sort_custom<_ModelEntryComparator>();
|
||||
}
|
||||
@ -340,7 +327,7 @@ Array CharacterSkeleton3D::bake_mesh_array_uv(Array arr, Ref<Texture> tex, float
|
||||
PoolVector2Array uvs = arr[VisualServer::ARRAY_TEX_UV];
|
||||
PoolColorArray colors = arr[VisualServer::ARRAY_COLOR];
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if !GODOT4
|
||||
img->lock();
|
||||
#endif
|
||||
|
||||
@ -353,7 +340,7 @@ Array CharacterSkeleton3D::bake_mesh_array_uv(Array arr, Ref<Texture> tex, float
|
||||
colors.set(i, colors[i] * c * mul_color);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if !GODOT4
|
||||
img->unlock();
|
||||
#endif
|
||||
|
||||
@ -391,7 +378,6 @@ void CharacterSkeleton3D::_notification(int p_what) {
|
||||
build_model();
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,11 @@ SOFTWARE.
|
||||
|
||||
#include "../data/items/model_visual_entry.h"
|
||||
|
||||
#include "core/version.h"
|
||||
#include "../defines.h"
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#include "scene/3d/spatial.h"
|
||||
#else
|
||||
#include "scene/3d/node_3d.h"
|
||||
#define Spatial Node3D
|
||||
#include spatial_h_path
|
||||
|
||||
#if GODOT4
|
||||
#define Texture Texture2D
|
||||
#endif
|
||||
|
||||
@ -129,8 +127,8 @@ private:
|
||||
Node *_bone_nodes[EntityEnums::SKELETON_POINTS_MAX];
|
||||
|
||||
bool _model_dirty;
|
||||
Vector<Ref<ModelVisual> > _model_visuals;
|
||||
Vector<Ref<SkeletonModelEntry> > _entries[EntityEnums::SKELETON_POINTS_MAX];
|
||||
Vector<Ref<ModelVisual>> _model_visuals;
|
||||
Vector<Ref<SkeletonModelEntry>> _entries[EntityEnums::SKELETON_POINTS_MAX];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -22,11 +22,7 @@ SOFTWARE.
|
||||
|
||||
#include "category_cooldown.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define REAL FLOAT
|
||||
#endif
|
||||
#include "../defines.h"
|
||||
|
||||
int CategoryCooldown::get_category_id() const {
|
||||
return _category_id;
|
||||
|
@ -25,11 +25,7 @@ SOFTWARE.
|
||||
#include "../database/ess_resource_db.h"
|
||||
#include "../singletons/ess.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR >= 4
|
||||
#define REAL FLOAT
|
||||
#endif
|
||||
#include "../defines.h"
|
||||
|
||||
int Cooldown::get_spell_id() const {
|
||||
return _spell_id;
|
||||
|
Loading…
Reference in New Issue
Block a user