Skip to content

Commit 8356cfa

Browse files
committed
docs(itemdata): document smelting source in generator README
1 parent 673cc2e commit 8356cfa

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

tests/RustPlusBot.ItemData.Generator.Tests/OfflineSmeltingSourceTests.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ public void LoadSmelters_ProjectsConversions_ResolvingSmelterNameAndIds()
2525
""";
2626
var names = new Dictionary<int, string>
2727
{
28-
[100] = "Furnace", [10] = "Metal Ore", [20] = "Metal Fragments", [11] = "Wood", [21] = "Charcoal",
28+
[100] = "Furnace",
29+
[10] = "Metal Ore",
30+
[20] = "Metal Fragments",
31+
[11] = "Wood",
32+
[21] = "Charcoal",
2933
};
3034

3135
var smelters = SourceWith(json).LoadSmelters(names);
@@ -48,7 +52,10 @@ public void LoadSmelters_DropsSmelterWithUnknownId()
4852
{
4953
const string json =
5054
"""{"999":[{"fromId":"10","woodQuantity":1,"toId":"20","toQuantity":1,"toProbability":1,"time":2}]}""";
51-
var names = new Dictionary<int, string> { [10] = "Metal Ore", [20] = "Metal Fragments" };
55+
var names = new Dictionary<int, string>
56+
{
57+
[10] = "Metal Ore", [20] = "Metal Fragments"
58+
};
5259
Assert.Empty(SourceWith(json).LoadSmelters(names));
5360
}
5461

@@ -57,7 +64,10 @@ public void LoadSmelters_DropsConversionWithUnknownInputOrOutput()
5764
{
5865
const string json =
5966
"""{"100":[{"fromId":"10","woodQuantity":1,"toId":"999","toQuantity":1,"toProbability":1,"time":2}]}""";
60-
var names = new Dictionary<int, string> { [100] = "Furnace", [10] = "Metal Ore" };
67+
var names = new Dictionary<int, string>
68+
{
69+
[100] = "Furnace", [10] = "Metal Ore"
70+
};
6171
Assert.Empty(SourceWith(json).LoadSmelters(names)); // smelter dropped: no valid conversions remain
6272
}
6373
}

tools/RustPlusBot.ItemData.Generator/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A maintainer CLI that regenerates the embedded Rust item dataset
44
(`src/RustPlusBot.Features.ItemData/Data/item-data.json`) consumed by the bot's
5-
`/item`, `/recycle`, `/craft`, `/research`, `/decay`, `/upkeep`, and `/durability` calculators.
5+
`/item`, `/recycle`, `/craft`, `/research`, `/decay`, `/upkeep`, `/durability`, and `/smelt` calculators.
66

77
This tool is **not** part of the running bot — it is referenced by nothing in
88
the application graph. It exists so the bundled item data can be refreshed when
@@ -38,6 +38,7 @@ garbage** if the upstream shape drifts.
3838
| `rustlabsDecayData.json` | decay time + HP |
3939
| `rustlabsUpkeepData.json` | upkeep cost (resource + quantity range) |
4040
| `rustlabsDurabilityData.json` | raid cost (explosives only — trimmed) |
41+
| `rustlabsSmeltingData.json` | smelting/cooking conversions (per smelter) |
4142

4243
2. Projects them into our own typed schema (`ItemDataset` /
4344
`ItemRecord` / …, defined in `RustPlusBot.Features.ItemData`), keyed by item id,
@@ -91,8 +92,8 @@ tests assert known items resolve correctly.
9192

9293
The source dates stamped into the dataset are currently hard-coded constants in
9394
[`Program.cs`](Program.cs) (`NamesAsOf`, `RecycleAsOf`, `CraftAsOf`,
94-
`ResearchAsOf`, `DecayAsOf`, `UpkeepAsOf`, `DurabilityAsOf`). Update them when
95-
you refresh from newer upstream data.
95+
`ResearchAsOf`, `DecayAsOf`, `UpkeepAsOf`, `DurabilityAsOf`, `SmeltingAsOf`).
96+
Update them when you refresh from newer upstream data.
9697

9798
## Notes
9899

@@ -106,6 +107,11 @@ you refresh from newer upstream data.
106107
(item / building-block / vehicle). The raw source (`rustlabsDurabilityData.json`)
107108
is ~19 MB and is **never bundled** — only the projected, explosive-only rows
108109
are written into `item-data.json`.
110+
- Smelting data (`rustlabsSmeltingData.json`, ~28 KB) is keyed by **smelter**
111+
and projected into a dedicated `Smelters` table (`OfflineSmeltingSource`),
112+
resolved by name like raid targets. Its provenance (`SmeltingAsOf`,
113+
2023-11-05) lags the other rustlabs sources because the upstream file has not
114+
changed since then.
109115

110116
## Attribution
111117

0 commit comments

Comments
 (0)