feat(bridge): a Place NPCs step's "drop loot" switch (runicnpc stage 7)
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in 8s

world.place with a profile takes dropLoot (D296): false spawns the
NPCs with RunicNPC's {"loot":{"dropTable":false}} override, so they
keep their corpse's start but roll no table. Absent or true, as before.
runicnpc_api and RunicNpcApiNeeded are 6.

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-05 22:36:29 -05:00
parent 0792564ffe
commit 1df3db57d3
2 changed files with 12 additions and 5 deletions

View File

@@ -80,7 +80,7 @@ requires_plugins = ["Kits", "ZoneManager"]
# ── The RunicNPC API the bridge needs ─────────────────────────────────────── # ── The RunicNPC API the bridge needs ───────────────────────────────────────
# #
# RunicNPC (docs/runicnpc/PLAN.md stages 4 to 6): the bridge's npc.* commands call # RunicNPC (docs/runicnpc/PLAN.md stages 4 to 7): the bridge's npc.* commands call
# RunicNPC's API and need at least this version of it. It MUST equal # RunicNPC's API and need at least this version of it. It MUST equal
# `RunicNpcApiNeeded` in RunicGateway.cs; `node scripts/checkPlugin.js` holds the # `RunicNpcApiNeeded` in RunicGateway.cs; `node scripts/checkPlugin.js` holds the
# two equal. The release copies it into manifest.json, and the installer's # two equal. The release copies it into manifest.json, and the installer's
@@ -88,4 +88,4 @@ requires_plugins = ["Kits", "ZoneManager"]
# #
# RunicNPC is optional to the bridge until its stage 9: without it every npc.* # RunicNPC is optional to the bridge until its stage 9: without it every npc.*
# command answers `runicnpc-missing`, and events place Rust's own scientists. # command answers `runicnpc-missing`, and events place Rust's own scientists.
runicnpc_api = 5 runicnpc_api = 6

View File

@@ -10371,9 +10371,10 @@ namespace Oxide.Plugins
/// <summary> /// <summary>
/// The RunicNPC API these commands call: 3 added placements from a website (D249), 4 the /// The RunicNPC API these commands call: 3 added placements from a website (D249), 4 the
/// faction table and an event's escort, ally and tether (runicnpc stage 5), 5 bosses and /// faction table and an event's escort, ally and tether (runicnpc stage 5), 5 bosses and
/// passive NPCs (runicnpc stage 6): a profile's `boss` and `use`, and the boss hooks. /// passive NPCs (runicnpc stage 6): a profile's `boss` and `use`, and the boss hooks, 6 loot (runicnpc
/// stage 7): a profile's `loot`, and the `dropTable` override a Place NPCs step's switch sends.
/// </summary> /// </summary>
private const int RunicNpcApiNeeded = 5; private const int RunicNpcApiNeeded = 6;
private Plugin RunicNpcPlugin() private Plugin RunicNpcPlugin()
{ {
@@ -10980,6 +10981,12 @@ namespace Oxide.Plugins
string owner = "run:" + runId; string owner = "run:" + runId;
var made = new List<WorldEntry>(); var made = new List<WorldEntry>();
// Runicnpc stage 7 (D296): the step's "drop loot" switch. Off, the NPCs keep their corpse's start
// but roll no loot table; on (or absent, a step older than the switch) they drop it as anywhere.
object dropLootValue;
bool dropLoot = !(cmd.TryGetValue("dropLoot", out dropLootValue) && dropLootValue is bool && !(bool)dropLootValue);
Newtonsoft.Json.Linq.JObject spawnOverrides = dropLoot ? null : Newtonsoft.Json.Linq.JObject.Parse("{\"loot\":{\"dropTable\":false}}");
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
BasePlayer spawned = null; BasePlayer spawned = null;
@@ -10997,7 +11004,7 @@ namespace Oxide.Plugins
at.y = TerrainMeta.HeightMap.GetHeight(at); at.y = TerrainMeta.HeightMap.GetHeight(at);
} }
spawned = npc.Call("RunicNpc_Spawn", at, profile, owner, null) as BasePlayer; spawned = npc.Call("RunicNpc_Spawn", at, profile, owner, spawnOverrides) as BasePlayer;
} }
if (spawned == null) if (spawned == null)