Skip to content

Commit b0ae2f6

Browse files
committed
feat(main): Added possibility to disable notifications inside platformer levels
1 parent f7c5bec commit b0ae2f6

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
runs-on: ${{ matrix.config.os }}
3232

3333
steps:
34-
- uses: actions/checkout@v3
34+
- uses: actions/checkout@v4
3535
with:
3636
submodules: 'recursive'
3737

mod.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@
7979
"type": "bool",
8080
"default": true
8181
},
82+
"inPlatformers": {
83+
"name": "In Platformers",
84+
"description": "If notifications should be shown when playing platformers levels.",
85+
"type": "bool",
86+
"default": true
87+
},
8288
"newRate": {
8389
"name": "New Rates",
8490
"description": "Whether or not to notify about new <cy>Rated Levels</c>",

src/main.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,17 @@ class $modify(CCScheduler) { // used to be GameManager
189189
bool everywhereElse = Mod::get()->template getSettingValue<bool>("everywhereElse");
190190
bool inLevels = Mod::get()->template getSettingValue<bool>("inLevels");
191191
bool inEditor = Mod::get()->template getSettingValue<bool>("inEditor");
192+
bool inPlatformers = Mod::get()->template getSettingValue<bool>("inPlatformers");
192193

193194
bool pushEvent = true;
194-
if (layerName == "PlayLayer" && !inLevels) {
195-
pushEvent = false;
195+
if (layerName == "PlayLayer") {
196+
if (!inLevels) pushEvent = false;
197+
198+
PlayLayer* playLayer = reinterpret_cast<PlayLayer*>(layer);
199+
GJGameLevel* level = playLayer->m_level;
200+
if (level->isPlatformer() && !inPlatformers) {
201+
pushEvent = false;
202+
}
196203
}
197204
if (layerName == "LevelEditorLayer" && !inEditor) {
198205
pushEvent = false;

0 commit comments

Comments
 (0)