From 2f398231acda79e313c2975ecdd5a6015cb71a54 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 23 Apr 2012 15:31:45 +0300 Subject: Minor improvements to logging Eliminated an extra newline in the console if the log line doesn't contain a category (example of a category: "[ASSETS]"). --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 2b8379d..435a683 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -157,7 +157,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC sp.CompleteMovement(npcAvatar, false); m_avatars.Add(npcAvatar.AgentId, npcAvatar); - m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); + m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); return npcAvatar.AgentId; } @@ -299,7 +299,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC scene.RemoveClient(agentID, false); m_avatars.Remove(agentID); -// m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name); + m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); return true; } } -- cgit v1.1 From b8114d2b67c8ae8d7551a2ece2177f8b7e958112 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 24 Apr 2012 21:54:13 +0100 Subject: Add a version of osNpcSay that takes a channel number Mantis 5747 osNpcSay(UUID npc, string message) left untouched New functions:- osNpcSay(UUID npc, int channel, string message) osNpcShout(UUID npc, int channel, string message) osNpcWhisper(UUID npc, int channel, string message) Signed-off-by: BlueWall --- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 21 +++++++---- .../Region/OptionalModules/World/NPC/NPCModule.cs | 43 +++++++++++++++++++++- 2 files changed, 55 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5ea5af7..e57e5e6 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -76,22 +76,27 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void Say(string message) { - SendOnChatFromClient(message, ChatTypeEnum.Say); + SendOnChatFromClient(0, message, ChatTypeEnum.Say); } - public void Shout(string message) + public void Say(int channel, string message) { - SendOnChatFromClient(message, ChatTypeEnum.Shout); + SendOnChatFromClient(channel, message, ChatTypeEnum.Say); } - public void Whisper(string message) + public void Shout(int channel, string message) { - SendOnChatFromClient(message, ChatTypeEnum.Whisper); + SendOnChatFromClient(channel, message, ChatTypeEnum.Shout); + } + + public void Whisper(int channel, string message) + { + SendOnChatFromClient(channel, message, ChatTypeEnum.Whisper); } public void Broadcast(string message) { - SendOnChatFromClient(message, ChatTypeEnum.Broadcast); + SendOnChatFromClient(0, message, ChatTypeEnum.Broadcast); } public void GiveMoney(UUID target, int amount) @@ -146,10 +151,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC #region Internal Functions - private void SendOnChatFromClient(string message, ChatTypeEnum chatType) + private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType) { OSChatMessage chatFromClient = new OSChatMessage(); - chatFromClient.Channel = 0; + chatFromClient.Channel = channel; chatFromClient.From = Name; chatFromClient.Message = message; chatFromClient.Position = StartPos; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 2b8379d..adc6f9c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -212,6 +212,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC public bool Say(UUID agentID, Scene scene, string text) { + return Say(agentID, scene, text, 0); + } + + public bool Say(UUID agentID, Scene scene, string text, int channel) + { lock (m_avatars) { if (m_avatars.ContainsKey(agentID)) @@ -219,7 +224,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC ScenePresence sp; scene.TryGetScenePresence(agentID, out sp); - m_avatars[agentID].Say(text); + m_avatars[agentID].Say(channel, text); + + return true; + } + } + + return false; + } + + public bool Shout(UUID agentID, Scene scene, string text, int channel) + { + lock (m_avatars) + { + if (m_avatars.ContainsKey(agentID)) + { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + + m_avatars[agentID].Shout(channel, text); return true; } @@ -246,6 +269,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC return false; } + public bool Whisper(UUID agentID, Scene scene, string text, int channel) + { + lock (m_avatars) + { + if (m_avatars.ContainsKey(agentID)) + { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + + m_avatars[agentID].Whisper(channel, text); + + return true; + } + } + + return false; + } + public bool Stand(UUID agentID, Scene scene) { lock (m_avatars) -- cgit v1.1 From 07e62df5582e28675275b3f5143ec37e5697d283 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 27 Apr 2012 00:58:54 +0100 Subject: Add regression test for teleporting an agent between separated regions on the same simulator. This involves a large amount of change in test scene setup code to allow test scenes to share shared modules SetupScene is now an instance method that requires an instantiation of SceneHelpers, though other SceneHelpers methods are still static May split these out into separate classes in the future. --- OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index eea0b2e..a39257e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests m_attMod = new AttachmentsModule(); m_npcMod = new NPCModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); } -- cgit v1.1 From b697d0e895dc7670e160188501da88a780455500 Mon Sep 17 00:00:00 2001 From: dahlia Date: Sun, 6 May 2012 23:54:50 -0700 Subject: add OS_NPC_RUNNING option to osNpcMoveToTarget() to allow running speed for moving NPCs --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3ac1eb1..541ad7d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -169,7 +169,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } - public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running = false) { lock (m_avatars) { @@ -183,6 +183,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); sp.MoveToTarget(pos, noFly, landAtTarget); + sp.SetAlwaysRun = running; return true; } -- cgit v1.1 From 4186fa10f0eba3628ef8222db2e4b0e2b69df5cd Mon Sep 17 00:00:00 2001 From: dahlia Date: Mon, 7 May 2012 00:08:56 -0700 Subject: remove default values from prior commit since mono cant deal with them --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 2 +- OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 541ad7d..d3456ab 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -169,7 +169,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } - public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running = false) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running) { lock (m_avatars) { diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index a39257e..65dad2d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -242,7 +242,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Vector3 targetPos = startPos + new Vector3(0, 10, 0); - m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); + m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); @@ -267,7 +267,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // Try a second movement startPos = npc.AbsolutePosition; targetPos = startPos + new Vector3(10, 0, 0); - m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); + m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); -- cgit v1.1 From abf94627f6752c81eec6ebe0412bdcb725a66037 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 6 Jun 2012 02:45:36 +0100 Subject: Ensure closure of bitmap and memory stream with using() statements in WorldViewModule. If this has any effect then it will only be to the map images returned via requests to the /worldview simulator HTTP path (not enabled by default) --- .../OptionalModules/World/WorldView/WorldViewModule.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs index 48c242d..1aee39a 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs @@ -113,14 +113,15 @@ namespace OpenSim.Region.OptionalModules.World.WorldView if (!m_Enabled) return new Byte[0]; - Bitmap bmp = m_Generator.CreateViewImage(pos, rot, fov, width, - height, usetex); - - MemoryStream str = new MemoryStream(); - - bmp.Save(str, ImageFormat.Jpeg); + using (Bitmap bmp = m_Generator.CreateViewImage(pos, rot, fov, width, height, usetex)) + { + using (MemoryStream str = new MemoryStream()) + { + bmp.Save(str, ImageFormat.Jpeg); - return str.ToArray(); + return str.ToArray(); + } + } } } } -- cgit v1.1 From cf080a68d657e082dd61dacc24ffd17240154e90 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jun 2012 23:42:22 +0100 Subject: Remove long obsolete and unused IClientAPI.KillEndDone() --- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index e57e5e6..b3e1069 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -1044,10 +1044,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public void KillEndDone() - { - } - public void SendEventInfoReply (EventData info) { } -- cgit v1.1 From 951b45b80fd504b4874b9ec3e0fbff49a25cb46f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jul 2012 00:05:06 +0100 Subject: Add OSSL function osForceAttachToAvatarFromInventory() This works like osForceAttachToAvatar() but allows an object to be directly specified from the script object's inventory rather than forcing it to be rezzed in the scene first. Still only attaches objects to the owner of the script. This allows one to bypass the complicated co-ordination of first rezzing objects in the scene before attaching them. Threat level high. --- OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 65dad2d..9179966 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -301,7 +301,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); ScenePresence npc = m_scene.GetScenePresence(npcId); - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; part.SitTargetPosition = new Vector3(0, 0, 1); m_npcMod.Sit(npc.UUID, part.UUID, m_scene); @@ -333,7 +333,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); ScenePresence npc = m_scene.GetScenePresence(npcId); - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; m_npcMod.Sit(npc.UUID, part.UUID, m_scene); -- cgit v1.1 From 1b1f841c6aaf2453b3aca0eade84855ae658e655 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 3 Jul 2012 11:10:09 +0100 Subject: Mantis 6063 osNpcTouch. Allow NPCS to touch obects. --- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 39 ++++++++++++++++++++++ .../Region/OptionalModules/World/NPC/NPCModule.cs | 10 ++++++ 2 files changed, 49 insertions(+) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index b3e1069..43a09ec 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -104,6 +104,45 @@ namespace OpenSim.Region.OptionalModules.World.NPC OnMoneyTransferRequest(m_uuid, target, amount, 1, "Payment"); } + public bool Touch(UUID target) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(target); + if (part == null) + return false; + bool objectTouchable = hasTouchEvents(part); // Only touch an object that is scripted to respond + if (!objectTouchable && !part.IsRoot) + objectTouchable = hasTouchEvents(part.ParentGroup.RootPart); + if (!objectTouchable) + return false; + // Set up the surface args as if the touch is from a client that does not support this + SurfaceTouchEventArgs surfaceArgs = new SurfaceTouchEventArgs(); + surfaceArgs.FaceIndex = -1; // TOUCH_INVALID_FACE + surfaceArgs.Binormal = Vector3.Zero; // TOUCH_INVALID_VECTOR + surfaceArgs.Normal = Vector3.Zero; // TOUCH_INVALID_VECTOR + surfaceArgs.STCoord = new Vector3(-1.0f, -1.0f, 0.0f); // TOUCH_INVALID_TEXCOORD + surfaceArgs.UVCoord = surfaceArgs.STCoord; // TOUCH_INVALID_TEXCOORD + List touchArgs = new List(); + touchArgs.Add(surfaceArgs); + Vector3 offset = part.OffsetPosition * -1.0f; + if (OnGrabObject == null) + return false; + OnGrabObject(part.LocalId, offset, this, touchArgs); + if (OnGrabUpdate != null) + OnGrabUpdate(part.UUID, offset, part.ParentGroup.RootPart.GroupPosition, this, touchArgs); + if (OnDeGrabObject != null) + OnDeGrabObject(part.LocalId, this, touchArgs); + return true; + } + + private bool hasTouchEvents(SceneObjectPart part) + { + if ((part.ScriptEvents & scriptEvents.touch) != 0 || + (part.ScriptEvents & scriptEvents.touch_start) != 0 || + (part.ScriptEvents & scriptEvents.touch_end) != 0) + return true; + return false; + } + public void InstantMessage(UUID target, string message) { OnInstantMessage(this, new GridInstantMessage(m_scene, diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index d3456ab..1e85fb4 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -305,6 +305,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC return false; } + public bool Touch(UUID agentID, UUID objectID) + { + lock (m_avatars) + { + if (m_avatars.ContainsKey(agentID)) + return m_avatars[agentID].Touch(objectID); + return false; + } + } + public UUID GetOwner(UUID agentID) { lock (m_avatars) -- cgit v1.1 From ae1f2114f5ccb0422536ec73feb2dbf16c2645fd Mon Sep 17 00:00:00 2001 From: Talun Date: Thu, 5 Jul 2012 23:34:23 +0100 Subject: Mantis 6077 trim NPC chat on channel zero. This patch trims leading and trailing spaces from NPC chat and suppresses the sending of empty chat strings on open chat channel 0. --- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 43a09ec..9b3400d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -192,6 +192,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType) { + if (channel == 0) + { + message = message.Trim(); + if (string.IsNullOrEmpty(message)) + { + return; + } + } OSChatMessage chatFromClient = new OSChatMessage(); chatFromClient.Channel = channel; chatFromClient.From = Name; -- cgit v1.1 From 3b3d9967b18335c28ce2dfc269e47bac0ede075a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Jul 2012 23:29:57 +0100 Subject: Remove IClientAPI.GetClientEP() in favour of existing identical IClientAPI.RemoteEndpoint. --- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 9b3400d..67989ba 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -945,11 +945,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public EndPoint GetClientEP() - { - return null; - } - public ClientInfo GetClientInfo() { return null; -- cgit v1.1