Skip to content

Commit 825c9ce

Browse files
Initial Commit (v0.0.1 and v0.0.2
0 parents  commit 825c9ce

7 files changed

Lines changed: 118 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cmake_minimum_required(VERSION 3.21)
2+
set(CMAKE_CXX_STANDARD 23)
3+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
4+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
5+
set(CMAKE_OSX_ARCHITECTURES "arm64")
6+
else()
7+
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
8+
endif()
9+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
10+
11+
project(LevelLockout VERSION 1.0.0)
12+
13+
# Add all source files inside src (recursively)
14+
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.cpp)
15+
16+
# Set up the mod binary
17+
add_library(${PROJECT_NAME} SHARED ${SOURCES})
18+
19+
if (NOT DEFINED ENV{GEODE_SDK})
20+
message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode")
21+
else()
22+
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
23+
endif()
24+
25+
add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)
26+
27+
# Set up dependencies, resources, and link Geode.
28+
setup_geode_mod(${PROJECT_NAME})

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# LevelLockout
2+
I tried
3+
4+
<img src="logo.png" width="150" alt="the mod's logo" />

about.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 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)

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 0.0.1
2+
- Started work on the mod

logo.png

24.9 KB
Loading

mod.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"geode": "5.0.0-beta.2",
3+
"gd": {
4+
"win": "2.2081",
5+
"android": "2.2081",
6+
"mac": "2.2081",
7+
"ios": "2.2081"
8+
},
9+
"id": "jamiexists.levellockout",
10+
"name": "LevelLockout",
11+
"version": "v0.0.2",
12+
"developer": "JamiExists",
13+
"description": "When you die, it locks you out of all the levels... until you restart the game! (for now)",
14+
"dependencies": {
15+
"geode.node-ids": ">=v1.22.0"
16+
}
17+
}

src/main.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* Include the Geode headers.
3+
*/
4+
#include <Geode/Geode.hpp>
5+
#include <Geode/binding/PlatformToolbox.hpp>
6+
/**
7+
* Brings cocos2d and all Geode namespaces to the current scope.
8+
*/
9+
using namespace geode::prelude;
10+
static bool g_levelLocked = false;
11+
#include <Geode/modify/PlayerObject.hpp>
12+
#include <Geode/modify/PlayLayer.hpp>
13+
#include <Geode/modify/GameStatsManager.hpp>
14+
class $modify(MyPlayerObject, PlayerObject) {
15+
void playerDestroyed(bool p0) {
16+
PlayerObject::playerDestroyed(p0);
17+
18+
g_levelLocked = true;
19+
20+
auto playLayer = PlayLayer::get();
21+
if (playLayer) {
22+
playLayer->removeFromParentAndCleanup(true);
23+
CCDirector::sharedDirector()->replaceScene(MenuLayer::scene(false));
24+
PlatformToolbox::showCursor();
25+
PlatformToolbox::toggleLockCursor(false);
26+
}
27+
}
28+
};
29+
#include <Geode/modify/MenuLayer.hpp>
30+
class $modify(MyMenuLayer, MenuLayer) {
31+
32+
bool init() {
33+
if (!MenuLayer::init())
34+
return false;
35+
36+
if (g_levelLocked) {
37+
auto menu = this->getChildByID("main-menu");
38+
auto createmenu = this->getChildByID("main-menu");
39+
if (menu) {
40+
auto playBtn = menu->getChildByID("play-button");
41+
auto createBtn = menu->getChildByID("editor-button");
42+
if (playBtn) {
43+
playBtn->setVisible(false);
44+
menu->updateLayout(true);
45+
}
46+
if (createBtn) {
47+
createBtn->setVisible(false);
48+
menu->updateLayout(true);
49+
}
50+
}
51+
}
52+
53+
return true;
54+
}
55+
};
56+
class $modify(MyStatsManager, GameStatsManager) {
57+
58+
bool init() {
59+
if (!GameStatsManager::init()) {
60+
return false;
61+
}
62+
GameStatsManager::setAwardedBonusKeys(100000);
63+
return true;
64+
}
65+
};

0 commit comments

Comments
 (0)