Update variables demo and small fixes
This commit is contained in:
parent
2795c6dcf2
commit
afe210b014
|
@ -72,6 +72,7 @@ Variant BBParam::get_value(Object *p_agent, const Ref<Blackboard> &p_blackboard,
|
|||
if (value_source == SAVED_VALUE) {
|
||||
return saved_value;
|
||||
} else {
|
||||
ERR_FAIL_COND_V_MSG(!p_blackboard->has_var(variable), Variant(), vformat("BBParam: Blackboard variable doesn't exist: \"%s\".", p_default));
|
||||
return p_blackboard->get_var(variable, p_default);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ void BBParam::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_type"), &BBParam::get_type);
|
||||
ClassDB::bind_method(D_METHOD("get_value", "p_agent", "p_blackboard", "p_default"), &BBParam::get_value, Variant());
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "value_source", PROPERTY_HINT_ENUM, "Saved Value, Blackboard Var"), "set_value_source", "get_value_source");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "value_source", PROPERTY_HINT_ENUM, "Saved Value,Blackboard Var"), "set_value_source", "get_value_source");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "variable", PROPERTY_HINT_NONE, "", 0), "set_variable", "get_variable");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::NIL, "saved_value", PROPERTY_HINT_NONE, "", 0), "set_saved_value", "get_saved_value");
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ String BTSetVar::_generate_name() const {
|
|||
if (variable.is_empty()) {
|
||||
return "SetVar ???";
|
||||
}
|
||||
return vformat("SetVar %s = %s", LimboUtility::get_singleton()->decorate_var(variable),
|
||||
return vformat("Set %s = %s", LimboUtility::get_singleton()->decorate_var(variable),
|
||||
value.is_valid() ? Variant(value) : Variant("???"));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,34 @@
|
|||
[gd_resource type="BehaviorTree" load_steps=6 format=3 uid="uid://cvm3gqes75f53"]
|
||||
[gd_resource type="BehaviorTree" load_steps=13 format=3 uid="uid://cvm3gqes75f53"]
|
||||
|
||||
[sub_resource type="BBVariant" id="BBVariant_t70f2"]
|
||||
resource_name = "false"
|
||||
saved_value = false
|
||||
type = 1
|
||||
|
||||
[sub_resource type="BTSetVar" id="BTSetVar_nxwdg"]
|
||||
variable = "triggered"
|
||||
value = SubResource("BBVariant_t70f2")
|
||||
|
||||
[sub_resource type="BTRunLimit" id="BTRunLimit_mlytb"]
|
||||
children = [SubResource("BTSetVar_nxwdg")]
|
||||
|
||||
[sub_resource type="BBVariant" id="BBVariant_8bpg1"]
|
||||
resource_name = "false"
|
||||
saved_value = false
|
||||
type = 1
|
||||
|
||||
[sub_resource type="BTCheckVar" id="BTCheckVar_g5b0s"]
|
||||
variable = "triggered"
|
||||
value = SubResource("BBVariant_8bpg1")
|
||||
|
||||
[sub_resource type="BBVariant" id="BBVariant_loenl"]
|
||||
resource_name = "true"
|
||||
saved_value = true
|
||||
type = 1
|
||||
|
||||
[sub_resource type="BTSetVar" id="BTSetVar_u051c"]
|
||||
variable = "triggered"
|
||||
value = SubResource("BBVariant_loenl")
|
||||
|
||||
[sub_resource type="BBVariant" id="BBVariant_cu1uc"]
|
||||
resource_name = "Hello, World!"
|
||||
|
@ -14,10 +44,10 @@ text = "Message is: %s"
|
|||
bb_format_parameters = PackedStringArray("message")
|
||||
|
||||
[sub_resource type="BTSequence" id="BTSequence_bhar3"]
|
||||
children = [SubResource("BTSetVar_2e0uw"), SubResource("BTConsolePrint_533ui")]
|
||||
children = [SubResource("BTCheckVar_g5b0s"), SubResource("BTSetVar_u051c"), SubResource("BTSetVar_2e0uw"), SubResource("BTConsolePrint_533ui")]
|
||||
|
||||
[sub_resource type="BTRunLimit" id="BTRunLimit_hv3vu"]
|
||||
children = [SubResource("BTSequence_bhar3")]
|
||||
[sub_resource type="BTSelector" id="BTSelector_ndrjh"]
|
||||
children = [SubResource("BTRunLimit_mlytb"), SubResource("BTSequence_bhar3")]
|
||||
|
||||
[resource]
|
||||
root_task = SubResource("BTRunLimit_hv3vu")
|
||||
root_task = SubResource("BTSelector_ndrjh")
|
||||
|
|
Loading…
Reference in New Issue