Fix BTSetAgentProperty wrong error message
This commit is contained in:
parent
029abbfc08
commit
198954e45f
|
@ -48,9 +48,13 @@ int BTSetAgentProperty::_tick(double p_delta) {
|
||||||
ERR_FAIL_COND_V_MSG(property == StringName(), FAILURE, "BTSetAgentProperty: `property` is not set.");
|
ERR_FAIL_COND_V_MSG(property == StringName(), FAILURE, "BTSetAgentProperty: `property` is not set.");
|
||||||
ERR_FAIL_COND_V_MSG(!value.is_valid(), FAILURE, "BTSetAgentProperty: `value` is not set.");
|
ERR_FAIL_COND_V_MSG(!value.is_valid(), FAILURE, "BTSetAgentProperty: `value` is not set.");
|
||||||
|
|
||||||
|
StringName error_value = SNAME("ErrorGettingValue");
|
||||||
|
Variant v = value->get_value(get_agent(), get_blackboard(), error_value);
|
||||||
|
ERR_FAIL_COND_V_MSG(v == Variant(error_value), FAILURE, "BTSetAgentProperty: Couldn't get value of value-parameter.");
|
||||||
|
|
||||||
bool r_valid;
|
bool r_valid;
|
||||||
get_agent()->set(property, value->get_value(get_agent(), get_blackboard()), &r_valid);
|
get_agent()->set(property, v, &r_valid);
|
||||||
ERR_FAIL_COND_V_MSG(!r_valid, FAILURE, vformat("BTSetAgentProperty: Agent doesn't have property named \"%s\"", property));
|
ERR_FAIL_COND_V_MSG(!r_valid, FAILURE, vformat("BTSetAgentProperty: Couldn't set property \"%s\" with value \"%s\"", property, v));
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue