File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # 1.0.0
1+ # 1.0.2
22- Initial release
Original file line number Diff line number Diff line change 88 },
99 "id" : " beat.afk_pause" ,
1010 "name" : " AFK Pause" ,
11- "version" : " v1.0.1 " ,
11+ "version" : " v1.0.2 " ,
1212 "developer" : " Beat" ,
1313 "description" : " Automatically pauses the level if you go AFK" ,
1414 "tags" : [
Original file line number Diff line number Diff line change 44
55using namespace geode ::prelude;
66
7- int afkDeaths = 1 ;
8-
9- class $modify(afkPlayerObject, PlayerObject) {
10- bool pushButton (PlayerButton p0) {
11- if (!PlayerObject::pushButton (p0) || !GameManager::sharedState ()->getPlayLayer ()) return false ;
12- afkDeaths = 1 ;
13- return true ;
14- }
15- };
16-
177class $modify(afkPlayLayer, PlayLayer) {
8+ struct Fields {
9+ int m_afkDeaths = 1 ;
10+ };
11+
1812 void resetLevel () {
1913 PlayLayer::resetLevel ();
2014
21- if (afkDeaths >= Mod::get ()->getSettingValue <int64_t >(" attempt-threshold" )) {
22- afkDeaths = 1 ;
15+ if (m_fields-> m_afkDeaths >= Mod::get ()->getSettingValue <int64_t >(" attempt-threshold" )) {
16+ m_fields-> m_afkDeaths = 1 ;
2317 if (Mod::get ()->getSettingValue <bool >(" enabled" )) {
2418 this ->pauseGame (false );
19+ Notification::create (" Game paused due to inactivity." , CCSprite::createWithSpriteFrameName (" GJ_infoIcon_001.png" ))->show ();
2520 }
2621 } else {
27- afkDeaths ++;
22+ m_fields-> m_afkDeaths ++;
2823 }
2924 return ;
3025 }
3126};
27+
28+ class $modify(afkPlayerObject, PlayerObject) {
29+ bool pushButton (PlayerButton p0) {
30+ if (auto playLayer = static_cast <afkPlayLayer*>(PlayLayer::get ())) {
31+ playLayer->m_fields ->m_afkDeaths = 1 ;
32+ }
33+ return PlayerObject::pushButton (p0);
34+ }
35+ };
You can’t perform that action at this time.
0 commit comments