feat(bridge): a Place NPCs step's "drop loot" switch (runicnpc stage 7) #25

Merged
whitlocktech merged 1 commits from feat/runicnpc-stage7 into edge 2026-10-06 02:16:21 -05:00
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)