diff --git a/data/auras/aura.cpp b/data/auras/aura.cpp index 706371f..c37a0f1 100644 --- a/data/auras/aura.cpp +++ b/data/auras/aura.cpp @@ -27,6 +27,12 @@ SOFTWARE. #include "core/version.h" +#if VERSION_MAJOR >= 4 +#define PoolStringArray PackedStringArray + +#define POOL_STRING_ARRAY PACKED_STRING_ARRAY +#endif + int Aura::get_id() const { return _id; } @@ -1053,14 +1059,12 @@ void Aura::_removes_dispell(Ref aura) { } void Aura::_supdate(Ref aura, float delta) { - bool remove = false; remove = aura->update(delta); //ontick while (aura->get_unhandled_ticks() > 0) { - if (aura->get_damage() != 0) { Ref dpd = Ref(memnew(SpellDamageInfo())); @@ -1090,7 +1094,6 @@ void Aura::_supdate(Ref aura, float delta) { } void Aura::_setup_aura_data(Ref data, Ref info) { - #if VERSION_MAJOR < 4 ERR_FAIL_COND(!ObjectDB::instance_validate(info->get_caster())); #else @@ -1131,7 +1134,6 @@ void Aura::_calculate_initial_damage(Ref aura_data, Ref } void Aura::_handle_aura_damage(Ref aura_data, Ref info) { - #if VERSION_MAJOR < 4 ERR_FAIL_COND(!ObjectDB::instance_validate(info->get_dealer())); #else @@ -1186,7 +1188,6 @@ void Aura::_handle_aura_heal(Ref aura_data, Ref info) { } void Aura::_validate_property(PropertyInfo &property) const { - String prop = property.name; if (prop.begins_with("StatModAttribute_")) { int frame = prop.get_slicec('/', 0).get_slicec('_', 1).to_int(); diff --git a/entities/entity.cpp b/entities/entity.cpp index e93c874..e4d4ec9 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -40,7 +40,6 @@ SOFTWARE. #include "./resources/entity_resource_speed.h" #include "./skills/entity_skill.h" #include "scene/2d/node_2d.h" -#include "scene/3d/spatial.h" #include "core/script_language.h" @@ -114,7 +113,11 @@ 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 return _body_3d->get_transform(); } @@ -123,7 +126,11 @@ 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 return _body_3d->set_transform(transform); } @@ -133,7 +140,11 @@ 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 return _body_2d->get_transform(); } @@ -142,7 +153,11 @@ 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 return _body_2d->set_transform(_transform_2d); } @@ -225,7 +240,6 @@ EntityEnums::EntityRelationType Entity::getc_relation_to_bind(Node *to) { 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 @@ -462,7 +476,6 @@ void Entity::sets_entity_data(Ref value) { if (get_body() == NULL && value.is_valid() && value->get_entity_species_data().is_valid() && value->get_entity_species_data()->get_model_data().is_valid() && value->get_entity_species_data()->get_model_data()->get_body().is_valid()) { - Node *node = value->get_entity_species_data()->get_model_data()->get_body()->instance(); add_child(node); @@ -484,7 +497,6 @@ void Entity::setc_entity_data(Ref value) { if (get_body() == NULL && value.is_valid() && value->get_entity_species_data().is_valid() && value->get_entity_species_data()->get_model_data().is_valid() && value->get_entity_species_data()->get_model_data()->get_body().is_valid()) { - Node *node = value->get_entity_species_data()->get_model_data()->get_body()->instance(); add_child(node); @@ -769,7 +781,6 @@ void Entity::setup_actionbars() { return; if (is_deserialized()) { - return; } @@ -791,7 +802,6 @@ void Entity::setup_actionbars() { //} if (!gets_bag().is_valid()) { - Ref bag; bag.instance(); @@ -3939,17 +3949,17 @@ void Entity::cast_spell_successc(Ref info) { } //// Cooldowns //// -Vector > *Entity::cooldowns_gets() { +Vector> *Entity::cooldowns_gets() { return &_s_cooldowns; } -Vector > *Entity::cooldowns_getc() { +Vector> *Entity::cooldowns_getc() { return &_c_cooldowns; } -HashMap > *Entity::cooldown_get_maps() { +HashMap> *Entity::cooldown_get_maps() { return &_s_cooldown_map; } -HashMap > *Entity::cooldown_get_mapc() { +HashMap> *Entity::cooldown_get_mapc() { return &_c_cooldown_map; } @@ -4093,10 +4103,10 @@ int Entity::cooldown_getc_count() { } //Category Cooldowns -Vector > Entity::category_cooldowns_gets() { +Vector> Entity::category_cooldowns_gets() { return _s_category_cooldowns; } -Vector > Entity::category_cooldowns_getc() { +Vector> Entity::category_cooldowns_getc() { return _c_category_cooldowns; } @@ -4656,7 +4666,6 @@ void Entity::aura_removess_with_group(Ref aura_group) { Ref ad = _s_auras.get(i); if (ad->get_aura()->get_aura_group() == aura_group) { - aura_removec(ad); _s_auras.remove(i); @@ -4989,7 +4998,8 @@ void Entity::talents_sclear() { } void Entity::talent_addc(int talent) { - if (talent_hasc(talent)) return; + if (talent_hasc(talent)) + return; _c_talents.push_back(talent); diff --git a/entities/entity.h b/entities/entity.h index 150ac3b..4c44246 100644 --- a/entities/entity.h +++ b/entities/entity.h @@ -60,6 +60,13 @@ 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 + class EntityData; class AuraData; class Spell; @@ -695,11 +702,11 @@ public: //// Cooldowns //// - Vector > *cooldowns_gets(); - Vector > *cooldowns_getc(); + Vector> *cooldowns_gets(); + Vector> *cooldowns_getc(); - HashMap > *cooldown_get_maps(); - HashMap > *cooldown_get_mapc(); + HashMap> *cooldown_get_maps(); + HashMap> *cooldown_get_mapc(); bool cooldown_hass(int spell_id); void cooldown_adds(int spell_id, float value); @@ -717,8 +724,8 @@ public: //Category Cooldowns - Vector > category_cooldowns_gets(); - Vector > category_cooldowns_getc(); + Vector> category_cooldowns_gets(); + Vector> category_cooldowns_getc(); bool category_cooldown_hass(int category_id); void category_cooldown_adds(int category_id, float value); @@ -1126,8 +1133,8 @@ private: //// Resources //// - Vector > _s_resources; - Vector > _c_resources; + Vector> _s_resources; + Vector> _c_resources; //// GCD //// @@ -1148,8 +1155,8 @@ private: //// AuraComponent //// - Vector > _s_auras; - Vector > _c_auras; + Vector> _s_auras; + Vector> _c_auras; EntityEnums::EntityType _s_entity_type; EntityEnums::EntityType _c_entity_type; @@ -1160,14 +1167,14 @@ private: int _c_entity_flags; //// Cooldowns //// - Vector > _s_cooldowns; - Vector > _c_cooldowns; + Vector> _s_cooldowns; + Vector> _c_cooldowns; - HashMap > _s_cooldown_map; - HashMap > _c_cooldown_map; + HashMap> _s_cooldown_map; + HashMap> _c_cooldown_map; - Vector > _s_category_cooldowns; - Vector > _c_category_cooldowns; + Vector> _s_category_cooldowns; + Vector> _c_category_cooldowns; int _s_active_category_cooldowns; int _c_active_category_cooldowns; @@ -1187,8 +1194,8 @@ private: //// Data //// - Vector > _s_data; - Vector > _c_data; + Vector> _s_data; + Vector> _c_data; //// Actionbars //// @@ -1197,21 +1204,21 @@ private: //// Crafting System //// - Vector > _s_craft_recipes; - Vector > _c_craft_recipes; + Vector> _s_craft_recipes; + Vector> _c_craft_recipes; //// Known Spells //// int _s_free_spell_points; int _c_free_spell_points; - Vector > _s_spells; - Vector > _c_spells; + Vector> _s_spells; + Vector> _c_spells; //// Skills //// - Vector > _s_skills; - Vector > _c_skills; + Vector> _s_skills; + Vector> _c_skills; //// Stat Allocations //// @@ -1255,7 +1262,7 @@ private: // Callbacks - Vector > _physics_process_scis; + Vector> _physics_process_scis; }; #endif diff --git a/entities/stats/stat_data.h b/entities/stats/stat_data.h index 3688962..a740986 100644 --- a/entities/stats/stat_data.h +++ b/entities/stats/stat_data.h @@ -28,6 +28,12 @@ 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); diff --git a/singletons/ess.h b/singletons/ess.h index dd80ff1..fc7e3ae 100644 --- a/singletons/ess.h +++ b/singletons/ess.h @@ -33,6 +33,14 @@ 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 + class ESSResourceDB; class ESSEntitySpawner; class EntityCreateInfo;