Temporarily added back start_casting into EntityClassData.

This commit is contained in:
Relintai 2020-06-13 23:17:03 +02:00
parent 316d75d344
commit a1a4a9c7d2
3 changed files with 24 additions and 2 deletions

View File

@ -294,6 +294,26 @@ 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;

View File

@ -135,6 +135,8 @@ public:
void setup_resources(Entity *entity);
void _setup_resources(Node *entity);
void start_casting(int spell_id, Entity *caster, float spellScale);
EntityClassData();
~EntityClassData();

View File

@ -331,8 +331,8 @@ void EntityData::sinteract_bind(Node *entity) {
}
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);
if (_entity_class_data.is_valid())
_entity_class_data->start_casting(spell_id, caster, spellScale);
}
void EntityData::notification_saura(int what, Ref<AuraData> data) {