Add mod documentation in seven languages
This commit is contained in:
1 parent
eb68bf4d04
commit
09a5ab1fbb
15 files changed
+456
-8
No files matched your search
+64
@@ -0,0 +1,64 @@
|
||||
# Test Defaults and Patches — a test fixture for property patches
|
||||
|
||||
This mod is not content. It is a **test fixture**: a small set of property patches that the `property_patches` test loads to check that patches of other mods' characters and items merge the way the game promises. It is never part of a game and is not meant to be enabled by players.
|
||||
|
||||
## What it patches
|
||||
|
||||
A property patch is a file `patches/<kind>.json`. Each entry names an entity by its `Id` and lists properties to add or change; the `Id` `*` is a **wildcard** that reaches every entity of the kind. The fixture has one targeted and one wildcard patch per kind:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "Marao", "TestPatched": 42, "TestDefault": 100 },
|
||||
{ "Id": "*", "TestDefault": -20, "TestGlobalPatch": 1 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "food/ration", "Durability": 99, "SpecialProp": true },
|
||||
{ "Id": "*", "Durability": 50, "GlobalItemProp": "patched" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The rules these patches check:
|
||||
|
||||
- a **targeted** patch wins over the wildcard: Marao gets `TestDefault` 100, not -20;
|
||||
- the **wildcard** reaches every other entity: any other character gets `TestDefault` -20, every item `Durability` 50;
|
||||
- keys only one of them sets are all kept: Marao also gets `TestGlobalPatch` 1, the ration `GlobalItemProp`;
|
||||
- a targeted key never leaks to other entities;
|
||||
- the entity's own typed fields, such as the ration's name, survive the merge.
|
||||
|
||||
## Running the test
|
||||
|
||||
```text
|
||||
godot --path . res://scenes/menu/launcher.tscn -- --with-mods=test_defaults_and_patches --itest=property_patches
|
||||
dotnet run --project tests/Cthangover.TestRunner -- --test property_patches
|
||||
```
|
||||
|
||||
The fixture is loaded only because `--with-mods=` names it. Its output in a real run:
|
||||
|
||||
```text
|
||||
[PASS] Marao: targeted value: TestPatched=42
|
||||
[PASS] Marao: targeted beats wildcard: TestDefault=100
|
||||
[PASS] Marao: wildcard-only key: TestGlobalPatch=1
|
||||
[PASS] werewolf_girl_1: wildcard value: TestDefault=-20
|
||||
[PASS] werewolf_girl_1: no targeted key
|
||||
[PASS] ration: targeted beats wildcard: Durability=99
|
||||
[PASS] ration: targeted-only key: SpecialProp=true
|
||||
[PASS] ration: wildcard-only key: GlobalItemProp=patched
|
||||
[PASS] ration: typed field survives the merge
|
||||
[PASS] wolf_meat: wildcard value: Durability=50
|
||||
[TEST_RESULT] name=property_patches passed=14 failed=0
|
||||
```
|
||||
|
||||
The test is part of the mod (`src/PropertyPatchesTest.cs`) and is active only with `--itest=property_patches`.
|
||||
|
||||
## Why it stays out of games
|
||||
|
||||
Its manifest says `"fixture": true`. A fixture is never part of `--all-mods` or of a game's mod set; it loads only when `--with-mods=` names it, so its patches cannot leak into other tests or into play. Enabled in a real game, it would add test properties to every character and every item of Cthangover — wildcard patches touch everything. It depends on the Cthangover mods it patches (`cthangover_game`, `cthangover_murakami`, `cooking`).
|
||||
|
||||
The same mod is also a safe place for the tool tests to write into: the `tools_windows` test creates a scene in it through the scene editor and removes it again.
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# Test Defaults and Patches — un fixture de prueba para los parches de propiedades
|
||||
|
||||
Este mod no es contenido. Es un **fixture de prueba**: un pequeño conjunto de parches de propiedades que la prueba `property_patches` carga para comprobar que los parches sobre personajes e items de otros mods se combinan como el juego promete. Nunca forma parte de un juego y no está pensado para que lo activen los jugadores.
|
||||
|
||||
## Qué parchea
|
||||
|
||||
Un parche de propiedades es un archivo `patches/<kind>.json`. Cada entrada nombra una entidad por su `Id` y enumera propiedades que añadir o cambiar; el `Id` `*` es un **comodín** que alcanza a cada entidad de esa clase. El fixture trae un parche dirigido y otro comodín por clase:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "Marao", "TestPatched": 42, "TestDefault": 100 },
|
||||
{ "Id": "*", "TestDefault": -20, "TestGlobalPatch": 1 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "food/ration", "Durability": 99, "SpecialProp": true },
|
||||
{ "Id": "*", "Durability": 50, "GlobalItemProp": "patched" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Las reglas que estos parches comprueban:
|
||||
|
||||
- el parche **dirigido** gana al comodín: Marao recibe `TestDefault` 100, no -20;
|
||||
- el **comodín** alcanza a todas las demás entidades: cualquier otro personaje recibe `TestDefault` -20 y cada item, `Durability` 50;
|
||||
- las claves que solo uno de ellos define se conservan todas: Marao recibe además `TestGlobalPatch` 1, y la ración, `GlobalItemProp`;
|
||||
- una clave dirigida nunca se filtra a otras entidades;
|
||||
- los campos tipados propios de la entidad, como el nombre de la ración, sobreviven a la combinación.
|
||||
|
||||
## Cómo ejecutar la prueba
|
||||
|
||||
```text
|
||||
godot --path . res://scenes/menu/launcher.tscn -- --with-mods=test_defaults_and_patches --itest=property_patches
|
||||
dotnet run --project tests/Cthangover.TestRunner -- --test property_patches
|
||||
```
|
||||
|
||||
El fixture se carga solo porque `--with-mods=` lo nombra. Su salida en una ejecución real:
|
||||
|
||||
```text
|
||||
[PASS] Marao: targeted value: TestPatched=42
|
||||
[PASS] Marao: targeted beats wildcard: TestDefault=100
|
||||
[PASS] Marao: wildcard-only key: TestGlobalPatch=1
|
||||
[PASS] werewolf_girl_1: wildcard value: TestDefault=-20
|
||||
[PASS] werewolf_girl_1: no targeted key
|
||||
[PASS] ration: targeted beats wildcard: Durability=99
|
||||
[PASS] ration: targeted-only key: SpecialProp=true
|
||||
[PASS] ration: wildcard-only key: GlobalItemProp=patched
|
||||
[PASS] ration: typed field survives the merge
|
||||
[PASS] wolf_meat: wildcard value: Durability=50
|
||||
[TEST_RESULT] name=property_patches passed=14 failed=0
|
||||
```
|
||||
|
||||
La prueba forma parte del mod (`src/PropertyPatchesTest.cs`) y solo está activa con `--itest=property_patches`.
|
||||
|
||||
## Por qué se queda fuera de los juegos
|
||||
|
||||
Su manifiesto dice `"fixture": true`. Un fixture nunca forma parte de `--all-mods` ni del conjunto de mods de un juego; se carga solo cuando `--with-mods=` lo nombra, así que sus parches no pueden filtrarse a otras pruebas ni a la partida. Activado en un juego real, añadiría propiedades de prueba a cada personaje y cada item de Cthangover: los parches comodín lo tocan todo. Depende de los mods de Cthangover que parchea (`cthangover_game`, `cthangover_murakami`, `cooking`).
|
||||
|
||||
El mismo mod es además un lugar seguro donde las pruebas de herramientas pueden escribir: la prueba `tools_windows` crea en él una escena con el editor de escenas y luego la elimina.
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# Test Defaults and Patches — プロパティパッチのテストフィクスチャ
|
||||
|
||||
この MOD はコンテンツではありません。**テストフィクスチャ**です。`property_patches` テストが読み込む小さなプロパティパッチの集まりで、他の MOD のキャラクターやアイテムへのパッチが、ゲームが約束したとおりに合成されるかを確かめます。ゲームの一部になることはなく、プレイヤーが有効にすることも想定していません。
|
||||
|
||||
## 何をパッチするか
|
||||
|
||||
プロパティパッチは `patches/<kind>.json` というファイルです。各エントリーは `Id` でエンティティを指名し、追加・変更するプロパティを並べます。`Id` が `*` なら**ワイルドカード**で、その種類の全エンティティに届きます。フィクスチャには種類ごとに、対象指定のパッチとワイルドカードのパッチが1つずつあります:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "Marao", "TestPatched": 42, "TestDefault": 100 },
|
||||
{ "Id": "*", "TestDefault": -20, "TestGlobalPatch": 1 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "food/ration", "Durability": 99, "SpecialProp": true },
|
||||
{ "Id": "*", "Durability": 50, "GlobalItemProp": "patched" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
これらのパッチが確かめる規則:
|
||||
|
||||
- **対象指定**のパッチはワイルドカードに勝つ:Marao の `TestDefault` は -20 ではなく 100 になる;
|
||||
- **ワイルドカード**は残りすべてのエンティティに届く:他のキャラクターの `TestDefault` は -20、すべてのアイテムの `Durability` は 50 になる;
|
||||
- 片方だけが設定するキーはすべて残る:Marao にはさらに `TestGlobalPatch` 1 が、レーションには `GlobalItemProp` がつく;
|
||||
- 対象指定のキーが他のエンティティに漏れることはない;
|
||||
- エンティティ自身の型付きフィールド(レーションの名前など)は合成を生き残る。
|
||||
|
||||
## テストの実行
|
||||
|
||||
```text
|
||||
godot --path . res://scenes/menu/launcher.tscn -- --with-mods=test_defaults_and_patches --itest=property_patches
|
||||
dotnet run --project tests/Cthangover.TestRunner -- --test property_patches
|
||||
```
|
||||
|
||||
フィクスチャが読み込まれるのは、`--with-mods=` が名指しするからです。実際の実行での出力:
|
||||
|
||||
```text
|
||||
[PASS] Marao: targeted value: TestPatched=42
|
||||
[PASS] Marao: targeted beats wildcard: TestDefault=100
|
||||
[PASS] Marao: wildcard-only key: TestGlobalPatch=1
|
||||
[PASS] werewolf_girl_1: wildcard value: TestDefault=-20
|
||||
[PASS] werewolf_girl_1: no targeted key
|
||||
[PASS] ration: targeted beats wildcard: Durability=99
|
||||
[PASS] ration: targeted-only key: SpecialProp=true
|
||||
[PASS] ration: wildcard-only key: GlobalItemProp=patched
|
||||
[PASS] ration: typed field survives the merge
|
||||
[PASS] wolf_meat: wildcard value: Durability=50
|
||||
[TEST_RESULT] name=property_patches passed=14 failed=0
|
||||
```
|
||||
|
||||
テストは MOD の一部(`src/PropertyPatchesTest.cs`)で、`--itest=property_patches` のときだけ有効になります。
|
||||
|
||||
## なぜゲームに入らないのか
|
||||
|
||||
マニフェストには `"fixture": true` と書かれています。フィクスチャは `--all-mods` の対象にも、ゲームの MOD セットにも決して入りません。`--with-mods=` で名指しされたときだけ読み込まれるため、そのパッチが他のテストや本番に漏れることはありません。本物のゲームで有効にすれば、Cthangover の全キャラクターと全アイテムにテスト用のプロパティを足すことになります——ワイルドカードパッチはすべてに触れるからです。依存先はパッチ対象の Cthangover MOD です(`cthangover_game`、`cthangover_murakami`、`cooking`)。
|
||||
|
||||
同じ MOD は、ツール系テストが書き込んでも安全な場所にもなっています:`tools_windows` テストはシーンエディターでここにシーンを作り、また削除します。
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# Test Defaults and Patches — 속성 패치 테스트 픽스처
|
||||
|
||||
이 모드는 콘텐츠가 아니라 **테스트 픽스처**입니다. `property_patches` 테스트가 불러오는 작은 속성 패치 모음으로, 다른 모드의 캐릭터와 아이템에 대한 패치가 게임이 약속한 방식으로 합쳐지는지 확인합니다. 게임에 속하는 일이 없으며, 플레이어가 켜도록 만들어진 것도 아닙니다.
|
||||
|
||||
## 무엇을 패치하나
|
||||
|
||||
속성 패치는 `patches/<kind>.json` 파일입니다. 각 항목은 `Id`로 엔티티를 지목하고 추가하거나 바꿀 속성을 나열합니다. `Id`가 `*`이면 **와일드카드**로, 해당 종류의 모든 엔티티에 닿습니다. 픽스처에는 종류별로 대상 지정 패치 하나와 와일드카드 패치 하나가 있습니다:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "Marao", "TestPatched": 42, "TestDefault": 100 },
|
||||
{ "Id": "*", "TestDefault": -20, "TestGlobalPatch": 1 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "food/ration", "Durability": 99, "SpecialProp": true },
|
||||
{ "Id": "*", "Durability": 50, "GlobalItemProp": "patched" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
이 패치들이 확인하는 규칙:
|
||||
|
||||
- **대상 지정** 패치는 와일드카드를 이긴다: Marao의 `TestDefault`는 -20이 아니라 100이 됩니다;
|
||||
- **와일드카드**는 나머지 모든 엔티티에 닿는다: 다른 캐릭터의 `TestDefault`는 -20, 모든 아이템의 `Durability`는 50이 됩니다;
|
||||
- 한쪽만 설정하는 키는 모두 보존된다: Marao에게는 `TestGlobalPatch` 1이, ration 아이템에는 `GlobalItemProp`이 추가로 붙습니다;
|
||||
- 대상 지정 키가 다른 엔티티로 새어 나가지 않습니다;
|
||||
- 엔티티 자신의 타입 필드(예: ration의 이름)는 병합 후에도 살아남습니다.
|
||||
|
||||
## 테스트 실행
|
||||
|
||||
```text
|
||||
godot --path . res://scenes/menu/launcher.tscn -- --with-mods=test_defaults_and_patches --itest=property_patches
|
||||
dotnet run --project tests/Cthangover.TestRunner -- --test property_patches
|
||||
```
|
||||
|
||||
픽스처는 `--with-mods=`가 이름을 불러 줄 때만 로드됩니다. 실제 실행에서의 출력:
|
||||
|
||||
```text
|
||||
[PASS] Marao: targeted value: TestPatched=42
|
||||
[PASS] Marao: targeted beats wildcard: TestDefault=100
|
||||
[PASS] Marao: wildcard-only key: TestGlobalPatch=1
|
||||
[PASS] werewolf_girl_1: wildcard value: TestDefault=-20
|
||||
[PASS] werewolf_girl_1: no targeted key
|
||||
[PASS] ration: targeted beats wildcard: Durability=99
|
||||
[PASS] ration: targeted-only key: SpecialProp=true
|
||||
[PASS] ration: wildcard-only key: GlobalItemProp=patched
|
||||
[PASS] ration: typed field survives the merge
|
||||
[PASS] wolf_meat: wildcard value: Durability=50
|
||||
[TEST_RESULT] name=property_patches passed=14 failed=0
|
||||
```
|
||||
|
||||
테스트는 모드 안에(`src/PropertyPatchesTest.cs`) 있으며 `--itest=property_patches`일 때만 활성화됩니다.
|
||||
|
||||
## 왜 게임에 들어가지 않나
|
||||
|
||||
매니페스트에는 `"fixture": true`라고 적혀 있습니다. 픽스처는 `--all-mods`에도, 게임의 모드 세트에도 절대 속하지 않습니다. `--with-mods=`가 이름을 불러야 로드되므로, 그 패치가 다른 테스트나 실제 플레이로 새어 들어갈 수 없습니다. 실제 게임에서 켜면 Cthangover의 모든 캐릭터와 모든 아이템에 테스트 속성을 붙이는 셈이 됩니다 — 와일드카드 패치는 모든 것을 건드리니까요. 의존 대상은 패치하는 Cthangover 모드들(`cthangover_game`, `cthangover_murakami`, `cooking`)입니다.
|
||||
|
||||
같은 모드는 도구 테스트가 안전하게 쓸 수 있는 장소이기도 합니다: `tools_windows` 테스트는 씬 편집기로 여기에 씬을 하나 만들었다가 다시 지웁니다.
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# Test Defaults and Patches — тестовая фикстура для патчей свойств
|
||||
|
||||
Этот мод — не игровой контент. Это **тестовая фикстура**: небольшой набор патчей свойств, который загружает тест `property_patches`, чтобы проверить, что патчи чужих персонажей и предметов складываются так, как игра обещает. Он никогда не входит в игры и не рассчитан на включение игроками.
|
||||
|
||||
## Что он патчит
|
||||
|
||||
Патч свойств — это файл `patches/<kind>.json`. Каждая запись называет сущность по `Id` и перечисляет свойства, которые нужно добавить или изменить; `Id` `*` — это **подстановочный знак**, достающий каждую сущность данного вида. В фикстуре на каждый вид есть один точечный патч и один wildcard-патч:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "Marao", "TestPatched": 42, "TestDefault": 100 },
|
||||
{ "Id": "*", "TestDefault": -20, "TestGlobalPatch": 1 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "food/ration", "Durability": 99, "SpecialProp": true },
|
||||
{ "Id": "*", "Durability": 50, "GlobalItemProp": "patched" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Правила, которые эти патчи проверяют:
|
||||
|
||||
- **точечный** патч сильнее подстановочного: у Marao `TestDefault` равен 100, а не -20;
|
||||
- **wildcard** достаёт все остальные сущности: у любого другого персонажа `TestDefault` равен -20, у каждого предмета `Durability` — 50;
|
||||
- ключи, которые задаёт только один из них, сохраняются все: у Marao вдобавок появится `TestGlobalPatch` 1, у рациона — `GlobalItemProp`;
|
||||
- точечный ключ никогда не протекает на другие сущности;
|
||||
- собственные типизированные поля сущности — например, название рациона — переживают слияние.
|
||||
|
||||
## Как запустить тест
|
||||
|
||||
```text
|
||||
godot --path . res://scenes/menu/launcher.tscn -- --with-mods=test_defaults_and_patches --itest=property_patches
|
||||
dotnet run --project tests/Cthangover.TestRunner -- --test property_patches
|
||||
```
|
||||
|
||||
Фикстура загружается только потому, что её называет `--with-mods=`. Вот её вывод в реальном запуске:
|
||||
|
||||
```text
|
||||
[PASS] Marao: targeted value: TestPatched=42
|
||||
[PASS] Marao: targeted beats wildcard: TestDefault=100
|
||||
[PASS] Marao: wildcard-only key: TestGlobalPatch=1
|
||||
[PASS] werewolf_girl_1: wildcard value: TestDefault=-20
|
||||
[PASS] werewolf_girl_1: no targeted key
|
||||
[PASS] ration: targeted beats wildcard: Durability=99
|
||||
[PASS] ration: targeted-only key: SpecialProp=true
|
||||
[PASS] ration: wildcard-only key: GlobalItemProp=patched
|
||||
[PASS] ration: typed field survives the merge
|
||||
[PASS] wolf_meat: wildcard value: Durability=50
|
||||
[TEST_RESULT] name=property_patches passed=14 failed=0
|
||||
```
|
||||
|
||||
Тест лежит в самом моде (`src/PropertyPatchesTest.cs`) и активен только с `--itest=property_patches`.
|
||||
|
||||
## Почему он не попадает в игры
|
||||
|
||||
В его манифесте стоит `"fixture": true`. Фикстура никогда не входит в `--all-mods` и в набор модов игры; она загружается, только когда её назовут в `--with-mods=`, поэтому её патчи не могут протечь в другие тесты или в игру. Будь она включена в настоящей игре, она добавила бы тестовые свойства каждому персонажу и каждому предмету Cthangover — wildcard-патчи касаются всего. Зависит она от модов Cthangover, которые патчит (`cthangover_game`, `cthangover_murakami`, `cooking`).
|
||||
|
||||
Этот же мод — ещё и безопасное место для записи инструментальных тестов: тест `tools_windows` создаёт в нём сцену через редактор сцен и потом удаляет её.
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# Test Defaults and Patches — fixture thử nghiệm cho bản vá thuộc tính
|
||||
|
||||
Mod này không phải nội dung. Nó là một **fixture thử nghiệm**: một bộ nhỏ bản vá thuộc tính mà bài kiểm tra `property_patches` nạp để kiểm tra rằng các bản vá lên nhân vật và vật phẩm của mod khác được ghép đúng như game hứa. Nó không bao giờ thuộc về một game nào và cũng không nhằm để người chơi bật.
|
||||
|
||||
## Nó vá những gì
|
||||
|
||||
Một bản vá thuộc tính là tệp `patches/<kind>.json`. Mỗi mục nêu tên một thực thể theo `Id` và liệt kê các thuộc tính cần thêm hay sửa; khi `Id` là `*` thì đó là **ký tự đại diện**, chạm tới mọi thực thể của loại đó. Fixture có một bản vá có đích và một bản vá ký tự đại diện cho mỗi loại:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "Marao", "TestPatched": 42, "TestDefault": 100 },
|
||||
{ "Id": "*", "TestDefault": -20, "TestGlobalPatch": 1 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "food/ration", "Durability": 99, "SpecialProp": true },
|
||||
{ "Id": "*", "Durability": 50, "GlobalItemProp": "patched" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Các quy tắc mà những bản vá này kiểm tra:
|
||||
|
||||
- bản vá **có đích** thắng ký tự đại diện: Marao nhận `TestDefault` 100, chứ không phải -20;
|
||||
- **ký tự đại diện** chạm tới mọi thực thể còn lại: nhân vật nào khác cũng nhận `TestDefault` -20, mọi vật phẩm nhận `Durability` 50;
|
||||
- khóa nào chỉ một bên đặt thì đều được giữ: Marao còn nhận thêm `TestGlobalPatch` 1, khẩu phần nhận `GlobalItemProp`;
|
||||
- khóa có đích không bao giờ lan sang thực thể khác;
|
||||
- các trường có kiểu của chính thực thể, như tên khẩu phần, sống sót qua việc ghép.
|
||||
|
||||
## Chạy bài kiểm tra
|
||||
|
||||
```text
|
||||
godot --path . res://scenes/menu/launcher.tscn -- --with-mods=test_defaults_and_patches --itest=property_patches
|
||||
dotnet run --project tests/Cthangover.TestRunner -- --test property_patches
|
||||
```
|
||||
|
||||
Fixture chỉ được nạp vì `--with-mods=` nêu tên nó. Kết quả của nó trong một lần chạy thật:
|
||||
|
||||
```text
|
||||
[PASS] Marao: targeted value: TestPatched=42
|
||||
[PASS] Marao: targeted beats wildcard: TestDefault=100
|
||||
[PASS] Marao: wildcard-only key: TestGlobalPatch=1
|
||||
[PASS] werewolf_girl_1: wildcard value: TestDefault=-20
|
||||
[PASS] werewolf_girl_1: no targeted key
|
||||
[PASS] ration: targeted beats wildcard: Durability=99
|
||||
[PASS] ration: targeted-only key: SpecialProp=true
|
||||
[PASS] ration: wildcard-only key: GlobalItemProp=patched
|
||||
[PASS] ration: typed field survives the merge
|
||||
[PASS] wolf_meat: wildcard value: Durability=50
|
||||
[TEST_RESULT] name=property_patches passed=14 failed=0
|
||||
```
|
||||
|
||||
Bài kiểm tra nằm ngay trong mod (`src/PropertyPatchesTest.cs`) và chỉ hoạt động khi có `--itest=property_patches`.
|
||||
|
||||
## Vì sao nó đứng ngoài game
|
||||
|
||||
Manifest của nó ghi `"fixture": true`. Một fixture không bao giờ thuộc `--all-mods` hay bộ mod của game; nó chỉ được nạp khi `--with-mods=` nêu tên, nên các bản vá của nó không thể lọt vào bài kiểm tra khác hay vào lượt chơi. Nếu bật trong một game thật, nó sẽ thêm thuộc tính thử nghiệm cho từng nhân vật và từng vật phẩm của Cthangover — bản vá ký tự đại diện chạm tới mọi thứ. Nó phụ thuộc vào các mod Cthangover mà nó vá (`cthangover_game`, `cthangover_murakami`, `cooking`).
|
||||
|
||||
Mod này cũng là nơi an toàn cho các bài kiểm tra công cụ ghi vào: bài `tools_windows` tạo một cảnh trong đó qua trình soạn thảo cảnh rồi xóa đi.
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# Test Defaults and Patches — 属性补丁的测试夹具
|
||||
|
||||
这个模组不是内容,而是一个**测试夹具**:一小批属性补丁,由 `property_patches` 测试加载,用来检查对其他模组角色和物品的补丁是否按游戏承诺的方式合并。它永远不会属于任何游戏,也不该由玩家来启用。
|
||||
|
||||
## 它补丁了什么
|
||||
|
||||
属性补丁是一个 `patches/<kind>.json` 文件。每条记录用 `Id` 指明一个实体,并列出要添加或修改的属性;`Id` 为 `*` 时是**通配符**,能命中该类型的每个实体。夹具对每个类型各备有一条定向补丁和一条通配补丁:
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "Marao", "TestPatched": 42, "TestDefault": 100 },
|
||||
{ "Id": "*", "TestDefault": -20, "TestGlobalPatch": 1 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Items": [
|
||||
{ "Id": "food/ration", "Durability": 99, "SpecialProp": true },
|
||||
{ "Id": "*", "Durability": 50, "GlobalItemProp": "patched" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
这些补丁验证的规则:
|
||||
|
||||
- **定向**补丁胜过通配符:Marao 的 `TestDefault` 是 100,而不是 -20;
|
||||
- **通配符**命中其余所有实体:任何其他角色的 `TestDefault` 都是 -20,每个物品的 `Durability` 都是 50;
|
||||
- 只由其中一方设置的键全部保留:Marao 还会得到 `TestGlobalPatch` 1,口粮会得到 `GlobalItemProp`;
|
||||
- 定向键绝不会泄漏到其他实体;
|
||||
- 实体自己的类型化字段——比如口粮的名字——在合并后原样保留。
|
||||
|
||||
## 运行测试
|
||||
|
||||
```text
|
||||
godot --path . res://scenes/menu/launcher.tscn -- --with-mods=test_defaults_and_patches --itest=property_patches
|
||||
dotnet run --project tests/Cthangover.TestRunner -- --test property_patches
|
||||
```
|
||||
|
||||
只有 `--with-mods=` 点名时,夹具才会被加载。一次真实运行的输出:
|
||||
|
||||
```text
|
||||
[PASS] Marao: targeted value: TestPatched=42
|
||||
[PASS] Marao: targeted beats wildcard: TestDefault=100
|
||||
[PASS] Marao: wildcard-only key: TestGlobalPatch=1
|
||||
[PASS] werewolf_girl_1: wildcard value: TestDefault=-20
|
||||
[PASS] werewolf_girl_1: no targeted key
|
||||
[PASS] ration: targeted beats wildcard: Durability=99
|
||||
[PASS] ration: targeted-only key: SpecialProp=true
|
||||
[PASS] ration: wildcard-only key: GlobalItemProp=patched
|
||||
[PASS] ration: typed field survives the merge
|
||||
[PASS] wolf_meat: wildcard value: Durability=50
|
||||
[TEST_RESULT] name=property_patches passed=14 failed=0
|
||||
```
|
||||
|
||||
测试代码在模组内(`src/PropertyPatchesTest.cs`),只在 `--itest=property_patches` 时激活。
|
||||
|
||||
## 为什么它不进游戏
|
||||
|
||||
它的清单里写着 `"fixture": true`。夹具永远不会进入 `--all-mods` 或某个游戏的模组集;只有 `--with-mods=` 点名时才会加载,因此它的补丁不可能泄漏到其他测试或实际游戏中。要是在真实游戏里启用,它会给 Cthangover 的每个角色和每个物品加上测试属性——通配补丁波及一切。它依赖自己所补丁的 Cthangover 模组(`cthangover_game`、`cthangover_murakami`、`cooking`)。
|
||||
|
||||
这个模组也是工具测试的安全落笔之处:`tools_windows` 测试会通过场景编辑器在其中创建一个场景,随后再删除。
|
||||
Reference in new issue
Block a user