Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/geode-sdk/NodeIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Feb 4, 2024
2 parents 246940e + eb416d1 commit 8cc7474
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
branches:
- '**'
- "**"

jobs:
build:
Expand All @@ -14,26 +14,28 @@ jobs:
config:
- name: Windows
os: windows-latest
target: Win32

- name: macOS
os: macos-latest

- name: Android32
os: ubuntu-latest
target: Android32

- name: Android64
os: ubuntu-latest
target: Android64


name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build the mod
uses: geode-sdk/build-geode-mod@main
with:
combine: true
sdk: nightly
target: ${{ matrix.config.target }}

package:
Expand All @@ -42,7 +44,7 @@ jobs:
needs: ['build']

steps:
- uses: geode-sdk/build-geode-mod@combine
- uses: geode-sdk/build-geode-mod/combine@main
id: build

- uses: actions/upload-artifact@v3
Expand Down
69 changes: 69 additions & 0 deletions src/PlayerObject.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// #include "AddIDs.hpp"

#include <Geode/Bindings.hpp>
#include <Geode/modify/PlayerObject.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/NodeIDs.hpp>

using namespace geode::prelude;
using namespace geode::node_ids;

$register_ids(PlayerObject) {
if(auto layer = setIDSafe(this, 0, "main-layer")) {
setIDs(
layer,
0,
"gamemode-frame",
"ship-frame",
"robot-boost",
"swing-top-boost",
"swing-middle-boost",
"swing-bottom-boost",
"glow-frame",
"other-gamemode"
);

if(auto gamemodeFrame = layer->getChildByID("gamemode-frame")) {
setIDs(
gamemodeFrame,
0,
"secondary-frame",
"highlights-frame"
);
}

if(auto shipFrame = layer->getChildByID("ship-frame")) {
setIDs(
shipFrame,
0,
"secondary-frame"
);
}

if(auto glowFrame = layer->getChildByID("glow-frame")) {
setIDs(
glowFrame,
0,
"dash-frame",
"gamemode-glow",
"ship-glow"
);
}
}
}

struct PlayerObjectIDs : Modify<PlayerObjectIDs, PlayerObject> {
static void onModify(auto& self) {
if (!self.setHookPriority("PlayerObject::init", GEODE_ID_PRIORITY)) {
log::warn("Failed to set PlayerObject::init hook priority, node IDs may not work properly");
}
}

bool init(int p0, int p1, GJBaseGameLayer* p2, cocos2d::CCLayer* p3, bool p4) {
if (!PlayerObject::init(p0, p1, p2, p3, p4)) return false;

NodeIDs::get()->provide(this);

return true;
}
};

0 comments on commit 8cc7474

Please sign in to comment.