Fix warning at start.

This commit is contained in:
Relintai 2019-10-29 15:18:08 +01:00
parent d410497b71
commit 07d81d63a9
2 changed files with 7 additions and 3 deletions

View File

@ -88,7 +88,9 @@ void AuraData::set_caster(Entity *value) {
return; return;
} }
_caster_path = _caster->get_path(); if (_caster->is_inside_tree()) {
_caster_path = _caster->get_path();
}
} }
void AuraData::set_caster_bind(Node *value) { void AuraData::set_caster_bind(Node *value) {

View File

@ -148,8 +148,10 @@ void SpellCastInfo::from_dict(Node *owner, const Dictionary &dict) {
ERR_FAIL_COND(!ObjectDB::instance_validate(owner)); ERR_FAIL_COND(!ObjectDB::instance_validate(owner));
ERR_FAIL_COND(dict.empty()); ERR_FAIL_COND(dict.empty());
_caster = Object::cast_to<Entity>(owner->get_node_or_null(dict.get("caster", ""))); if (owner->is_inside_tree()) {
_target = Object::cast_to<Entity>(owner->get_node_or_null(dict.get("target", ""))); _caster = Object::cast_to<Entity>(owner->get_node_or_null(dict.get("caster", "")));
_target = Object::cast_to<Entity>(owner->get_node_or_null(dict.get("target", "")));
}
_has_cast_time = dict.get("has_cast_time", true); _has_cast_time = dict.get("has_cast_time", true);
_cast_time = dict.get("cast_time", 0); _cast_time = dict.get("cast_time", 0);