Fix bugs
This commit is contained in:
parent
a91a9ef9ed
commit
1bc8484454
|
@ -2,14 +2,28 @@
|
||||||
|
|
||||||
#include "bt_new_scope.h"
|
#include "bt_new_scope.h"
|
||||||
#include "core/error_macros.h"
|
#include "core/error_macros.h"
|
||||||
|
#include "core/os/memory.h"
|
||||||
#include "core/ustring.h"
|
#include "core/ustring.h"
|
||||||
|
#include "modules/limboai/blackboard.h"
|
||||||
|
|
||||||
void BTNewScope::initialize(Object *p_agent, const Ref<Blackboard> &p_blackboard) {
|
void BTNewScope::initialize(Object *p_agent, const Ref<Blackboard> &p_blackboard) {
|
||||||
ERR_FAIL_COND(p_agent == nullptr);
|
ERR_FAIL_COND(p_agent == nullptr);
|
||||||
ERR_FAIL_COND(p_blackboard == nullptr);
|
ERR_FAIL_COND(p_blackboard == nullptr);
|
||||||
|
|
||||||
Ref<Blackboard> bb = memnew(Blackboard);
|
Ref<Blackboard> bb = memnew(Blackboard);
|
||||||
|
|
||||||
|
// if (blackboard_data.empty()) {
|
||||||
|
// bb->set_parent_scope(p_blackboard);
|
||||||
|
// } else {
|
||||||
|
// Ref<Blackboard> ro = memnew(Blackboard);
|
||||||
|
// ro->set_data(blackboard_data);
|
||||||
|
// ro->set_parent_scope(p_blackboard);
|
||||||
|
// bb->set_parent_scope(ro);
|
||||||
|
// }
|
||||||
|
|
||||||
|
bb->set_data(blackboard_data.duplicate());
|
||||||
bb->set_parent_scope(p_blackboard);
|
bb->set_parent_scope(p_blackboard);
|
||||||
bb->set_data(blackboard_data);
|
|
||||||
BTDecorator::initialize(p_agent, bb);
|
BTDecorator::initialize(p_agent, bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -423,7 +423,7 @@ void TaskPanel::_populate_from_user_dir(String p_path, HashMap<String, List<Stri
|
||||||
dir->list_dir_begin();
|
dir->list_dir_begin();
|
||||||
String fn = dir->get_next();
|
String fn = dir->get_next();
|
||||||
while (!fn.empty()) {
|
while (!fn.empty()) {
|
||||||
if (dir->current_is_dir()) {
|
if (dir->current_is_dir() && fn != "..") {
|
||||||
String full_path;
|
String full_path;
|
||||||
String category;
|
String category;
|
||||||
if (fn == ".") {
|
if (fn == ".") {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* limbo_utility.cpp */
|
/* limbo_utility.cpp */
|
||||||
|
|
||||||
#include "limbo_utility.h"
|
#include "limbo_utility.h"
|
||||||
|
#include "bt/bt_task.h"
|
||||||
#include "core/variant.h"
|
#include "core/variant.h"
|
||||||
|
|
||||||
LimboUtility *LimboUtility::singleton = nullptr;
|
LimboUtility *LimboUtility::singleton = nullptr;
|
||||||
|
@ -9,7 +10,7 @@ LimboUtility *LimboUtility::get_singleton() {
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
String LimboUtility::decorate_var(String p_variable) {
|
String LimboUtility::decorate_var(String p_variable) const {
|
||||||
String var = p_variable.trim_prefix("$").trim_prefix("\"").trim_suffix("\"");
|
String var = p_variable.trim_prefix("$").trim_prefix("\"").trim_suffix("\"");
|
||||||
if (var.find(" ") == -1 and not var.empty()) {
|
if (var.find(" ") == -1 and not var.empty()) {
|
||||||
return vformat("$%s", var);
|
return vformat("$%s", var);
|
||||||
|
@ -18,8 +19,24 @@ String LimboUtility::decorate_var(String p_variable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String LimboUtility::get_status_name(int p_status) const {
|
||||||
|
switch (p_status) {
|
||||||
|
case BTTask::FRESH:
|
||||||
|
return "FRESH";
|
||||||
|
case BTTask::RUNNING:
|
||||||
|
return "RUNNING";
|
||||||
|
case BTTask::FAILURE:
|
||||||
|
return "FAILURE";
|
||||||
|
case BTTask::SUCCESS:
|
||||||
|
return "SUCCESS";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LimboUtility::_bind_methods() {
|
void LimboUtility::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("decorate_var", "p_variable"), &LimboUtility::decorate_var);
|
ClassDB::bind_method(D_METHOD("decorate_var", "p_variable"), &LimboUtility::decorate_var);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_status_name", "p_status"), &LimboUtility::get_status_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
LimboUtility::LimboUtility() {
|
LimboUtility::LimboUtility() {
|
||||||
|
|
|
@ -15,7 +15,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
static LimboUtility *get_singleton();
|
static LimboUtility *get_singleton();
|
||||||
|
|
||||||
String decorate_var(String p_variable);
|
String decorate_var(String p_variable) const;
|
||||||
|
String get_status_name(int p_status) const;
|
||||||
|
|
||||||
LimboUtility();
|
LimboUtility();
|
||||||
~LimboUtility();
|
~LimboUtility();
|
||||||
|
|
Loading…
Reference in New Issue