-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/geode-sdk/NodeIDs
- Loading branch information
Showing
2 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
}; |