Expose agent and blackboard

This commit is contained in:
Serhii Snitsaruk 2022-10-19 23:39:27 +02:00
parent c6a9ea5948
commit bc0f0b61d1
2 changed files with 5 additions and 0 deletions

View File

@ -136,6 +136,7 @@ void LimboState::_notification(int p_what) {
void LimboState::_bind_methods() { void LimboState::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_root"), &LimboState::get_root); ClassDB::bind_method(D_METHOD("get_root"), &LimboState::get_root);
ClassDB::bind_method(D_METHOD("get_agent"), &LimboState::get_agent);
ClassDB::bind_method(D_METHOD("event_finished"), &LimboState::event_finished); ClassDB::bind_method(D_METHOD("event_finished"), &LimboState::event_finished);
ClassDB::bind_method(D_METHOD("is_active"), &LimboState::is_active); ClassDB::bind_method(D_METHOD("is_active"), &LimboState::is_active);
ClassDB::bind_method(D_METHOD("_setup"), &LimboState::_setup); ClassDB::bind_method(D_METHOD("_setup"), &LimboState::_setup);
@ -151,6 +152,7 @@ void LimboState::_bind_methods() {
ClassDB::bind_method(D_METHOD("call_on_update", "p_object", "p_method"), &LimboState::call_on_update); ClassDB::bind_method(D_METHOD("call_on_update", "p_object", "p_method"), &LimboState::call_on_update);
ClassDB::bind_method(D_METHOD("set_guard_func", "p_object", "p_func", "p_binds"), &LimboState::set_guard_func, Array()); ClassDB::bind_method(D_METHOD("set_guard_func", "p_object", "p_func", "p_binds"), &LimboState::set_guard_func, Array());
ClassDB::bind_method(D_METHOD("clear_guard_func"), &LimboState::clear_guard_func); ClassDB::bind_method(D_METHOD("clear_guard_func"), &LimboState::clear_guard_func);
ClassDB::bind_method(D_METHOD("get_blackboard"), &LimboState::get_blackboard);
BIND_VMETHOD(MethodInfo("_setup")); BIND_VMETHOD(MethodInfo("_setup"));
BIND_VMETHOD(MethodInfo("_enter")); BIND_VMETHOD(MethodInfo("_enter"));

View File

@ -46,6 +46,9 @@ protected:
public: public:
static const String EVENT_FINISHED; static const String EVENT_FINISHED;
Ref<Blackboard> get_blackboard() const { return blackboard; }
Object *get_agent() const { return agent; }
virtual void initialize(Object *p_agent, const Ref<Blackboard> &p_blackboard); virtual void initialize(Object *p_agent, const Ref<Blackboard> &p_blackboard);
virtual bool dispatch(const String &p_event, const Variant &p_cargo); virtual bool dispatch(const String &p_event, const Variant &p_cargo);