1
0
Fork 0
4Creative-Changes/CurrentPatches/0001-Forwards-inventory-off...

69 lines
2.6 KiB
Diff

From 07ffb79973857fed2437a2e0d811ea61e4c579c3 Mon Sep 17 00:00:00 2001
From: Christopher <christopher@clatza.dev>
Date: Sat, 7 Aug 2021 02:03:08 +0200
Subject: [PATCH] Forwards inventory offers for NPCs to their owners.
---
.../Shared/Api/Implementation/LSL_Api.cs | 31 ++++++++++++++++++-
1 file changed, 30 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..df2f235ec7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -247,7 +247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected bool m_useMeshCacheInCastRay = true;
protected static Dictionary<ulong, FacetedMesh> m_cachedMeshes = new Dictionary<ulong, FacetedMesh>();
-// protected Timer m_ShoutSayTimer;
+ // protected Timer m_ShoutSayTimer;
protected int m_SayShoutCount = 0;
DateTime m_lastSayShoutCheck;
@@ -4795,6 +4795,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+ // destination is an npc
+ if(presence.IsNPC)
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
+ UUID NPCOwner = npcModule.GetOwner(destId);
+
+ if (NPCOwner == UUID.Zero)
+ return;
+
+ destId = NPCOwner;
+ destination = NPCOwner.ToString();
+ }
+
// destination is an avatar
InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out string message);
@@ -7739,6 +7752,22 @@ 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)
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
+ UUID owner = npcModule.GetOwner(destID);
+
+ if (owner == UUID.Zero)
+ return;
+
+ destID = owner;
+ destination = owner.ToString();
+ }
+ }
+
List<UUID> itemList = new List<UUID>(inventory.Length);
foreach (object item in inventory.Data)
{
--
2.30.1.windows.1