replace patch
							parent
							
								
									0ecfe9c635
								
							
						
					
					
						commit
						98bcc72c3f
					
				|  | @ -1,89 +1,68 @@ | |||
| From 964d355b6eddd168ac5e884efb0e122a89175237 Mon Sep 17 00:00:00 2001 | ||||
| From 07ffb79973857fed2437a2e0d811ea61e4c579c3 Mon Sep 17 00:00:00 2001 | ||||
| From: Christopher <christopher@clatza.dev> | ||||
| Date: Sat, 7 Aug 2021 01:39:07 +0200 | ||||
| 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      | 30 ++++++++++++++++++- | ||||
|  bin/OpenSimDefaults.ini                       |  2 ++ | ||||
|  2 files changed, 31 insertions(+), 1 deletion(-) | ||||
|  .../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..5359e3358e 100644
 | ||||
| index 9de2c8ca78..df2f235ec7 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>(); | ||||
| @@ -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 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
 | ||||
| @@ -4795,6 +4795,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
 | ||||
|                      } | ||||
|                  } | ||||
|   | ||||
| +                // destination is an npc
 | ||||
| +                if(presence.IsNPC && m_giveNPCInventoryToOwner)
 | ||||
| +                if(presence.IsNPC)
 | ||||
| +                {
 | ||||
| +                    INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
 | ||||
| +                    UUID NPCOwner = npcModule.GetOwner(destId);
 | ||||
| +
 | ||||
| +                    if (NPCOwner != UUID.Zero)
 | ||||
| +                        destId = NPCOwner;
 | ||||
| +                    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,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
 | ||||
| @@ -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 && m_giveNPCInventoryToOwner)
 | ||||
| +                if(ncp.IsNPC)
 | ||||
| +                {
 | ||||
| +                    INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
 | ||||
| +                    UUID owner = npcModule.GetOwner(destID);
 | ||||
| +
 | ||||
| +                    if (owner != UUID.Zero)
 | ||||
| +                    {
 | ||||
| +                        destID = owner;
 | ||||
| +                    }
 | ||||
| +                    if (owner == UUID.Zero)
 | ||||
| +                        return;
 | ||||
| +
 | ||||
| +                    destID = owner;
 | ||||
| +                    destination = owner.ToString();
 | ||||
| +                }
 | ||||
| +            }
 | ||||
| +
 | ||||
|              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 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Christopher
						Christopher