diff --git a/src/goap/goal.cpp b/src/goap/goal.cpp index 99f35e2..2c96483 100644 --- a/src/goap/goal.cpp +++ b/src/goap/goal.cpp @@ -15,6 +15,15 @@ gd::Ref Goal::create(gd::StringName key, gd::Variant value) { return goal; } +bool Goal::check_requirements_met(ActorWorldState *world_state) { + for(WorldProperty const &prop : this->requirements) { + if(!world_state->check_property_match(prop)) { + return false; + } + } + return true; +} + void Goal::set_requirements_dict(gd::Dictionary dict) { this->requirements = utils::dictionary_to_hashmap(dict); } diff --git a/src/goap/goal.hpp b/src/goap/goal.hpp index 2a5023d..59204eb 100644 --- a/src/goap/goal.hpp +++ b/src/goap/goal.hpp @@ -12,6 +12,9 @@ class Goal : public gd::Resource { static void _bind_methods(); public: static gd::Ref create(gd::StringName key, gd::Variant value); + + bool check_requirements_met(ActorWorldState *world_state); + void set_requirements_dict(gd::Dictionary dict); gd::Dictionary get_requirements_dict() const; void set_desired_state_dict(gd::Dictionary dict);