Мир: остров, дороги-дамбы, биомы; LOD ступенями; консоль сервера; баны; постобработка
This commit is contained in:
+18
-13
@@ -49,19 +49,23 @@ $tokenFile = Join-Path $Root 'rsx-server-core\world\dev-token.txt'
|
||||
if (Test-Path $tokenFile) { Remove-Item $tokenFile -Force }
|
||||
|
||||
Write-Host 'starting the server'
|
||||
$serverArgs = @(
|
||||
'-cp', $serverCp, 'net.rustnotmc.server.ServerMain',
|
||||
'--port', "$Port",
|
||||
'--accounts', (Join-Path $Root 'rsx-server-core\accounts.txt'),
|
||||
'--world', (Join-Path $Root 'rsx-server-core\world'),
|
||||
'--dev-token', $User,
|
||||
'--bind', '127.0.0.1'
|
||||
)
|
||||
# The server runs in its own visible console window, so the log lies in view
|
||||
# and whoever is sitting at the machine can speak to it: type list, say,
|
||||
# op, deop, kick, ban, unban, save or stop and press Enter there.
|
||||
$java = 'D:\jdk-21\bin\java.exe'
|
||||
if (-not (Test-Path $java)) { $java = (Get-Command java).Source }
|
||||
$server = Start-Process -FilePath $java -ArgumentList $serverArgs `
|
||||
-RedirectStandardOutput $ServerLog -RedirectStandardError "$ServerLog.err" -PassThru
|
||||
Write-Host "server pid $($server.Id), log $ServerLog"
|
||||
$serverCommand =
|
||||
"& '$java' -cp '$serverCp' net.rustnotmc.server.ServerMain" +
|
||||
" --port $Port" +
|
||||
" --accounts '$(Join-Path $Root 'rsx-server-core\accounts.txt')'" +
|
||||
" --world '$(Join-Path $Root 'rsx-server-core\world')'" +
|
||||
" --dev-token $User" +
|
||||
" --bind 127.0.0.1" +
|
||||
" *>&1 | Tee-Object -FilePath '$ServerLog'"
|
||||
$server = Start-Process -FilePath 'powershell.exe' -ArgumentList @(
|
||||
'-NoExit', '-ExecutionPolicy', 'Bypass', '-Command', $serverCommand
|
||||
) -PassThru
|
||||
Write-Host "server window pid $($server.Id), log $ServerLog"
|
||||
|
||||
# The server writes its own token, and the client needs it. The file has to be
|
||||
# the one this run wrote, not the one of the run before.
|
||||
@@ -94,11 +98,12 @@ Start-Process -FilePath 'powershell.exe' -ArgumentList $clientArgs -PassThru | O
|
||||
Write-Host 'the client is starting in its own window'
|
||||
Write-Host "the client log is in $ClientLog"
|
||||
|
||||
# stay alive while the game runs
|
||||
# stay alive while the server window does; the game has its own window and
|
||||
# its own life
|
||||
while ($true) {
|
||||
Start-Sleep -Seconds 5
|
||||
if ($server.HasExited) {
|
||||
Write-Host 'the server has stopped'
|
||||
Write-Host 'the server window has closed'
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user