90 lines
3.8 KiB
Diff
90 lines
3.8 KiB
Diff
From 964d355b6eddd168ac5e884efb0e122a89175237 Mon Sep 17 00:00:00 2001
|
|
From: Christopher <christopher@clatza.dev>
|
|
Date: Sat, 7 Aug 2021 01:39:07 +0200
|
|
Subject: [PATCH] Forwards inventory offers for NPCs to their owners.
|
|
|
|
---
|
|
.../Shared/Api/Implementation/LSL_Api.cs | 30 ++++++++++++++++++-
|
|
bin/OpenSimDefaults.ini | 2 ++
|
|
2 files changed, 31 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
|
|
index 9de2c8ca78..5359e3358e 100644
|
|
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
|
|
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
|
|
@@ -246,8 +246,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|
protected static List<CastRayCall> m_castRayCalls = new List<CastRayCall>();
|
|
protected bool m_useMeshCacheInCastRay = true;
|
|
protected static Dictionary<ulong, FacetedMesh> m_cachedMeshes = new Dictionary<ulong, FacetedMesh>();
|
|
+ protected bool m_giveNPCInventoryToOwner = false;
|
|
|
|
-// protected Timer m_ShoutSayTimer;
|
|
+ // protected Timer m_ShoutSayTimer;
|
|
protected int m_SayShoutCount = 0;
|
|
DateTime m_lastSayShoutCheck;
|
|
|
|
@@ -427,6 +428,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|
seConfig.GetBoolean("AutomaticLinkPermission", m_automaticLinkPermission);
|
|
m_notecardLineReadCharsMax =
|
|
seConfig.GetInt("NotecardLineReadCharsMax", m_notecardLineReadCharsMax);
|
|
+ m_giveNPCInventoryToOwner =
|
|
+ seConfig.GetBoolean("GiveNPCInventoryToOwner", m_giveNPCInventoryToOwner);
|
|
|
|
// Rezzing an object with a velocity can create recoil. This feature seems to have been
|
|
// removed from recent versions of SL. The code computes recoil (vel*mass) and scales
|
|
@@ -4795,6 +4798,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|
}
|
|
}
|
|
|
|
+ // destination is an npc
|
|
+ if(presence.IsNPC && m_giveNPCInventoryToOwner)
|
|
+ {
|
|
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
|
|
+ UUID NPCOwner = npcModule.GetOwner(destId);
|
|
+
|
|
+ if (NPCOwner != UUID.Zero)
|
|
+ destId = NPCOwner;
|
|
+ }
|
|
+
|
|
// destination is an avatar
|
|
InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out string message);
|
|
|
|
@@ -7739,6 +7752,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|
isNotOwner = sp.UUID != m_host.OwnerID;
|
|
}
|
|
|
|
+ // destination is an npc
|
|
+ if (World.TryGetScenePresence(destID, out ScenePresence ncp))
|
|
+ {
|
|
+ if(ncp.IsNPC && m_giveNPCInventoryToOwner)
|
|
+ {
|
|
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
|
|
+ UUID owner = npcModule.GetOwner(destID);
|
|
+
|
|
+ if (owner != UUID.Zero)
|
|
+ {
|
|
+ destID = owner;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
List<UUID> itemList = new List<UUID>(inventory.Length);
|
|
foreach (object item in inventory.Data)
|
|
{
|
|
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
|
|
index 1f44fcdae0..9ed700060d 100644
|
|
--- a/bin/OpenSimDefaults.ini
|
|
+++ b/bin/OpenSimDefaults.ini
|
|
@@ -1921,6 +1921,8 @@
|
|
;; Path to script assemblies
|
|
; ScriptEnginesPath = "ScriptEngines"
|
|
|
|
+ ;; Forwards inventory offers for NPCs to their owners.
|
|
+ ; GiveNPCInventoryToOwner = false
|
|
|
|
[Concierge]
|
|
; Enable concierge module
|
|
--
|
|
2.30.1.windows.1
|
|
|