diff --git a/plugin/RunicNPC.cs b/plugin/RunicNPC.cs index 90b1d1c..aa69d14 100644 --- a/plugin/RunicNPC.cs +++ b/plugin/RunicNPC.cs @@ -2784,13 +2784,29 @@ namespace Oxide.Plugins if (container == null) continue; foreach (Item item in container.itemList) - if (item != null && item.GetHeldEntity() is T) + if (item != null && HeldAs(item) != null) return item; } return null; } + /// + /// The item's held entity as a , or, when it has none, its definition's + /// entity prefab's. Since Rust's November 2026 build a "player-only" item (a syringe) has a held + /// entity only in the belt (ItemModEntity.playerOnlyEntityBeltOnly), and an extra waits in + /// the main inventory until moves it (issue #20). + /// + private static T HeldAs(Item item) where T : HeldEntity + { + BaseEntity held = item.GetHeldEntity(); + if (held != null) + return held as T; + ItemModEntity mod = item.info.GetComponent(); + GameObject prefab = mod != null && mod.entityPrefab != null && mod.entityPrefab.isValid ? mod.entityPrefab.Get() : null; + return prefab != null ? prefab.GetComponent() : null; + } + /// Puts an item in its hands; only the belt can be held, so it is moved there first. private static bool Hold(RunicNpcPlayer npc, Item item) { @@ -2914,7 +2930,8 @@ namespace Oxide.Plugins if (amount <= 0f) return false; - Hold(npc, item); + if (!Hold(npc, item)) + return false; // a full belt: nowhere to hold it. npc.SignalBroadcast(BaseEntity.Signal.Attack); item.UseItem(1); npc.Heal(amount); @@ -3011,8 +3028,10 @@ namespace Oxide.Plugins private static bool HasFuel(RunicNpcPlayer npc, Item flameItem) { - FlameThrower f = flameItem.GetHeldEntity() as FlameThrower; - return f != null && (f.ammo > 0 || (f.fuelType != null && npc.inventory.FindItemByItemName(f.fuelType.shortname) != null)); + // Off the belt it may have no held entity, so no tank (HeldAs): only the kit's fuel counts then. + FlameThrower held = flameItem.GetHeldEntity() as FlameThrower; + FlameThrower f = HeldAs(flameItem); + return f != null && ((held != null && held.ammo > 0) || (f.fuelType != null && npc.inventory.FindItemByItemName(f.fuelType.shortname) != null)); } ///