diff options
Diffstat (limited to 'OpenSim')
11 files changed, 74 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 5e5c4a1..9dd8c79 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs | |||
@@ -95,6 +95,15 @@ namespace OpenSim.Region.Framework.Interfaces | |||
95 | bool Say(UUID agentID, Scene scene, string text); | 95 | bool Say(UUID agentID, Scene scene, string text); |
96 | 96 | ||
97 | /// <summary> | 97 | /// <summary> |
98 | /// Sit the NPC. | ||
99 | /// </summary> | ||
100 | /// <param name="agentID"></param> | ||
101 | /// <param name="partID"></param> | ||
102 | /// <param name="scene"></param> | ||
103 | /// <returns>true if the sit succeeded, false if not</returns> | ||
104 | bool Sit(UUID agentID, UUID partID, Scene scene); | ||
105 | |||
106 | /// <summary> | ||
98 | /// Delete an NPC. | 107 | /// Delete an NPC. |
99 | /// </summary> | 108 | /// </summary> |
100 | /// <param name="agentID">The UUID of the NPC</param> | 109 | /// <param name="agentID">The UUID of the NPC</param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fae1618..5381f63 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -493,8 +493,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
493 | { | 493 | { |
494 | foreach (ScenePresence av in m_linkedAvatars) | 494 | foreach (ScenePresence av in m_linkedAvatars) |
495 | { | 495 | { |
496 | SceneObjectPart p; | 496 | SceneObjectPart p = m_scene.GetSceneObjectPart(av.ParentID); |
497 | if (m_parts.TryGetValue(av.LinkedPrim, out p)) | 497 | if (m_parts.TryGetValue(p.UUID, out p)) |
498 | { | 498 | { |
499 | Vector3 offset = p.GetWorldPosition() - av.ParentPosition; | 499 | Vector3 offset = p.GetWorldPosition() - av.ParentPosition; |
500 | av.AbsolutePosition += offset; | 500 | av.AbsolutePosition += offset; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d7435c6..89b98af 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -776,7 +776,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
776 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | 776 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); |
777 | foreach (ScenePresence av in avs) | 777 | foreach (ScenePresence av in avs) |
778 | { | 778 | { |
779 | if (av.LinkedPrim == m_uuid) | 779 | if (av.ParentID == m_localId) |
780 | { | 780 | { |
781 | Vector3 offset = (m_offsetPosition - oldpos); | 781 | Vector3 offset = (m_offsetPosition - oldpos); |
782 | av.AbsolutePosition += offset; | 782 | av.AbsolutePosition += offset; |
@@ -1260,14 +1260,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1260 | set { m_occupied = value; } | 1260 | set { m_occupied = value; } |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | |||
1264 | public UUID SitTargetAvatar | 1263 | public UUID SitTargetAvatar |
1265 | { | 1264 | { |
1266 | get { return m_sitTargetAvatar; } | 1265 | get { return m_sitTargetAvatar; } |
1267 | set { m_sitTargetAvatar = value; } | 1266 | set { m_sitTargetAvatar = value; } |
1268 | } | 1267 | } |
1269 | 1268 | ||
1270 | |||
1271 | public virtual UUID RegionID | 1269 | public virtual UUID RegionID |
1272 | { | 1270 | { |
1273 | get | 1271 | get |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bdfad40..bb65322 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -671,19 +671,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
671 | private uint m_parentID; | 671 | private uint m_parentID; |
672 | 672 | ||
673 | 673 | ||
674 | private UUID m_linkedPrim; | ||
675 | |||
676 | public uint ParentID | 674 | public uint ParentID |
677 | { | 675 | { |
678 | get { return m_parentID; } | 676 | get { return m_parentID; } |
679 | set { m_parentID = value; } | 677 | set { m_parentID = value; } |
680 | } | 678 | } |
681 | 679 | ||
682 | public UUID LinkedPrim | ||
683 | { | ||
684 | get { return m_linkedPrim; } | ||
685 | set { m_linkedPrim = value; } | ||
686 | } | ||
687 | 680 | ||
688 | public float Health | 681 | public float Health |
689 | { | 682 | { |
@@ -2056,7 +2049,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2056 | 2049 | ||
2057 | m_parentPosition = Vector3.Zero; | 2050 | m_parentPosition = Vector3.Zero; |
2058 | m_parentID = 0; | 2051 | m_parentID = 0; |
2059 | m_linkedPrim = UUID.Zero; | ||
2060 | m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); | 2052 | m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); |
2061 | SendAvatarDataToAllAgents(); | 2053 | SendAvatarDataToAllAgents(); |
2062 | m_requestedSitTargetID = 0; | 2054 | m_requestedSitTargetID = 0; |
@@ -2513,7 +2505,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2513 | } | 2505 | } |
2514 | */ | 2506 | */ |
2515 | 2507 | ||
2516 | |||
2517 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) | 2508 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) |
2518 | { | 2509 | { |
2519 | if (!String.IsNullOrEmpty(m_nextSitAnimation)) | 2510 | if (!String.IsNullOrEmpty(m_nextSitAnimation)) |
@@ -2616,7 +2607,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2616 | m_parentID = m_requestedSitTargetID; | 2607 | m_parentID = m_requestedSitTargetID; |
2617 | } | 2608 | } |
2618 | 2609 | ||
2619 | m_linkedPrim = part.UUID; | ||
2620 | if (part.GetAvatarOnSitTarget() != UUID) | 2610 | if (part.GetAvatarOnSitTarget() != UUID) |
2621 | { | 2611 | { |
2622 | m_offsetRotation = m_offsetRotation / part.RotationOffset; | 2612 | m_offsetRotation = m_offsetRotation / part.RotationOffset; |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index bcd9e94..be73639 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -199,6 +199,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
199 | return false; | 199 | return false; |
200 | } | 200 | } |
201 | 201 | ||
202 | public bool Sit(UUID agentID, UUID partID, Scene scene) | ||
203 | { | ||
204 | lock (m_avatars) | ||
205 | { | ||
206 | if (m_avatars.ContainsKey(agentID)) | ||
207 | { | ||
208 | ScenePresence sp; | ||
209 | scene.TryGetScenePresence(agentID, out sp); | ||
210 | sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); | ||
211 | sp.HandleAgentSit(m_avatars[agentID], agentID); | ||
212 | |||
213 | return true; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | return false; | ||
218 | } | ||
219 | |||
202 | public bool DeleteNPC(UUID agentID, Scene scene) | 220 | public bool DeleteNPC(UUID agentID, Scene scene) |
203 | { | 221 | { |
204 | lock (m_avatars) | 222 | lock (m_avatars) |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 49c06bc..c5be0b6 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -229,5 +229,29 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
229 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); | 229 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); |
230 | Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); | 230 | Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); |
231 | } | 231 | } |
232 | |||
233 | [Test] | ||
234 | public void TestSit() | ||
235 | { | ||
236 | TestHelpers.InMethod(); | ||
237 | // log4net.Config.XmlConfigurator.Configure(); | ||
238 | |||
239 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | ||
240 | |||
241 | Vector3 startPos = new Vector3(128, 128, 30); | ||
242 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | ||
243 | UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance); | ||
244 | |||
245 | ScenePresence npc = scene.GetScenePresence(npcId); | ||
246 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | ||
247 | |||
248 | // We must have a non Vector3.Zero sit target position otherwise part.SitTargetAvatar doesn't get set! | ||
249 | part.SitTargetPosition = new Vector3(0, 0, 1); | ||
250 | npcModule.Sit(npc.UUID, part.UUID, scene); | ||
251 | |||
252 | // Assertions? | ||
253 | Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); | ||
254 | Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); | ||
255 | } | ||
232 | } | 256 | } |
233 | } \ No newline at end of file | 257 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index fc45b82..ffcb004 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -687,6 +687,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
687 | /// <param name="g2">another geometry or space</param> | 687 | /// <param name="g2">another geometry or space</param> |
688 | private void near(IntPtr space, IntPtr g1, IntPtr g2) | 688 | private void near(IntPtr space, IntPtr g1, IntPtr g2) |
689 | { | 689 | { |
690 | // m_log.DebugFormat("[PHYSICS]: Colliding {0} and {1} in {2}", g1, g2, space); | ||
690 | // no lock here! It's invoked from within Simulate(), which is thread-locked | 691 | // no lock here! It's invoked from within Simulate(), which is thread-locked |
691 | 692 | ||
692 | // Test if we're colliding a geom with a space. | 693 | // Test if we're colliding a geom with a space. |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b19f8cf..bfe62c7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2359,6 +2359,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2359 | } | 2359 | } |
2360 | } | 2360 | } |
2361 | 2361 | ||
2362 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | ||
2363 | { | ||
2364 | CheckThreatLevel(ThreatLevel.High, "osNpcSit"); | ||
2365 | |||
2366 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2367 | if (module != null) | ||
2368 | { | ||
2369 | module.Sit(new UUID(npc.m_string), new UUID(target.m_string), World); | ||
2370 | } | ||
2371 | } | ||
2372 | |||
2362 | public void osNpcRemove(LSL_Key npc) | 2373 | public void osNpcRemove(LSL_Key npc) |
2363 | { | 2374 | { |
2364 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); | 2375 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 5ddba60..8fe43dd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -178,6 +178,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
178 | void osNpcSetRot(LSL_Key npc, rotation rot); | 178 | void osNpcSetRot(LSL_Key npc, rotation rot); |
179 | void osNpcStopMoveToTarget(LSL_Key npc); | 179 | void osNpcStopMoveToTarget(LSL_Key npc); |
180 | void osNpcSay(key npc, string message); | 180 | void osNpcSay(key npc, string message); |
181 | void osNpcSit(key npc, key target, int options); | ||
181 | void osNpcRemove(key npc); | 182 | void osNpcRemove(key npc); |
182 | 183 | ||
183 | LSL_Key osOwnerSaveAppearance(string notecard); | 184 | LSL_Key osOwnerSaveAppearance(string notecard); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 864d59c..be51650 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -603,6 +603,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
603 | public const int OS_NPC_NO_FLY = 1; | 603 | public const int OS_NPC_NO_FLY = 1; |
604 | public const int OS_NPC_LAND_AT_TARGET = 2; | 604 | public const int OS_NPC_LAND_AT_TARGET = 2; |
605 | 605 | ||
606 | public const int OS_NPC_SIT_IMMEDIATE = 0; | ||
607 | |||
606 | public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; | 608 | public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; |
607 | public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; | 609 | public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; |
608 | 610 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index bbc8cc6..38391df 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -528,6 +528,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
528 | m_OSSL_Functions.osNpcSay(npc, message); | 528 | m_OSSL_Functions.osNpcSay(npc, message); |
529 | } | 529 | } |
530 | 530 | ||
531 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | ||
532 | { | ||
533 | m_OSSL_Functions.osNpcSit(npc, target, options); | ||
534 | } | ||
535 | |||
531 | public void osNpcRemove(key npc) | 536 | public void osNpcRemove(key npc) |
532 | { | 537 | { |
533 | m_OSSL_Functions.osNpcRemove(npc); | 538 | m_OSSL_Functions.osNpcRemove(npc); |