diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1f6669..a3305c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,6 @@ jobs: with: bindings: hiimjustin000/bindings bindings-ref: ccdictionary - sdk: nightly build-config: ${{ matrix.config.build-config || 'Release' }} export-pdb: true combine: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 7532f5a..510a05a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64") set(CMAKE_CXX_VISIBILITY_PRESET hidden) -project(MoreIcons VERSION 1.4.3) +project(MoreIcons VERSION 1.4.4) add_library(${PROJECT_NAME} SHARED src/api/MoreIconsAPI.cpp diff --git a/README.md b/README.md index 24c9818..557bbb2 100644 --- a/README.md +++ b/README.md @@ -56,16 +56,21 @@ Here are some examples of how to support More Icons in your mod. ```cpp // Get the player's icon (The parameter is the gamemode or the gamemode plus "-dual" if Separate Dual Icons is enabled) Loader::get()->getLoadedMod("hiimjustin000.more_icons")->getSavedValue("icon"); + // Get the list of icons (The parameter is the gamemode plus the letter "s") Loader::get()->getLoadedMod("hiimjustin000.more_icons")->getSavedValue>("icons"); + // Change a SimplePlayer to a custom icon -DispatchEvent("hiimjustin000.more_icons/simple-player", simplePlayer, "my-icon", IconType::Icon).post(); +DispatchEvent("hiimjustin000.more_icons/simple-player", simplePlayer, "my-icon", IconType::Cube).post(); + // Change a GJRobotSprite to a custom icon -DispatchEvent("hiimjustin000.more_icons/robot-sprite", robotSprite, "my-icon").post(); // Determines the icon type -DispatchEvent("hiimjustin000.more_icons/robot-sprite", robotSprite, "my-icon", IconType::Robot).post(); +DispatchEvent("hiimjustin000.more_icons/robot-sprite", robotSprite, "my-icon").post(); // Determines the icon type + +DispatchEvent("hiimjustin000.more_icons/robot-sprite", robotSprite, "my-icon", IconType::Robot).post(); + // Change a PlayerObject to a custom icon -DispatchEvent("hiimjustin000.more_icons/player-object", playerObject, "my-icon").post(); // Determines the icon type -DispatchEvent("hiimjustin000.more_icons/player-object", playerObject, "my-icon", IconType::Icon).post(); +DispatchEvent("hiimjustin000.more_icons/player-object", playerObject, "my-icon").post(); // Determines the icon type +DispatchEvent("hiimjustin000.more_icons/player-object", playerObject, "my-icon", IconType::Cube).post(); ``` ## Credits diff --git a/changelog.md b/changelog.md index 17c847c..6bb67d8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # More Icons Changelog +## v1.4.4 (2024-11-02) +- Fixed events not working properly + ## v1.4.3 (2024-10-29) - Tweaked the icon kit functionality - Added user objects for custom icons diff --git a/mod.json b/mod.json index 68eb93c..f3cc368 100644 --- a/mod.json +++ b/mod.json @@ -1,11 +1,11 @@ { - "geode": "3.8.1", + "geode": "3.9.0", "gd": { "android": "2.206", "win": "2.206", "mac": "2.206" }, - "version": "v1.4.3", + "version": "v1.4.4", "id": "hiimjustin000.more_icons", "name": "More Icons", "developer": "hiimjustin000", diff --git a/src/MoreIcons.cpp b/src/MoreIcons.cpp index 8e05994..03f0619 100644 --- a/src/MoreIcons.cpp +++ b/src/MoreIcons.cpp @@ -3,11 +3,11 @@ using namespace geode::prelude; -using SimplePlayerFilter = DispatchFilter; -using RobotSpriteFilter = DispatchFilter; -using RobotSpriteTypeFilter = DispatchFilter; -using PlayerObjectFilter = DispatchFilter; -using PlayerObjectTypeFilter = DispatchFilter; +using SimplePlayerFilter = DispatchFilter; +using RobotSpriteFilter = DispatchFilter; +using RobotSpriteTypeFilter = DispatchFilter; +using PlayerObjectFilter = DispatchFilter; +using PlayerObjectTypeFilter = DispatchFilter; $execute { new EventListener(+[](SimplePlayer* player, const std::string& icon, IconType type) { diff --git a/src/MoreIcons.hpp b/src/MoreIcons.hpp index fae60ec..102be22 100644 --- a/src/MoreIcons.hpp +++ b/src/MoreIcons.hpp @@ -238,6 +238,11 @@ class MoreIcons { return name; } + static SimplePlayer* findPlayer(cocos2d::CCNode* node) { + if (!node) return nullptr; + return geode::cocos::findFirstChildRecursive(node, [](auto) { return true; }); + } + static std::vector getPage(IconType type, int page) { auto& vec = MoreIconsAPI::vectorForType(type); auto customPage = page - (GameManager::get()->countForType(type) + 35) / 36; diff --git a/src/hooks/GJGarageLayer.cpp b/src/hooks/GJGarageLayer.cpp index e5ee59c..94147d0 100644 --- a/src/hooks/GJGarageLayer.cpp +++ b/src/hooks/GJGarageLayer.cpp @@ -348,12 +348,12 @@ class $modify(MIGarageLayer, GJGarageLayer) { } auto unlockType = GameManager::get()->iconTypeToUnlockType(m_iconType); auto popup = ItemInfoPopup::create(iconID, unlockType); - if (auto nameLabel = getChildOfType(popup->m_mainLayer, 0)) + if (auto nameLabel = popup->m_mainLayer->getChildByType(0)) nameLabel->setString(name.substr(name.find_first_of(':') + 1).c_str()); - if (auto achLabel = getChildOfType(popup->m_mainLayer, 1)) achLabel->setString("Custom"); + if (auto achLabel = popup->m_mainLayer->getChildByType(1)) achLabel->setString("Custom"); if (auto popupIcon = findFirstChildRecursive(popup->m_mainLayer, [](auto) { return true; })) MoreIconsAPI::updateSimplePlayer(popupIcon->m_player, name, m_iconType); - if (auto descText = getChildOfType