1
0
Fork 0

replace patch

master
Christopher 2021-08-07 01:39:44 +02:00
parent 3994661878
commit 0ecfe9c635
1 changed files with 27 additions and 15 deletions

View File

@ -1,21 +1,22 @@
From 05218150d39869f85e1f93f7da8397226066ef91 Mon Sep 17 00:00:00 2001
From 964d355b6eddd168ac5e884efb0e122a89175237 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.
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 | 32 ++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
.../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..4b971a9882 100644
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 = true;
+ protected bool m_giveNPCInventoryToOwner = false;
-// protected Timer m_ShoutSayTimer;
+ // protected Timer m_ShoutSayTimer;
@ -31,7 +32,7 @@ index 9de2c8ca78..4b971a9882 100644
// 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
@@ -4795,6 +4798,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
@ -39,21 +40,20 @@ index 9de2c8ca78..4b971a9882 100644
+ if(presence.IsNPC && m_giveNPCInventoryToOwner)
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
+ UUID NPCOwner = npcModule.GetOwner(UUID.Parse(destination));
+ UUID NPCOwner = npcModule.GetOwner(destId);
+
+ if (NPCOwner == UUID.Zero)
+ return;
+
+ destination = NPCOwner.ToString();
+ 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 +7754,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
@@ -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)
@ -64,7 +64,6 @@ index 9de2c8ca78..4b971a9882 100644
+ if (owner != UUID.Zero)
+ {
+ destID = owner;
+ destination = owner.ToString();
+ }
+ }
+ }
@ -72,6 +71,19 @@ index 9de2c8ca78..4b971a9882 100644
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