diff --git a/loader/include/Geode/loader/ModMetadata.hpp b/loader/include/Geode/loader/ModMetadata.hpp index f3671c90..bcb7d050 100644 --- a/loader/include/Geode/loader/ModMetadata.hpp +++ b/loader/include/Geode/loader/ModMetadata.hpp @@ -185,6 +185,10 @@ namespace geode { * @note Not a map because insertion order must be preserved */ [[nodiscard]] std::vector> getSettings() const; + /** + * Get the tags for this mod + */ + [[nodiscard]] std::unordered_set getTags() const; /** * Whether this mod has to be loaded before the loading screen or not */ @@ -229,6 +233,7 @@ namespace geode { void setIncompatibilities(std::vector const& value); void setSpritesheets(std::vector const& value); void setSettings(std::vector> const& value); + void setTags(std::unordered_set const& value); void setNeedsEarlyLoad(bool const& value); void setIsAPI(bool const& value); ModMetadataLinks& getLinksMut(); diff --git a/loader/src/loader/ModMetadataImpl.cpp b/loader/src/loader/ModMetadataImpl.cpp index 1582ff1e..c9eb4432 100644 --- a/loader/src/loader/ModMetadataImpl.cpp +++ b/loader/src/loader/ModMetadataImpl.cpp @@ -161,9 +161,6 @@ Result ModMetadata::Impl::createFromSchemaV010(ModJson const& rawJs return Err("[mod.json] is missing target GD version"); } - // don't think its used locally yet - root.addKnownKey("tags"); - root.needs("id") // todo: make this use validateID in full 2.0.0 release .validate(MiniFunction(&ModMetadata::Impl::validateOldID)) @@ -290,6 +287,11 @@ Result ModMetadata::Impl::createFromSchemaV010(ModJson const& rawJs // do not check unknown for future compat } + // Tags. Actual validation is done when interacting with the server in the UI + for (auto& tag : root.has("tags").iterate()) { + impl->m_tags.insert(tag.template get()); + } + // with new cli, binary name is always mod id impl->m_binaryName = impl->m_id + GEODE_PLATFORM_EXTENSION; @@ -531,6 +533,9 @@ std::vector ModMetadata::getSpritesheets() const { std::vector> ModMetadata::getSettings() const { return m_impl->m_settings; } +std::unordered_set ModMetadata::getTags() const { + return m_impl->m_tags; +} bool ModMetadata::needsEarlyLoad() const { return m_impl->m_needsEarlyLoad; } @@ -614,6 +619,9 @@ void ModMetadata::setSpritesheets(std::vector const& value) { void ModMetadata::setSettings(std::vector> const& value) { m_impl->m_settings = value; } +void ModMetadata::setTags(std::unordered_set const& value) { + m_impl->m_tags = value; +} void ModMetadata::setNeedsEarlyLoad(bool const& value) { m_impl->m_needsEarlyLoad = value; } diff --git a/loader/src/loader/ModMetadataImpl.hpp b/loader/src/loader/ModMetadataImpl.hpp index ed9c34aa..189df6a8 100644 --- a/loader/src/loader/ModMetadataImpl.hpp +++ b/loader/src/loader/ModMetadataImpl.hpp @@ -35,6 +35,7 @@ namespace geode { std::vector m_incompatibilities; std::vector m_spritesheets; std::vector> m_settings; + std::unordered_set m_tags; bool m_needsEarlyLoad = false; bool m_isAPI = false;