Files
sasheg dev cda7198c76 Модель предметов по базе ремейка: узлы, деревья, знание
Протокол:
- ItemData читает таблицу items/items.csv (218 предметов ремейка) и отдает
  числа: урон, дальность, темп, прочность, сколько ресурса за удар.
- ItemType: поля rid, researchScrap, techTreeBench, techTreeScrap,
  techTreeParent, admin. Урон по частям тела делится как в ремейке: голова
  вдвое, руки и ноги четыре пятых. Число в исходнике главнее таблицы.
- ItemRegistry: 218 предметов с рецептами, ценой исследования и веткой
  дерева. Новые вещи: salvage-тесак, бронедвери, гаражи, взрывчатка,
  компоненты, еда, мусор, верстаки и печи.
- NodeType: узлы с запасом (дерево 500/750/1000, камень 750, металл 500,
  сера 200) и меткой: крестик на дереве до двух, горячая точка на руде до
  трех.
- TechTree: ветки верстаков с предками, 125/250/500 скрапа.
- Новые пакеты: Dig, BreakProgress, CraftStart, CraftUpdate, ResearchStart,
  ResearchUpdate, TechTreeUnlock, KnownRecipes, TechTreeState, ContainerOpen,
  ContainerTake, LearnBlueprint.

Сервер:
- Knowledge: что игрок знает - рецепты и открытые узлы деревьев.
- Crafter: проверка рецепта, уровня верстака и ингредиентов; время крафта
  по формуле плана.
- ResearchTable: предмет плюс скрап, десять секунд, предмет превращается в
  чертёж; чертёж изучается и открывает рецепт.
- ResourceNode: запас, метка, последний удар отдает остаток.
- JunkPile: две-четыре бочки (серая - скрап и мусор, синяя - компонент,
  красная - нефть и топливо) и ящик с едой; пустая мусорка исчезает через
  60-180 секунд.
- RoadNetwork: сетка дорог и кольцо, точки спавна мусорки; генератор кладет
  асфальт и ровняет дорогу по ширине.
- Проверка досягаемости вынесена из changeBlock, игрок получил benchLevel.
- Сессия отвечает на новые пакеты, при входе шлет известные рецепты и
  открытые узлы.

Тесты: протокол 24 + 10, сервер 74 (было 57). Форк собирается чисто.
2026-10-21 19:54:22 +03:00

72 lines
2.6 KiB
PowerShell

# Builds rsx-protocol into dist\.
#
# Only a JDK is required, same as the loader: javac with --release 17, no Gradle
# and no network. The protocol is deliberately dependency free so both ends can
# carry it and so its tests run without a game, a server or a socket library.
#
# NOTE: ASCII on purpose. Windows PowerShell 5.1 reads a .ps1 with no byte order
# mark using the system ANSI code page, which mangles UTF-8 and breaks the
# parser. Keep script messages English.
$ErrorActionPreference = 'Stop'
$Repo = Split-Path -Parent $PSScriptRoot
if (-not $Repo) { $Repo = $PSCommandPath | Split-Path -Parent | Split-Path -Parent }
$Dist = Join-Path $Repo 'dist'
$Out = Join-Path $Repo 'build'
function Say($text) { Write-Host " $text" -ForegroundColor Cyan }
if (-not (Get-Command javac -ErrorAction SilentlyContinue)) {
Write-Host ' A JDK (javac) is required.' -ForegroundColor Red
exit 1
}
New-Item -ItemType Directory -Force -Path $Dist, $Out | Out-Null
$mainOut = Join-Path $Out 'classes'
Remove-Item $mainOut -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $mainOut | Out-Null
$mainFiles = @(Get-ChildItem (Join-Path $Repo 'src\main\java') -Recurse -Filter '*.java' |
ForEach-Object { $_.FullName })
if ($mainFiles.Count -eq 0) {
Write-Host ' No sources found.' -ForegroundColor Red
exit 1
}
& javac -encoding UTF-8 --release 17 -Xlint:-options -nowarn -d $mainOut $mainFiles
if ($LASTEXITCODE -ne 0) {
Write-Host ' Protocol failed to compile.' -ForegroundColor Red
exit 1
}
Say "protocol compiled ($($mainFiles.Count) files)"
# The resources travel with the jar: the item table and the sound registry
# live in src\main\resources, and both ends of the wire read them.
$resources = Join-Path $Repo 'src\main\resources'
if (Test-Path -LiteralPath $resources) {
Copy-Item -Path (Join-Path $resources '*') -Destination $mainOut -Recurse -Force
$resourceFiles = @(Get-ChildItem $resources -Recurse -File)
Say "resources copied ($($resourceFiles.Count) files)"
}
$manifest = Join-Path $Out 'manifest.txt'
@"
Manifest-Version: 1.0
Implementation-Title: RustNotMC protocol
Implementation-Version: 0.1.0
"@ | Set-Content -LiteralPath $manifest -Encoding ASCII
$jar = Join-Path $Dist 'rsx-protocol.jar'
if (Test-Path -LiteralPath $jar) { Remove-Item -LiteralPath $jar -Force }
& jar cfm $jar $manifest -C $mainOut .
if ($LASTEXITCODE -ne 0) {
Write-Host ' Could not package the jar.' -ForegroundColor Red
exit 1
}
Say "rsx-protocol.jar ($((Get-Item $jar).Length) bytes)"
Write-Host ''
Write-Host ' Done:' -ForegroundColor Green
Write-Host " $jar"