#pragma once #include "StarAiTypes.hpp" #include "StarUuid.hpp" #include "StarDrawable.hpp" #include "StarLuaComponents.hpp" #include "StarWorld.hpp" namespace Star { STAR_CLASS(Companion); STAR_CLASS(PlayerCompanions); class Companion { public: Companion(Json const& json); Json toJson() const; Uuid podUuid() const; Maybe name() const; Maybe description() const; List portrait() const; Maybe resource(String const& resourceName) const; Maybe resourceMax(String const& resourceName) const; Maybe stat(String const& statName) const; private: Json m_json; List m_portrait; }; class PlayerCompanions { public: PlayerCompanions(Json const& config); void diskLoad(Json const& diskStore); Json diskStore() const; List getCompanions(String const& category) const; void init(Entity* player, World* world); void uninit(); void dismissCompanion(String const& category, Uuid const& podUuid); Maybe receiveMessage(String const& message, bool localMessage, JsonArray const& args = {}); void update(float dt); private: LuaCallbacks makeCompanionsCallbacks(); World* m_world; Json m_config; StringMap> m_companions; LuaMessageHandlingComponent>>> m_scriptComponent; }; }