diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-10 19:24:46 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-10 19:24:46 +0100 |
commit | 4414fe5079b44d5bbcbba89bb1e71ce01b949226 (patch) | |
tree | bba8287de88f5eeca992f000ee425c067d616ce0 /src/crepe/api/Script.hpp | |
parent | 1e5c6c5cf0d1be976e0e59099ddcfc62940ef1be (diff) | |
parent | 0cb7f2f82ca167656b3c5cb9f0cc3b44c59cb0eb (diff) |
merge master
Diffstat (limited to 'src/crepe/api/Script.hpp')
-rw-r--r-- | src/crepe/api/Script.hpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/crepe/api/Script.hpp b/src/crepe/api/Script.hpp index 23d69d9..225a51c 100644 --- a/src/crepe/api/Script.hpp +++ b/src/crepe/api/Script.hpp @@ -20,9 +20,7 @@ T & Script::get_component() const { template <typename T> RefVector<T> Script::get_components() const { - ComponentManager & mgr = this->mediator->component_manager; - - return mgr.get_components_by_id<T>(this->game_object_id); + return this->get_components_by_id<T>(this->game_object_id); } template <typename... Args> @@ -54,4 +52,26 @@ void Script::subscribe(const EventHandler<EventType> & callback) { this->subscribe_internal(callback, EventManager::CHANNEL_ALL); } +template <typename T> +RefVector<T> Script::get_components_by_id(game_object_id_t id) const { + Mediator & mediator = this->mediator; + ComponentManager & mgr = mediator.component_manager; + + return mgr.get_components_by_id<T>(id); +} +template <typename T> +RefVector<T> Script::get_components_by_name(const std::string & name) const { + Mediator & mediator = this->mediator; + ComponentManager & mgr = mediator.component_manager; + + return mgr.get_components_by_name<T>(name); +} +template <typename T> +RefVector<T> Script::get_components_by_tag(const std::string & tag) const { + Mediator & mediator = this->mediator; + ComponentManager & mgr = mediator.component_manager; + + return mgr.get_components_by_tag<T>(tag); +} + } // namespace crepe |