4
4
#include " engine/EngineManager.h"
5
5
#include " engine/TimeTaskSystem.h"
6
6
#include " ll/api/chrono/GameChrono.h"
7
+ #include " ll/api/schedule/Scheduler.h"
7
8
#include " ll/api/schedule/Task.h"
8
9
#include " ll/api/service/ServerInfo.h"
9
10
#include " ll/api/utils/ErrorUtils.h"
@@ -26,6 +27,7 @@ ClassDefine<void> SystemClassBuilder = defineClass("system")
26
27
.function(" newProcess" , &SystemClass::newProcess)
27
28
.build();
28
29
30
+ ll::schedule::Scheduler<ll::chrono::GameTickClock> systemScheduler;
29
31
// From LiteLoaderBDSv2 llapi/utils/WinHelper.cpp
30
32
bool NewProcess (
31
33
const std::string& process,
@@ -115,7 +117,7 @@ Local<Value> SystemClass::cmd(const Arguments& args) {
115
117
return Boolean::newBoolean (NewProcess (
116
118
" cmd /c" + cmd,
117
119
[callback{std::move (callbackFunc)}, engine{EngineScope::currentEngine ()}](int exitCode, string output) {
118
- ll::schedule::DelayTask<ll::chrono::GameTickClock >(
120
+ systemScheduler. add < ll::schedule::DelayTask>(
119
121
ll::chrono::ticks (1 ),
120
122
[engine, callback = std::move (callback), exitCode, output = std::move (output)]() {
121
123
if ((ll::getServerStatus () != ll::ServerStatus::Running)) return ;
@@ -150,7 +152,7 @@ Local<Value> SystemClass::newProcess(const Arguments& args) {
150
152
return Boolean::newBoolean (NewProcess (
151
153
process,
152
154
[callback{std::move (callbackFunc)}, engine{EngineScope::currentEngine ()}](int exitCode, string output) {
153
- ll::schedule::DelayTask<ll::chrono::GameTickClock >(
155
+ systemScheduler. add < ll::schedule::DelayTask>(
154
156
ll::chrono::ticks (1 ),
155
157
[engine, callback = std::move (callback), exitCode, output = std::move (output)]() {
156
158
if ((ll::getServerStatus () != ll::ServerStatus::Running)) return ;
@@ -162,7 +164,7 @@ Local<Value> SystemClass::newProcess(const Arguments& args) {
162
164
}
163
165
CATCH_IN_CALLBACK (" newProcess" )
164
166
}
165
- ). call () ;
167
+ );
166
168
},
167
169
args.size () >= 3 ? args[2 ].toInt () : -1
168
170
));
0 commit comments