From da845cb9dfb0436657df330d4d46e9f92c48ec4d Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 25 Apr 2020 19:02:17 +0200 Subject: [PATCH] Add stat_is_property to ESS. --- singletons/ess.cpp | 4 ++++ singletons/ess.h | 1 + 2 files changed, 5 insertions(+) diff --git a/singletons/ess.cpp b/singletons/ess.cpp index a1dc765..ad91fa0 100644 --- a/singletons/ess.cpp +++ b/singletons/ess.cpp @@ -232,6 +232,9 @@ StringName ESS::stat_get_property_name(const int id) const { return _stat_id_to_property[id]; } +bool ESS::stat_is_property(const StringName &name) const { + return _stat_property_to_id.has(name); +} int ESS::stat_get_count() const { return _stat_id_to_name.size(); @@ -361,6 +364,7 @@ void ESS::_bind_methods() { ClassDB::bind_method(D_METHOD("stat_get_property_id", "name"), &ESS::stat_get_property_id); ClassDB::bind_method(D_METHOD("stat_get_property_name", "id"), &ESS::stat_get_property_name); + ClassDB::bind_method(D_METHOD("stat_is_property", "name"), &ESS::stat_is_property); ClassDB::bind_method(D_METHOD("stat_get_count"), &ESS::stat_get_count); diff --git a/singletons/ess.h b/singletons/ess.h index fb86b23..dd80ff1 100644 --- a/singletons/ess.h +++ b/singletons/ess.h @@ -102,6 +102,7 @@ public: int stat_get_property_id(const StringName &name) const; StringName stat_get_property_name(const int id) const; + bool stat_is_property(const StringName &name) const; int stat_get_count() const;