Skip to content

Commit f6fae21

Browse files
author
TheSillyDoggo
committed
update this dumb fucking mod
1 parent e21637a commit f6fae21

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 1.7.3
2+
3+
- Added new variables to labels
4+
- Wrote docs for labels that can be viewed with the (i) button the format page
5+
16
# 1.7.2
27

38
- Fixed memory leak while playing a level

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"geode": "3.8.1",
3-
"version": "v1.7.2",
3+
"version": "v1.7.3",
44
"gd": {
55
"win": "2.206",
66
"android": "2.206",

resources/label-help.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,24 @@ These are all the variables provided by QOLMod and what they do:
1919
**noclip_deaths** | How many times you've died in noclip
2020
**noclip_accuracy** | How much time you've spent dead with noclip on
2121

22+
**normal_best** | Your best percentage in normal mode
23+
**practice_best** | Your best percentage in practice mode
24+
25+
**level_name** | The name of the level
26+
**level_creator** | The name of the creator of the level
27+
**level_likes** | The amount of likes for the level
28+
**level_downloads** | The amount of downloads for the level
29+
**level_description** | The description of the level
30+
**level_upload** | The time the level was uploaded
31+
**level_update** | The time the level was last updated
32+
**level_id** | The id of the level
33+
**level_verified** | If the level is verified
34+
**level_object_count** | The amount of objects in the level, does not show values above 65535 because of a bug
35+
**level_version** | The version of the level
36+
**level_game_version** | The version of the game the level was created in
37+
2238
## Level Only (Shows as **null** in editor)
2339

2440
**bestRun_from** | The percentage that your best run was from
25-
**bestRun_to** | The percentage that your best run was to
41+
**bestRun_to** | The percentage that your best run was to
42+
**percentage** | Current percentage in the level

src/Labels/LabelNode.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ void LabelNode::update(float dt)
5555
return this->setString(fmt::format("Error Compiling Script: {}", res.getMessage()).c_str());
5656
}
5757

58+
if (!GJBaseGameLayer::get())
59+
return;
60+
5861
std::chrono::milliseconds duration(static_cast<long long>(ColourUtility::totalSessionTime * 1000));
5962

6063
auto hours = std::chrono::duration_cast<std::chrono::hours>(duration);
@@ -91,10 +94,30 @@ void LabelNode::update(float dt)
9194
script->setVariable("noclip_deaths", rift::Value::integer(as<NoclipBaseGameLayer*>(GJBaseGameLayer::get())->getNoclipDeaths()));
9295
script->setVariable("noclip_accuracy", rift::Value::floating(as<NoclipBaseGameLayer*>(GJBaseGameLayer::get())->getNoclipAccuracy() * 100));
9396

97+
if (auto lvl = GJBaseGameLayer::get()->m_level)
98+
{
99+
script->setVariable("level_name", rift::Value::string(lvl->m_levelName));
100+
script->setVariable("level_creator", rift::Value::string(lvl->m_creatorName));
101+
script->setVariable("level_description", rift::Value::string(lvl->getUnpackedLevelDescription()));
102+
script->setVariable("level_upload", rift::Value::string(lvl->m_uploadDate));
103+
script->setVariable("level_update", rift::Value::string(lvl->m_updateDate));
104+
script->setVariable("level_likes", rift::Value::integer(lvl->m_likes));
105+
script->setVariable("level_downloads", rift::Value::integer(lvl->m_downloads));
106+
script->setVariable("level_id", rift::Value::integer(lvl->m_levelID.value()));
107+
script->setVariable("level_verified", rift::Value::boolean(lvl->m_isVerifiedRaw));
108+
script->setVariable("level_object_count", rift::Value::integer(lvl->m_objectCount.value()));
109+
script->setVariable("level_version", rift::Value::integer(lvl->m_levelVersion));
110+
script->setVariable("level_game_version", rift::Value::integer(lvl->m_gameVersion));
111+
112+
script->setVariable("normal_best", rift::Value::integer(GJBaseGameLayer::get()->m_level->m_normalPercent.value()));
113+
script->setVariable("practice_best", rift::Value::integer(GJBaseGameLayer::get()->m_level->m_practicePercent));
114+
}
115+
94116
if (PlayLayer::get())
95117
{
96118
script->setVariable("bestRun_from", rift::Value::floating(as<BestPlayLayer*>(PlayLayer::get())->m_fields->bestFrom));
97119
script->setVariable("bestRun_to", rift::Value::floating(as<BestPlayLayer*>(PlayLayer::get())->m_fields->bestTo));
120+
script->setVariable("percentage", rift::Value::floating(PlayLayer::get()->getCurrentPercent()));
98121
}
99122

100123
auto res2 = script->run();

0 commit comments

Comments
 (0)