mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Removed the notifications from EntityData. And made Entity call into the AI's notifications instead.
This commit is contained in:
parent
dc452d3937
commit
e94aa02506
@ -294,26 +294,6 @@ void EntityClassData::_setup_resources(Node *entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void EntityClassData::start_casting(int spell_id, Entity *caster, float spellScale) {
|
||||
if (_spells.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _spells.size(); i++) {
|
||||
Ref<Spell> s = _spells[i];
|
||||
|
||||
if (s == NULL) {
|
||||
print_error("class doesn't have spell! spell_id: " + itos(spell_id));
|
||||
return;
|
||||
}
|
||||
|
||||
if (s->get_id() == spell_id) {
|
||||
s->cast_starts_simple(caster, spellScale);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EntityClassData::EntityClassData() {
|
||||
_id = 0;
|
||||
_spell_points_per_level = 1;
|
||||
|
@ -135,8 +135,6 @@ public:
|
||||
void setup_resources(Entity *entity);
|
||||
void _setup_resources(Node *entity);
|
||||
|
||||
void start_casting(int spell_id, Entity *caster, float spellScale);
|
||||
|
||||
EntityClassData();
|
||||
~EntityClassData();
|
||||
|
||||
|
@ -330,362 +330,6 @@ void EntityData::sinteract_bind(Node *entity) {
|
||||
sinteract(e);
|
||||
}
|
||||
|
||||
void EntityData::start_casting(int spell_id, Entity *caster, float spellScale) {
|
||||
if (_entity_class_data.is_valid())
|
||||
_entity_class_data->start_casting(spell_id, caster, spellScale);
|
||||
}
|
||||
|
||||
void EntityData::notification_saura(int what, Ref<AuraData> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (has_method("_notification_saura"))
|
||||
call("_notification_saura", what, data);
|
||||
}
|
||||
void EntityData::notification_sheal(int what, Ref<SpellHealInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (has_method("_notification_sheal"))
|
||||
call("_notification_sheal", what, info);
|
||||
}
|
||||
void EntityData::notification_scast(int what, Ref<SpellCastInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (has_method("_notification_scast"))
|
||||
call("_notification_scast", what, info);
|
||||
}
|
||||
void EntityData::notification_sdamage(int what, Ref<SpellDamageInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (has_method("_notification_sdamage"))
|
||||
call("_notification_sdamage", what, info);
|
||||
}
|
||||
|
||||
void EntityData::notification_sdeath(Entity *entity) {
|
||||
if (has_method("_notification_sdeath"))
|
||||
call("_notification_sdeath", entity);
|
||||
}
|
||||
|
||||
void EntityData::notification_sdeath_bind(Node *entity) {
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_sdeath(e);
|
||||
}
|
||||
|
||||
void EntityData::notification_scooldown_added(int id, float value) {
|
||||
if (has_method("_notification_scooldown_added"))
|
||||
call("_notification_scooldown_added", id, value);
|
||||
}
|
||||
void EntityData::notification_scooldown_removed(int id, float value) {
|
||||
if (has_method("_notification_scooldown_removed"))
|
||||
call("_notification_scooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_scategory_cooldown_added(int id, float value) {
|
||||
if (has_method("_notification_scategory_cooldown_added"))
|
||||
call("_notification_scategory_cooldown_added", id, value);
|
||||
}
|
||||
void EntityData::notification_scategory_cooldown_removed(int id, float value) {
|
||||
if (has_method("_notification_scategory_cooldown_removed"))
|
||||
call("_notification_scategory_cooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_sgcd_started(Entity *entity, float gcd) {
|
||||
if (has_method("_notification_sgcd_started"))
|
||||
call("_notification_sgcd_started", entity, gcd);
|
||||
}
|
||||
void EntityData::notification_sgcd_finished(Entity *entity) {
|
||||
if (has_method("_notification_sgcd_finished"))
|
||||
call("_notification_sgcd_finished", entity);
|
||||
}
|
||||
void EntityData::notification_sgcd_started_bind(Node *entity, float gcd) {
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_sgcd_started(e, gcd);
|
||||
}
|
||||
void EntityData::notification_sgcd_finished_bind(Node *entity) {
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_sgcd_finished(e);
|
||||
}
|
||||
|
||||
void EntityData::notification_sxp_gained(Entity *entity, int value) {
|
||||
if (has_method("_notification_sxp_gained"))
|
||||
call("_notification_sxp_gained", entity, value);
|
||||
}
|
||||
void EntityData::notification_sxp_gained_bind(Node *entity, int value) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_sxp_gained(e, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_sclass_level_up(Entity *entity, int value) {
|
||||
if (has_method("_notification_sclass_level_up"))
|
||||
call("_notification_sclass_level_up", entity);
|
||||
}
|
||||
void EntityData::notification_sclass_level_up_bind(Node *entity, int value) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_sclass_level_up(e, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_scharacter_level_up(Entity *entity, int value) {
|
||||
if (has_method("_notification_scharacter_level_up"))
|
||||
call("_notification_scharacter_level_up", entity);
|
||||
}
|
||||
void EntityData::notification_scharacter_level_up_bind(Node *entity, int value) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_scharacter_level_up(e, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_sentity_resource_added(Ref<EntityResource> resource) {
|
||||
if (has_method("_notification_sentity_resource_added"))
|
||||
call("_notification_sentity_resource_added", resource);
|
||||
}
|
||||
|
||||
void EntityData::notification_sentity_resource_removed(Ref<EntityResource> resource) {
|
||||
if (has_method("_notification_sentity_resource_removed"))
|
||||
call("_notification_sentity_resource_removed", resource);
|
||||
}
|
||||
|
||||
//Clientside Event Handlers
|
||||
void EntityData::notification_caura(int what, Ref<AuraData> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (has_method("_notification_caura"))
|
||||
call("_notification_caura", what, data);
|
||||
}
|
||||
void EntityData::notification_cheal(int what, Ref<SpellHealInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (has_method("_notification_cheal"))
|
||||
call("_notification_cheal", what, info);
|
||||
}
|
||||
void EntityData::notification_ccast(int what, Ref<SpellCastInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (has_method("_notification_ccast"))
|
||||
call("_notification_ccast", what, info);
|
||||
}
|
||||
void EntityData::notification_cdamage(int what, Ref<SpellDamageInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (has_method("_notification_cdamage"))
|
||||
call("_notification_cdamage", what, info);
|
||||
}
|
||||
|
||||
void EntityData::notification_cdeath(Entity *entity) {
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
|
||||
if (has_method("_notification_cdeath"))
|
||||
call("_notification_cdeath", entity);
|
||||
}
|
||||
|
||||
void EntityData::notification_cdeath_bind(Node *entity) {
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_cdeath(e);
|
||||
}
|
||||
|
||||
void EntityData::notification_ccooldown_added(int id, float value) {
|
||||
if (has_method("_notification_ccooldown_added"))
|
||||
call("_notification_ccooldown_added", id, value);
|
||||
}
|
||||
void EntityData::notification_ccooldown_removed(int id, float value) {
|
||||
if (has_method("_notification_ccooldown_removed"))
|
||||
call("_notification_ccooldown_removed", id, value);
|
||||
}
|
||||
void EntityData::notification_ccategory_cooldown_added(int id, float value) {
|
||||
if (has_method("_notification_ccategory_cooldown_added"))
|
||||
call("_notification_ccategory_cooldown_added", id, value);
|
||||
}
|
||||
void EntityData::notification_ccategory_cooldown_removed(int id, float value) {
|
||||
if (has_method("_notification_ccategory_cooldown_removed"))
|
||||
call("_notification_ccategory_cooldown_removed", id, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_cgcd_started(Entity *entity, float gcd) {
|
||||
if (has_method("_notification_cgcd_started"))
|
||||
call("_notification_cgcd_started", entity, gcd);
|
||||
}
|
||||
void EntityData::notification_cgcd_finished(Entity *entity) {
|
||||
if (has_method("_notification_cgcd_finished"))
|
||||
call("_notification_cgcd_finished", entity);
|
||||
}
|
||||
void EntityData::notification_cgcd_started_bind(Node *entity, float gcd) {
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_cgcd_started(e, gcd);
|
||||
}
|
||||
void EntityData::notification_cgcd_finished_bind(Node *entity) {
|
||||
ERR_FAIL_COND(entity == NULL);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_cgcd_finished(e);
|
||||
}
|
||||
|
||||
void EntityData::notification_cxp_gained(Entity *entity, int value) {
|
||||
if (has_method("_notification_cxp_gained"))
|
||||
call("_notification_cxp_gained", entity, value);
|
||||
}
|
||||
void EntityData::notification_cxp_gained_bind(Node *entity, int value) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_cxp_gained(e, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_cclass_level_up(Entity *entity, int value) {
|
||||
if (has_method("_notification_cclass_level_up"))
|
||||
call("_notification_cclass_level_up", entity);
|
||||
}
|
||||
void EntityData::notification_cclass_level_up_bind(Node *entity, int value) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_cclass_level_up(e, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_ccharacter_level_up(Entity *entity, int value) {
|
||||
if (has_method("_notification_ccharacter_level_up"))
|
||||
call("_notification_ccharacter_level_up", entity);
|
||||
}
|
||||
void EntityData::notification_ccharacter_level_up_bind(Node *entity, int value) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
notification_ccharacter_level_up(e, value);
|
||||
}
|
||||
|
||||
void EntityData::notification_centity_resource_added(Ref<EntityResource> resource) {
|
||||
if (has_method("_notification_centity_resource_added"))
|
||||
call("_notification_centity_resource_added", resource);
|
||||
}
|
||||
|
||||
void EntityData::notification_centity_resource_removed(Ref<EntityResource> resource) {
|
||||
if (has_method("_notification_centity_resource_removed"))
|
||||
call("_notification_centity_resource_removed", resource);
|
||||
}
|
||||
|
||||
//Equipment
|
||||
|
||||
bool EntityData::equip_should_deny(Entity *entity, int equip_slot, Ref<ItemInstance> item) {
|
||||
if (has_method("_equip_should_deny"))
|
||||
if (call("_equip_should_deny", entity, equip_slot, item))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
bool EntityData::equip_should_deny_bind(Node *entity, int equip_slot, Ref<ItemInstance> item) {
|
||||
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false);
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND_V(e == NULL, false);
|
||||
|
||||
return equip_should_deny(e, equip_slot, item);
|
||||
}
|
||||
|
||||
void EntityData::equip_son_success(Entity *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
if (has_method("_equip_son_success"))
|
||||
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) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
equip_son_success(e, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
|
||||
void EntityData::equip_son_fail(Entity *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
if (has_method("_equip_son_fail"))
|
||||
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) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
equip_son_fail(e, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
|
||||
void EntityData::equip_con_success(Entity *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
if (has_method("_equip_con_success"))
|
||||
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) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
equip_con_success(e, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
|
||||
void EntityData::equip_con_fail(Entity *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
if (has_method("_equip_con_fail"))
|
||||
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) {
|
||||
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
|
||||
|
||||
Entity *e = Object::cast_to<Entity>(entity);
|
||||
|
||||
ERR_FAIL_COND(e == NULL);
|
||||
|
||||
equip_con_fail(e, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
|
||||
EntityData::EntityData() {
|
||||
_id = 0;
|
||||
_money = 0;
|
||||
@ -730,121 +374,6 @@ void EntityData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("cans_interact", "entity"), &EntityData::cans_interact_bind);
|
||||
ClassDB::bind_method(D_METHOD("sinteract", "entity"), &EntityData::sinteract_bind);
|
||||
|
||||
//EventHandlers
|
||||
BIND_VMETHOD(MethodInfo("_notification_saura", PropertyInfo(Variant::INT, "what"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_sheal", PropertyInfo(Variant::INT, "what"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_scast", PropertyInfo(Variant::INT, "what"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_sdamage", PropertyInfo(Variant::INT, "what"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_saura", "what", "data"), &EntityData::notification_saura);
|
||||
ClassDB::bind_method(D_METHOD("notification_sheal", "what", "info"), &EntityData::notification_sheal);
|
||||
ClassDB::bind_method(D_METHOD("notification_scast", "what", "info"), &EntityData::notification_scast);
|
||||
ClassDB::bind_method(D_METHOD("notification_sdamage", "what", "info"), &EntityData::notification_sdamage);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_caura", PropertyInfo(Variant::INT, "what"), PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_cheal", PropertyInfo(Variant::INT, "what"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellHealInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_ccast", PropertyInfo(Variant::INT, "what"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_cdamage", PropertyInfo(Variant::INT, "what"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellDamageInfo")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_caura", "what", "data"), &EntityData::notification_caura);
|
||||
ClassDB::bind_method(D_METHOD("notification_cheal", "what", "info"), &EntityData::notification_cheal);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccast", "what", "info"), &EntityData::notification_ccast);
|
||||
ClassDB::bind_method(D_METHOD("notification_cdamage", "what", "info"), &EntityData::notification_cdamage);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_sdeath", "data"), &EntityData::notification_sdeath_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_scooldown_added", "cooldown"), &EntityData::notification_scooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_scooldown_removed", "cooldown"), &EntityData::notification_scooldown_removed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_scategory_cooldown_added", "category_cooldown"), &EntityData::notification_scategory_cooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_scategory_cooldown_removed", "category_cooldown"), &EntityData::notification_scategory_cooldown_removed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_sgcd_started", "entity", "gcd"), &EntityData::notification_sgcd_started_bind);
|
||||
ClassDB::bind_method(D_METHOD("notification_sgcd_finished", "entity"), &EntityData::notification_sgcd_finished_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_sxp_gained", "entity", "value"), &EntityData::notification_sxp_gained_bind);
|
||||
ClassDB::bind_method(D_METHOD("notification_sclass_level_up", "entity", "value"), &EntityData::notification_sclass_level_up_bind);
|
||||
ClassDB::bind_method(D_METHOD("notification_scharacter_level_up", "entity", "value"), &EntityData::notification_scharacter_level_up_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_sentity_resource_added", "resource"), &EntityData::notification_sentity_resource_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_sentity_resource_removed", "resource"), &EntityData::notification_sentity_resource_removed);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_sdeath", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_sai_follow", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
BIND_VMETHOD(MethodInfo("_sai_rest", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
BIND_VMETHOD(MethodInfo("_sai_regenerate", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
BIND_VMETHOD(MethodInfo("_sai_attack", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_scooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_scooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_scategory_cooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_scategory_cooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_sgcd_started", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::REAL, "gcd")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_sgcd_finished", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_sxp_gained", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_sclass_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_scharacter_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_sentity_resource_added", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_sentity_resource_removed", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_setup_resources", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
//Clientside Event Handlers
|
||||
ClassDB::bind_method(D_METHOD("notification_cdeath", "data"), &EntityData::notification_cdeath_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_ccooldown_added", "cooldown"), &EntityData::notification_ccooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccooldown_removed", "cooldown"), &EntityData::notification_ccooldown_removed);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccategory_cooldown_added", "cooldown"), &EntityData::notification_ccategory_cooldown_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccategory_cooldown_removed", "cooldown"), &EntityData::notification_ccategory_cooldown_removed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_cgcd_started", "entity", "gcd"), &EntityData::notification_cgcd_started_bind);
|
||||
ClassDB::bind_method(D_METHOD("notification_cgcd_finished", "entity"), &EntityData::notification_cgcd_finished_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_cxp_gained", "entity", "value"), &EntityData::notification_cxp_gained_bind);
|
||||
ClassDB::bind_method(D_METHOD("notification_cclass_level_up", "entity", "value"), &EntityData::notification_cclass_level_up_bind);
|
||||
ClassDB::bind_method(D_METHOD("notification_ccharacter_level_up", "entity", "value"), &EntityData::notification_ccharacter_level_up_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("notification_centity_resource_added", "resource"), &EntityData::notification_centity_resource_added);
|
||||
ClassDB::bind_method(D_METHOD("notification_centity_resource_removed", "resource"), &EntityData::notification_centity_resource_removed);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_cdeath", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_ccooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_ccooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_ccategory_cooldown_added", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_ccategory_cooldown_removed", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::REAL, "value")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_cgcd_started", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::REAL, "gcd")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_cgcd_finished", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_cxp_gained", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_cclass_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_ccharacter_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_notification_centity_resource_added", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource")));
|
||||
BIND_VMETHOD(MethodInfo("_notification_centity_resource_removed", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource")));
|
||||
|
||||
//Equipment
|
||||
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "ret"), "_equip_should_deny", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_equip_son_success", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::OBJECT, "old_item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::INT, "bag_slot")));
|
||||
BIND_VMETHOD(MethodInfo("_equip_son_fail", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::OBJECT, "old_item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::INT, "bag_slot")));
|
||||
BIND_VMETHOD(MethodInfo("_equip_con_success", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::OBJECT, "old_item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::INT, "bag_slot")));
|
||||
BIND_VMETHOD(MethodInfo("_equip_con_fail", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "equip_slot"), PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::OBJECT, "old_item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance"), PropertyInfo(Variant::INT, "bag_slot")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("equip_should_deny", "entity", "equip_slot", "item"), &EntityData::equip_should_deny_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("equip_son_success", "entity", "equip_slot", "item", "old_item", "bag_slot"), &EntityData::equip_son_success_bind);
|
||||
ClassDB::bind_method(D_METHOD("equip_son_fail", "entity", "equip_slot", "item", "old_item", "bag_slot"), &EntityData::equip_son_fail_bind);
|
||||
ClassDB::bind_method(D_METHOD("equip_con_success", "entity", "equip_slot", "item", "old_item", "bag_slot"), &EntityData::equip_con_success_bind);
|
||||
ClassDB::bind_method(D_METHOD("equip_con_fail", "entity", "equip_slot", "item", "old_item", "bag_slot"), &EntityData::equip_con_fail_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &EntityData::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &EntityData::set_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
||||
|
@ -147,83 +147,6 @@ public:
|
||||
void sinteract(Entity *entity);
|
||||
void sinteract_bind(Node *entity);
|
||||
|
||||
//// Spell System ////
|
||||
|
||||
void start_casting(int spell_id, Entity *caster, float spellScale);
|
||||
|
||||
void notification_saura(int what, Ref<AuraData> data);
|
||||
void notification_sheal(int what, Ref<SpellHealInfo> info);
|
||||
void notification_scast(int what, Ref<SpellCastInfo> info);
|
||||
void notification_sdamage(int what, Ref<SpellDamageInfo> info);
|
||||
|
||||
void notification_sdeath(Entity *entity);
|
||||
void notification_sdeath_bind(Node *entity);
|
||||
|
||||
void notification_scooldown_added(int id, float value);
|
||||
void notification_scooldown_removed(int id, float value);
|
||||
|
||||
void notification_scategory_cooldown_added(int id, float value);
|
||||
void notification_scategory_cooldown_removed(int id, float value);
|
||||
|
||||
void notification_sgcd_started(Entity *entity, float gcd);
|
||||
void notification_sgcd_finished(Entity *entity);
|
||||
void notification_sgcd_started_bind(Node *entity, float gcd);
|
||||
void notification_sgcd_finished_bind(Node *entity);
|
||||
|
||||
void notification_sxp_gained(Entity *entity, int value);
|
||||
void notification_sxp_gained_bind(Node *entity, int value);
|
||||
void notification_sclass_level_up(Entity *entity, int value);
|
||||
void notification_sclass_level_up_bind(Node *entity, int value);
|
||||
void notification_scharacter_level_up(Entity *entity, int value);
|
||||
void notification_scharacter_level_up_bind(Node *entity, int value);
|
||||
|
||||
void notification_sentity_resource_added(Ref<EntityResource> resource);
|
||||
void notification_sentity_resource_removed(Ref<EntityResource> resource);
|
||||
|
||||
//Clientside Event Handlers
|
||||
void notification_caura(int what, Ref<AuraData> data);
|
||||
void notification_cheal(int what, Ref<SpellHealInfo> info);
|
||||
void notification_ccast(int what, Ref<SpellCastInfo> info);
|
||||
void notification_cdamage(int what, Ref<SpellDamageInfo> info);
|
||||
|
||||
void notification_ccooldown_added(int id, float value);
|
||||
void notification_ccooldown_removed(int id, float value);
|
||||
void notification_ccategory_cooldown_added(int id, float value);
|
||||
void notification_ccategory_cooldown_removed(int id, float value);
|
||||
|
||||
void notification_cdeath(Entity *entity);
|
||||
void notification_cdeath_bind(Node *entity);
|
||||
|
||||
void notification_cgcd_started(Entity *entity, float gcd);
|
||||
void notification_cgcd_finished(Entity *entity);
|
||||
void notification_cgcd_started_bind(Node *entity, float gcd);
|
||||
void notification_cgcd_finished_bind(Node *entity);
|
||||
|
||||
void notification_cxp_gained(Entity *entity, int value);
|
||||
void notification_cxp_gained_bind(Node *entity, int value);
|
||||
void notification_cclass_level_up(Entity *entity, int value);
|
||||
void notification_cclass_level_up_bind(Node *entity, int value);
|
||||
void notification_ccharacter_level_up(Entity *entity, int value);
|
||||
void notification_ccharacter_level_up_bind(Node *entity, int value);
|
||||
|
||||
void notification_centity_resource_added(Ref<EntityResource> resource);
|
||||
void notification_centity_resource_removed(Ref<EntityResource> resource);
|
||||
|
||||
//Equipment
|
||||
|
||||
bool equip_should_deny(Entity *entity, int equip_slot, Ref<ItemInstance> item);
|
||||
bool equip_should_deny_bind(Node *entity, int equip_slot, Ref<ItemInstance> item);
|
||||
|
||||
void equip_son_success(Entity *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
|
||||
void equip_son_success_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
|
||||
void equip_son_fail(Entity *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
|
||||
void equip_son_fail_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
|
||||
|
||||
void equip_con_success(Entity *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
|
||||
void equip_con_success_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
|
||||
void equip_con_fail(Entity *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
|
||||
void equip_con_fail_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot);
|
||||
|
||||
EntityData();
|
||||
~EntityData();
|
||||
|
||||
|
@ -46,52 +46,46 @@ SOFTWARE.
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#define NOTIFICATION_IMPLS(func, signal, ...) \
|
||||
if (_s_entity_data.is_valid()) \
|
||||
_s_entity_data->func(this, __VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, __VA_ARGS__); \
|
||||
\
|
||||
for (int i = 0; i < _s_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _s_auras.get(i); \
|
||||
ad->get_aura()->func(ad, __VA_ARGS__); \
|
||||
} \
|
||||
\
|
||||
#define NOTIFICATION_IMPLS(func, signal, ...) \
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) \
|
||||
_s_ai->func(this, __VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, __VA_ARGS__); \
|
||||
\
|
||||
for (int i = 0; i < _s_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _s_auras.get(i); \
|
||||
ad->get_aura()->func(ad, __VA_ARGS__); \
|
||||
} \
|
||||
\
|
||||
emit_signal(signal, this, __VA_ARGS__);
|
||||
|
||||
#define NOTIFICATION_IMPLSS(func, signal) \
|
||||
if (_s_entity_data.is_valid()) \
|
||||
_s_entity_data->func(this); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func); \
|
||||
\
|
||||
for (int i = 0; i < _s_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _s_auras.get(i); \
|
||||
ad->get_aura()->func(ad); \
|
||||
} \
|
||||
\
|
||||
#define NOTIFICATION_IMPLSS(func, signal) \
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) \
|
||||
_s_ai->func(this); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func); \
|
||||
\
|
||||
for (int i = 0; i < _s_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _s_auras.get(i); \
|
||||
ad->get_aura()->func(ad); \
|
||||
} \
|
||||
\
|
||||
emit_signal(signal, this);
|
||||
|
||||
#define NOTIFICATION_IMPLC(func, signal, ...) \
|
||||
if (_c_entity_data.is_valid()) \
|
||||
_c_entity_data->func(this, __VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, __VA_ARGS__); \
|
||||
\
|
||||
for (int i = 0; i < _c_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _c_auras.get(i); \
|
||||
ad->get_aura()->func(ad, __VA_ARGS__); \
|
||||
} \
|
||||
\
|
||||
#define NOTIFICATION_IMPLC(func, signal, ...) \
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, __VA_ARGS__); \
|
||||
\
|
||||
for (int i = 0; i < _c_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _c_auras.get(i); \
|
||||
ad->get_aura()->func(ad, __VA_ARGS__); \
|
||||
} \
|
||||
\
|
||||
emit_signal(signal, this, __VA_ARGS__);
|
||||
|
||||
#define NOTIFICATION_IMPLCS(func, signal) \
|
||||
if (_c_entity_data.is_valid()) \
|
||||
_c_entity_data->func(this); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func); \
|
||||
\
|
||||
@ -102,24 +96,21 @@ SOFTWARE.
|
||||
\
|
||||
emit_signal(signal, this);
|
||||
|
||||
#define NOTIFICATION_RES_IMPLS(func, signal, ...) \
|
||||
if (_s_entity_data.is_valid()) \
|
||||
_s_entity_data->func(__VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, __VA_ARGS__); \
|
||||
\
|
||||
for (int i = 0; i < _s_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _s_auras.get(i); \
|
||||
ad->get_aura()->func(ad, __VA_ARGS__); \
|
||||
} \
|
||||
\
|
||||
#define NOTIFICATION_RES_IMPLS(func, signal, ...) \
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) \
|
||||
_s_ai->func(__VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, __VA_ARGS__); \
|
||||
\
|
||||
for (int i = 0; i < _s_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _s_auras.get(i); \
|
||||
ad->get_aura()->func(ad, __VA_ARGS__); \
|
||||
} \
|
||||
\
|
||||
emit_signal(signal, __VA_ARGS__);
|
||||
|
||||
#define NOTIFICATION_RES_IMPLC(func, signal, ...) \
|
||||
if (_c_entity_data.is_valid()) \
|
||||
_c_entity_data->func(__VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, __VA_ARGS__); \
|
||||
\
|
||||
@ -130,24 +121,21 @@ SOFTWARE.
|
||||
\
|
||||
emit_signal(signal, __VA_ARGS__);
|
||||
|
||||
#define NOTIFICATION_AURA_IMPLS(func, signal, what, ...) \
|
||||
if (_s_entity_data.is_valid()) \
|
||||
_s_entity_data->func(what, __VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, what, __VA_ARGS__); \
|
||||
\
|
||||
for (int i = 0; i < _s_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _s_auras.get(i); \
|
||||
ad->get_aura()->func(what, ad, __VA_ARGS__); \
|
||||
} \
|
||||
\
|
||||
#define NOTIFICATION_AURA_IMPLS(func, signal, what, ...) \
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) \
|
||||
_s_ai->func(what, __VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, what, __VA_ARGS__); \
|
||||
\
|
||||
for (int i = 0; i < _s_auras.size(); ++i) { \
|
||||
Ref<AuraData> ad = _s_auras.get(i); \
|
||||
ad->get_aura()->func(what, ad, __VA_ARGS__); \
|
||||
} \
|
||||
\
|
||||
emit_signal(signal, what, __VA_ARGS__);
|
||||
|
||||
#define NOTIFICATION_AURA_IMPLC(func, signal, what, ...) \
|
||||
if (_c_entity_data.is_valid()) \
|
||||
_c_entity_data->func(what, __VA_ARGS__); \
|
||||
\
|
||||
if (has_method("_" #func)) \
|
||||
call("_" #func, what, __VA_ARGS__); \
|
||||
\
|
||||
@ -2108,8 +2096,8 @@ void Entity::creceive_stat(int id, int ccurrent) {
|
||||
//// Equip Slots ////
|
||||
|
||||
bool Entity::equip_should_deny(int equip_slot, Ref<ItemInstance> item) {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
if (_s_entity_data->equip_should_deny(this, equip_slot, item))
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
if (_s_ai->equip_should_deny(this, equip_slot, item))
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2128,8 +2116,8 @@ bool Entity::equip_should_deny(int equip_slot, Ref<ItemInstance> item) {
|
||||
}
|
||||
|
||||
void Entity::equip_son_success(int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->equip_son_success(this, equip_slot, item, old_item, bag_slot);
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
_s_ai->equip_son_success(this, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _s_auras.size(); ++i) {
|
||||
@ -2145,8 +2133,8 @@ void Entity::equip_son_success(int equip_slot, Ref<ItemInstance> item, Ref<ItemI
|
||||
}
|
||||
|
||||
void Entity::equip_son_fail(int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->equip_son_fail(this, equip_slot, item, old_item, bag_slot);
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
_s_ai->equip_son_fail(this, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _s_auras.size(); ++i) {
|
||||
@ -2162,8 +2150,8 @@ void Entity::equip_son_fail(int equip_slot, Ref<ItemInstance> item, Ref<ItemInst
|
||||
}
|
||||
|
||||
void Entity::equip_con_success(int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->equip_con_success(this, equip_slot, item, old_item, bag_slot);
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
_s_ai->equip_con_success(this, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
@ -2179,8 +2167,8 @@ void Entity::equip_con_success(int equip_slot, Ref<ItemInstance> item, Ref<ItemI
|
||||
}
|
||||
|
||||
void Entity::equip_con_fail(int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->equip_con_fail(this, equip_slot, item, old_item, bag_slot);
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
_s_ai->equip_con_fail(this, equip_slot, item, old_item, bag_slot);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
@ -2853,12 +2841,20 @@ void Entity::levelup_ccharacter(int value) {
|
||||
//// Spell System ////
|
||||
|
||||
void Entity::spell_casts(int spell_id) {
|
||||
Ref<EntityData> cc = gets_entity_data();
|
||||
|
||||
if (!cc.is_valid())
|
||||
if (_s_spells.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
cc->start_casting(spell_id, this, 1);
|
||||
for (int i = 0; i < _s_spells.size(); i++) {
|
||||
Ref<Spell> s = _s_spells[i];
|
||||
|
||||
ERR_CONTINUE(!s.is_valid());
|
||||
|
||||
if (s->get_id() == spell_id) {
|
||||
s->cast_starts_simple(this, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::spell_crequest_cast(int spell_id) {
|
||||
@ -2978,8 +2974,8 @@ void Entity::sapply_passives_heal_deal(Ref<SpellHealInfo> info) {
|
||||
void Entity::notification_saura(int what, Ref<AuraData> data) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->notification_saura(what, data);
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
_s_ai->notification_saura(what, data);
|
||||
}
|
||||
|
||||
if (has_method("_notification_saura"))
|
||||
@ -2996,8 +2992,8 @@ void Entity::notification_saura(int what, Ref<AuraData> data) {
|
||||
void Entity::notification_sheal(int what, Ref<SpellHealInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->notification_sheal(what, info);
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
_s_ai->notification_sheal(what, info);
|
||||
}
|
||||
|
||||
if (has_method("_notification_sheal"))
|
||||
@ -3017,8 +3013,8 @@ void Entity::notification_scast(int what, Ref<SpellCastInfo> info) {
|
||||
void Entity::notification_sdamage(int what, Ref<SpellDamageInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->notification_sdamage(what, info);
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
_s_ai->notification_sdamage(what, info);
|
||||
}
|
||||
|
||||
if (has_method("_notification_sdamage"))
|
||||
@ -3032,8 +3028,8 @@ void Entity::notification_sdamage(int what, Ref<SpellDamageInfo> info) {
|
||||
}
|
||||
|
||||
void Entity::notification_sdeath() {
|
||||
if (_s_entity_data.is_valid()) {
|
||||
_s_entity_data->notification_sdeath(this);
|
||||
if (_s_entity_controller == EntityEnums::ENITIY_CONTROLLER_AI && _s_ai.is_valid()) {
|
||||
_s_ai->notification_sdeath(this);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _s_auras.size(); ++i) {
|
||||
@ -3476,10 +3472,6 @@ void Entity::notification_caura(int what, Ref<AuraData> data) {
|
||||
|
||||
//NOTIFICATION_RES_IMPLC(notification_caura, "notification_caura", what, data);
|
||||
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->notification_caura(what, data);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _c_auras.get(i);
|
||||
|
||||
@ -3494,10 +3486,6 @@ void Entity::notification_caura(int what, Ref<AuraData> data) {
|
||||
void Entity::notification_cheal(int what, Ref<SpellHealInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->notification_cheal(what, info);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _c_auras.get(i);
|
||||
|
||||
@ -3515,10 +3503,6 @@ void Entity::notification_ccast(int what, Ref<SpellCastInfo> info) {
|
||||
|
||||
info->get_spell()->notification_ccast(what, info);
|
||||
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->notification_ccast(what, info);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _c_auras.get(i);
|
||||
|
||||
@ -3533,10 +3517,6 @@ void Entity::notification_ccast(int what, Ref<SpellCastInfo> info) {
|
||||
void Entity::notification_cdamage(int what, Ref<SpellDamageInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (_c_entity_data.is_valid()) {
|
||||
_c_entity_data->notification_cdamage(what, info);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _c_auras.size(); ++i) {
|
||||
Ref<AuraData> ad = _c_auras.get(i);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user