Skip to content

Commit 681d13b

Browse files
committed
fix: use key after smo session
also turn off cli progress bar for action, and force normal mode in coop maybe there could be other coop modes in future? 👀
1 parent da16e8e commit 681d13b

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
wget https://github.com/craftablescience/VPKEdit/releases/download/v4.4.2/VPKEdit-Linux-Standalone-CLI-gcc-Release.zip
2929
unzip VPKEdit-Linux-Standalone-CLI-gcc-Release.zip
3030
chmod +x ./vpkeditcli
31-
./vpkeditcli -s -v 1 pak01_dir
31+
./vpkeditcli -s -v 1 --no-progress pak01_dir
3232
3333
- name: Upload Artifact
3434
uses: actions/upload-artifact@v4

scripts/vscripts/modes/smo.nut

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,6 @@ smo.move.setup <- function() {
545545
smo.move.speedmod <- Entities.CreateByClassname("player_speedmod");
546546
ppmod.keyval(smo.move.speedmod, "SpawnFlags", 0);
547547

548-
// Horrible way of doing this. Will replace as soon as I can.
549-
SendToConsole("alias +use \"script smo.move.use()\"");
550-
SendToConsole("alias -use \"script smo.move.unuse()\"");
551-
552548
// SLA softlock prevention
553549
SendToConsole("-jump");
554550
smo.move.speed(175);

scripts/vscripts/speedrunmod_coop.nut

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ if ( !bShouldRun )
4949
return; // Not a native coop map.
5050
}
5151

52+
if (smsm.GetMode() != 0) {
53+
smsm.SetMode(0);
54+
}
55+
5256
//-----------------------------------------------------------------------------
5357
// Purpose: Speed up checkpoints and ending transitions based on map type.
5458
//-----------------------------------------------------------------------------

smsm/src/Modules/Engine.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88

99
#include "SMSM.hpp"
1010

11+
REDECL(Engine::startuse_callback);
12+
REDECL(Engine::enduse_callback);
13+
14+
DETOUR_COMMAND(Engine::startuse) {
15+
if (smsm.GetMode() == 6) { // SMO
16+
engine->Cbuf_AddText(0, "script smo.move.use()", 0);
17+
} else {
18+
Engine::startuse_callback(args);
19+
}
20+
}
21+
22+
DETOUR_COMMAND(Engine::enduse) {
23+
if (smsm.GetMode() == 6) { // SMO
24+
engine->Cbuf_AddText(0, "script smo.move.unuse()", 0);
25+
}
26+
Engine::enduse_callback(args);
27+
}
1128

1229
Engine::Engine()
1330
: Module()
@@ -54,6 +71,9 @@ bool Engine::Init()
5471
this->PrecacheModel = this->engineTool->Original<_PrecacheModel>(Offsets::PrecacheModel);
5572
}
5673

74+
Command::Hook("+use", Engine::startuse_callback_hook, Engine::startuse_callback);
75+
Command::Hook("-use", Engine::enduse_callback_hook, Engine::enduse_callback);
76+
5777
return this->hasLoaded = this->engineClient
5878
&& this->engineTool
5979
&& this->hoststate
@@ -75,6 +95,9 @@ void Engine::Shutdown()
7595
if (this->engineClient) Interface::Delete(this->engineClient);
7696
if (this->engineTrace) Interface::Delete(this->engineTrace);
7797
if (this->engineTool) Interface::Delete(this->engineTool);
98+
99+
Command::Unhook("+use", Engine::startuse_callback);
100+
Command::Unhook("-use", Engine::enduse_callback);
78101
}
79102

80103
Engine* engine;

smsm/src/Modules/Engine.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ class Engine : public Module {
3333

3434
void* s_CommandBuffer = nullptr;
3535

36+
DECL_DETOUR_COMMAND(startuse);
37+
DECL_DETOUR_COMMAND(enduse);
38+
3639
Engine();
3740
bool Init() override;
3841
void Shutdown() override;
3942
const char* Name() override { return MODULE("engine"); }
4043
};
4144

4245
extern Engine* engine;
43-

0 commit comments

Comments
 (0)