add patch
parent
48d1fb1963
commit
3994661878
|
@ -0,0 +1,77 @@
|
||||||
|
From 05218150d39869f85e1f93f7da8397226066ef91 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christopher <christopher@clatza.dev>
|
||||||
|
Date: Sat, 7 Aug 2021 01:17:06 +0200
|
||||||
|
Subject: [PATCH] redirect inventory offers on npcs to their owners.
|
||||||
|
|
||||||
|
---
|
||||||
|
.../Shared/Api/Implementation/LSL_Api.cs | 32 ++++++++++++++++++-
|
||||||
|
1 file 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..4b971a9882 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 = true;
|
||||||
|
|
||||||
|
-// 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,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // destination is an npc
|
||||||
|
+ if(presence.IsNPC && m_giveNPCInventoryToOwner)
|
||||||
|
+ {
|
||||||
|
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
|
||||||
|
+ UUID NPCOwner = npcModule.GetOwner(UUID.Parse(destination));
|
||||||
|
+
|
||||||
|
+ if (NPCOwner == UUID.Zero)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ destination = NPCOwner.ToString();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// destination is an avatar
|
||||||
|
InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out string message);
|
||||||
|
|
||||||
|
@@ -7739,6 +7754,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
isNotOwner = sp.UUID != m_host.OwnerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ 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;
|
||||||
|
+ destination = owner.ToString();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
List<UUID> itemList = new List<UUID>(inventory.Length);
|
||||||
|
foreach (object item in inventory.Data)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.30.1.windows.1
|
||||||
|
|
Loading…
Reference in New Issue