Skip to content

Commit 26e58a5

Browse files
Yup, i improved it
1 parent 0ffa7f0 commit 26e58a5

3 files changed

Lines changed: 24 additions & 17 deletions

File tree

about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Some info about this mod
2-
This mod will lock you out of ALL levels if you die in any level :3 (Torture mod lol)
2+
This mod will lock you out of most levels if you die in any level :3 (Torture mod lol)

mod.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
"name": "LevelLockout",
1111
"version": "v0.0.2",
1212
"developer": "JamiExists",
13-
"description": "When you die, it locks you out of all the levels... until you restart the game! (for now)",
13+
"description": "When you die, it locks you out of custom levels... until you restart the game! (for now)",
1414
"dependencies": {
1515
"geode.node-ids": ">=v1.22.0"
16-
}
16+
},
17+
"tags": ["joke", "gameplay"]
1718
}

src/main.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,34 @@
66
/**
77
* Brings cocos2d and all Geode namespaces to the current scope.
88
*/
9+
910
using namespace geode::prelude;
1011
static bool g_levelLocked = false;
12+
int g_attemptcount = 0;
1113
#include <Geode/modify/PlayerObject.hpp>
1214
#include <Geode/modify/PlayLayer.hpp>
15+
#include <Geode/binding/LevelTools.hpp>
16+
#include <Geode/binding/GameManager.hpp>
1317
class $modify(MyPlayerObject, PlayerObject) {
1418
void playerDestroyed(bool p0) {
15-
PlayerObject::playerDestroyed(p0);
19+
auto gm = GameManager::get();
20+
auto playLayer = PlayLayer::get();
21+
if (g_attemptcount<=9) {
22+
log::debug("test");
23+
g_attemptcount++;
24+
} else {
25+
PlayerObject::playerDestroyed(p0);
1626

17-
g_levelLocked = true;
27+
g_levelLocked = true;
1828

19-
auto playLayer = PlayLayer::get();
20-
if (playLayer) {
21-
playLayer->removeFromParentAndCleanup(true);
22-
CCDirector::sharedDirector()->replaceScene(MenuLayer::scene(false));
23-
PlatformToolbox::showCursor();
24-
PlatformToolbox::toggleLockCursor(false);
25-
}
29+
if (playLayer) {
30+
playLayer->removeFromParentAndCleanup(true);
31+
CCDirector::sharedDirector()->replaceScene(MenuLayer::scene(false));
32+
PlatformToolbox::showCursor();
33+
PlatformToolbox::toggleLockCursor(false);
34+
g_attemptcount = 0;
35+
}
36+
}
2637
}
2738
};
2839
#include <Geode/modify/MenuLayer.hpp>
@@ -36,12 +47,7 @@ class $modify(MyMenuLayer, MenuLayer) {
3647
auto menu = this->getChildByID("main-menu");
3748
auto createmenu = this->getChildByID("main-menu");
3849
if (menu) {
39-
auto playBtn = menu->getChildByID("play-button");
4050
auto createBtn = menu->getChildByID("editor-button");
41-
if (playBtn) {
42-
playBtn->setVisible(false);
43-
menu->updateLayout(true);
44-
}
4551
if (createBtn) {
4652
createBtn->setVisible(false);
4753
menu->updateLayout(true);

0 commit comments

Comments
 (0)