fix(examples): each example NPC its own outfit, every item at full durability (D323, D324)
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in 9s

The 9d player walk found the example kits looked alike and shipped broken armour.

- D323: the raider wears scrap armour, the camp guard metal, the sniper hide, the
  Juggernaut heavy plate. Weapons are unchanged.
- D324: Kits sets an item's condition straight from its file, and the writer put 0 on
  armour (heavy plate 0 of 1000) and a flat 100 on weapons (an M249's maximum is 500).
  Each item is now written at this Rust's own maximum for it, read from the item
  definition; 0 where the item has none.
- The harness checks it: s6.examples.fullCondition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-10-08 23:53:01 -05:00
parent 2b28575218
commit 6b15d68071
2 changed files with 39 additions and 10 deletions

View File

@@ -2423,6 +2423,18 @@ namespace Oxide.Plugins
JObject items = kitFile?["_kits"]?["rnpc_juggernaut"] as JObject;
int itemCount = items == null ? 0 : ((JArray)items["MainItems"]).Count + ((JArray)items["WearItems"]).Count + ((JArray)items["BeltItems"]).Count;
Check("s6.examples.items", itemCount == 6, $"rnpc_juggernaut carries {itemCount} of its 6 items (a short name this Rust lacks would be left out)");
// D324: every item is written at this Rust's full durability for it, 0 where it has none.
var worn = new List<string>();
foreach (string k in exampleKits)
foreach (string list in new[] { "MainItems", "WearItems", "BeltItems" })
foreach (JToken it in (kitFile?["_kits"]?[k]?[list] as JArray) ?? new JArray())
{
ItemDefinition def = ItemManager.FindItemDefinition((string)it["Shortname"]);
float want = def != null && def.condition.enabled ? def.condition.max : 0f;
if ((float)it["Condition"] != want || (float)it["MaxCondition"] != want)
worn.Add($"{k}/{it["Shortname"]} {it["Condition"]}/{it["MaxCondition"]} (want {want})");
}
Check("s6.examples.fullCondition", worn.Count == 0, worn.Count == 0 ? "every item at its full durability" : string.Join("; ", worn.ToArray()));
}
// ---- stage 7: loot (D290–D301) ----