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

69 lines
2.6 KiB
Diff
Raw Permalink Normal View History

2021-08-07 00:03:27 +00:00
From 07ffb79973857fed2437a2e0d811ea61e4c579c3 Mon Sep 17 00:00:00 2001
2021-08-06 23:17:46 +00:00
From: Christopher <christopher@clatza.dev>
2021-08-07 00:03:27 +00:00
Date: Sat, 7 Aug 2021 02:03:08 +0200
2021-08-06 23:39:44 +00:00
Subject: [PATCH] Forwards inventory offers for NPCs to their owners.
2021-08-06 23:17:46 +00:00
---
2021-08-07 00:03:27 +00:00
.../Shared/Api/Implementation/LSL_Api.cs | 31 ++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
2021-08-06 23:17:46 +00:00
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
2021-08-07 00:03:27 +00:00
index 9de2c8ca78..df2f235ec7 100644
2021-08-06 23:17:46 +00:00
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
2021-08-07 00:03:27 +00:00
@@ -247,7 +247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2021-08-06 23:17:46 +00:00
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;
2021-08-07 00:03:27 +00:00
@@ -4795,6 +4795,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2021-08-06 23:17:46 +00:00
}
}
+ // destination is an npc
2021-08-07 00:03:27 +00:00
+ if(presence.IsNPC)
2021-08-06 23:17:46 +00:00
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2021-08-06 23:39:44 +00:00
+ UUID NPCOwner = npcModule.GetOwner(destId);
2021-08-06 23:17:46 +00:00
+
2021-08-07 00:03:27 +00:00
+ if (NPCOwner == UUID.Zero)
+ return;
+
+ destId = NPCOwner;
+ destination = NPCOwner.ToString();
2021-08-06 23:17:46 +00:00
+ }
+
// destination is an avatar
InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out string message);
2021-08-07 00:03:27 +00:00
@@ -7739,6 +7752,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2021-08-06 23:17:46 +00:00
isNotOwner = sp.UUID != m_host.OwnerID;
}
2021-08-06 23:39:44 +00:00
+ // destination is an npc
2021-08-06 23:17:46 +00:00
+ if (World.TryGetScenePresence(destID, out ScenePresence ncp))
+ {
2021-08-07 00:03:27 +00:00
+ if(ncp.IsNPC)
2021-08-06 23:17:46 +00:00
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
+ UUID owner = npcModule.GetOwner(destID);
+
2021-08-07 00:03:27 +00:00
+ if (owner == UUID.Zero)
+ return;
+
+ destID = owner;
+ destination = owner.ToString();
2021-08-06 23:17:46 +00:00
+ }
+ }
+
List<UUID> itemList = new List<UUID>(inventory.Length);
foreach (object item in inventory.Data)
{
--
2.30.1.windows.1