mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Fix compile for 4.0.
This commit is contained in:
parent
f92758ce3d
commit
9fd0c23f5b
@ -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<AuraData> aura) {
|
||||
}
|
||||
|
||||
void Aura::_supdate(Ref<AuraData> aura, float delta) {
|
||||
|
||||
bool remove = false;
|
||||
|
||||
remove = aura->update(delta);
|
||||
|
||||
//ontick
|
||||
while (aura->get_unhandled_ticks() > 0) {
|
||||
|
||||
if (aura->get_damage() != 0) {
|
||||
Ref<SpellDamageInfo> dpd = Ref<SpellDamageInfo>(memnew(SpellDamageInfo()));
|
||||
|
||||
@ -1090,7 +1094,6 @@ 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
|
||||
@ -1131,7 +1134,6 @@ 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
|
||||
@ -1186,7 +1188,6 @@ void Aura::_handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> 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();
|
||||
|
@ -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<EntityData> 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<EntityData> 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;
|
||||
bag.instance();
|
||||
|
||||
@ -3939,17 +3949,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;
|
||||
}
|
||||
|
||||
@ -4093,10 +4103,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;
|
||||
}
|
||||
|
||||
@ -4656,7 +4666,6 @@ void Entity::aura_removess_with_group(Ref<AuraGroup> aura_group) {
|
||||
Ref<AuraData> 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);
|
||||
|
||||
|
@ -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<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);
|
||||
@ -717,8 +724,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);
|
||||
@ -1126,8 +1133,8 @@ private:
|
||||
|
||||
//// Resources ////
|
||||
|
||||
Vector<Ref<EntityResource> > _s_resources;
|
||||
Vector<Ref<EntityResource> > _c_resources;
|
||||
Vector<Ref<EntityResource>> _s_resources;
|
||||
Vector<Ref<EntityResource>> _c_resources;
|
||||
|
||||
//// GCD ////
|
||||
|
||||
@ -1148,8 +1155,8 @@ private:
|
||||
|
||||
//// AuraComponent ////
|
||||
|
||||
Vector<Ref<AuraData> > _s_auras;
|
||||
Vector<Ref<AuraData> > _c_auras;
|
||||
Vector<Ref<AuraData>> _s_auras;
|
||||
Vector<Ref<AuraData>> _c_auras;
|
||||
|
||||
EntityEnums::EntityType _s_entity_type;
|
||||
EntityEnums::EntityType _c_entity_type;
|
||||
@ -1160,14 +1167,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;
|
||||
@ -1187,8 +1194,8 @@ private:
|
||||
|
||||
//// Data ////
|
||||
|
||||
Vector<Ref<EntityDataContainer> > _s_data;
|
||||
Vector<Ref<EntityDataContainer> > _c_data;
|
||||
Vector<Ref<EntityDataContainer>> _s_data;
|
||||
Vector<Ref<EntityDataContainer>> _c_data;
|
||||
|
||||
//// Actionbars ////
|
||||
|
||||
@ -1197,21 +1204,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 ////
|
||||
|
||||
@ -1255,7 +1262,7 @@ private:
|
||||
|
||||
// Callbacks
|
||||
|
||||
Vector<Ref<SpellCastInfo> > _physics_process_scis;
|
||||
Vector<Ref<SpellCastInfo>> _physics_process_scis;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user