feat: added Goal::check_requirements_met
This commit is contained in:
parent
aeeddb34c1
commit
1021920e1f
|
@ -15,6 +15,15 @@ gd::Ref<Goal> 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<gd::StringName, gd::Variant>(dict);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ class Goal : public gd::Resource {
|
|||
static void _bind_methods();
|
||||
public:
|
||||
static gd::Ref<Goal> 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);
|
||||
|
|
Loading…
Reference in a new issue