Make some experimental changes
This commit is contained in:
parent
577b310d45
commit
09967de31b
4 changed files with 27 additions and 21 deletions
|
@ -25,7 +25,7 @@ RUN dpkg --add-architecture i386 \
|
|||
&& apt update -y \
|
||||
&& apt install -y --no-install-recommends gnupg2 numactl tzdata software-properties-common libntlm0 winbind xvfb xauth python3 libncurses5:i386 libncurses6:i386 libsdl2-2.0-0 libsdl2-2.0-0:i386
|
||||
|
||||
# Install wine and with recommends
|
||||
# Install wine with recommends
|
||||
RUN mkdir -pm755 /etc/apt/keyrings
|
||||
RUN wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
|
||||
RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bookworm/winehq-bookworm.sources
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:libac_dart/nbt/NbtUtils.dart';
|
||||
|
@ -297,9 +298,12 @@ class C2SUploadSettingsPacket implements IPacket {
|
|||
SessionData.CURRENT_INTERVAL = WarnIntervals.NONE;
|
||||
|
||||
if (settings.subsys.currentState == States.Inactive) {
|
||||
SessionData.shutdownPending = true;
|
||||
// Stop packet server
|
||||
PacketServer.socket!.close();
|
||||
Timer.periodic(Duration(seconds: 10), (timer) {
|
||||
SessionData.shutdownPending = true;
|
||||
// Stop packet server
|
||||
PacketServer.socket!.close();
|
||||
timer.cancel();
|
||||
}); // We give time to allow the server to shut down gracefully.
|
||||
}
|
||||
|
||||
return PacketResponse.nil;
|
||||
|
|
|
@ -55,21 +55,11 @@ Future<void> runDetachedProton(
|
|||
List<String> args = ["run", command];
|
||||
args.addAll(argx);
|
||||
|
||||
List<String> wineArgs = ["--auto-servernum", "wine", command];
|
||||
wineArgs.addAll(argx);
|
||||
|
||||
if (settings.inst!.pterodactylMode)
|
||||
StateMachine.PROC = await Process.start("xvfb-run", wineArgs,
|
||||
environment: env,
|
||||
workingDirectory: workingDir,
|
||||
mode: ProcessStartMode.normal);
|
||||
else
|
||||
StateMachine.PROC = await Process.start(
|
||||
settings.getProtonExecutablePath(),
|
||||
args, // Run arbitrary command with arguments
|
||||
environment: env,
|
||||
workingDirectory: workingDir,
|
||||
mode: ProcessStartMode.normal);
|
||||
StateMachine.PROC = await Process.start(settings.getProtonExecutablePath(),
|
||||
args, // Run arbitrary command with arguments
|
||||
environment: env,
|
||||
workingDirectory: workingDir,
|
||||
mode: ProcessStartMode.normal);
|
||||
|
||||
StateMachine.monitorProcess();
|
||||
} catch (e) {
|
||||
|
|
|
@ -169,6 +169,11 @@ class StateMachine {
|
|||
|
||||
Timer? task;
|
||||
|
||||
Future<void> pollModUpdates() async {
|
||||
await doDownloadMods(false);
|
||||
await doScanMods(false);
|
||||
}
|
||||
|
||||
/// You should only start this task once the server is ready to be started.
|
||||
/// This task will start the server on first-start
|
||||
///
|
||||
|
@ -184,7 +189,7 @@ class StateMachine {
|
|||
SessionData.enableRestartTimer = settings.inst!.timer.enabled;
|
||||
|
||||
// Schedule the server task
|
||||
task = Timer.periodic(Duration(seconds: 1), (timer) {
|
||||
task = Timer.periodic(Duration(seconds: 1), (timer) async {
|
||||
switch (currentState) {
|
||||
case States.Inactive:
|
||||
{
|
||||
|
@ -197,6 +202,7 @@ class StateMachine {
|
|||
} else {
|
||||
resetKillswitch();
|
||||
SessionData.timer = settings.inst!.timer.time.copy();
|
||||
await pollModUpdates();
|
||||
changeState(States.PreStart);
|
||||
SessionData.enableRestartTimer = settings.inst!.timer.enabled;
|
||||
}
|
||||
|
@ -214,7 +220,7 @@ class StateMachine {
|
|||
WarnIntervals current = SessionData.CURRENT_INTERVAL;
|
||||
bool send = false;
|
||||
for (WarnIntervals WI in WarnIntervals.values) {
|
||||
if (WI.seconds <= sec && WI.seconds < current.seconds) {
|
||||
if (WI.seconds <= sec && WI.seconds <= current.seconds) {
|
||||
current = WI;
|
||||
send = true;
|
||||
|
||||
|
@ -232,6 +238,12 @@ class StateMachine {
|
|||
}
|
||||
|
||||
// Check Shutdown Pending
|
||||
if (SessionData.shutdownMessage.isNotEmpty) {
|
||||
settings
|
||||
.sendRconCommand("broadcast ${SessionData.shutdownMessage}");
|
||||
SessionData.shutdownMessage = "";
|
||||
}
|
||||
|
||||
if (SessionData.shutdownPending) {
|
||||
// Shut down the server
|
||||
changeState(States.FullStop);
|
||||
|
|
Loading…
Reference in a new issue